[OpenWrt-Devel] [PATCH 05/11] scripts/mkits.sh: extend with -s option to include a U-Boot script

Thomas Petazzoni thomas.petazzoni at bootlin.com
Mon Mar 11 12:20:22 EDT 2019


The mkits.sh prepares a .its file describing a FIT image. This commit
extends it to support a -s option, that allows to pass a file that
should be embedded as a U-Boot script in the FIT image.

This will be used as part of the dm-verity integration to add in the
FIT image a U-Boot script that provides the details of the dm-verity
volume (salt, root hash, number of data blocks, start of hash blocks,
etc.).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
 scripts/mkits.sh | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index 5d836be8e4..1033551555 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -16,7 +16,8 @@
 
 usage() {
 	echo "Usage: `basename $0` -A arch -C comp -a addr -e entry" \
-		"-v version -k kernel [-D name -d dtb] -o its_file"
+		"-v version -k kernel [-D name -d dtb] -o its_file" \
+		"-s script"
 	echo -e "\t-A ==> set architecture to 'arch'"
 	echo -e "\t-C ==> set compression type 'comp'"
 	echo -e "\t-c ==> set config name 'config'"
@@ -27,10 +28,11 @@ usage() {
 	echo -e "\t-D ==> human friendly Device Tree Blob 'name'"
 	echo -e "\t-d ==> include Device Tree Blob 'dtb'"
 	echo -e "\t-o ==> create output file 'its_file'"
+	echo -e "\t-s ==> include U-Boot script 'script'"
 	exit 1
 }
 
-while getopts ":A:a:c:C:D:d:e:k:o:v:" OPTION
+while getopts ":A:a:c:C:D:d:e:k:o:s:v:" OPTION
 do
 	case $OPTION in
 		A ) ARCH=$OPTARG;;
@@ -42,6 +44,7 @@ do
 		e ) ENTRY_ADDR=$OPTARG;;
 		k ) KERNEL=$OPTARG;;
 		o ) OUTPUT=$OPTARG;;
+		s ) SCRIPT=$OPTARG;;
 		v ) VERSION=$OPTARG;;
 		* ) echo "Invalid option passed to '$0' (options:$@)"
 		usage;;
@@ -76,6 +79,18 @@ if [ -n "${DTB}" ]; then
 "
 fi
 
+# Conditionally create script information
+if [ -n "${SCRIPT}" ]; then
+	SCRIPT="
+		script {
+			description = \"Script\";
+			data = /incbin/(\"${SCRIPT}\");
+			type = \"script\";
+			compression = \"none\";
+		};
+"
+fi
+
 # Create a default, fully populated DTS file
 DATA="/dts-v1/;
 
@@ -103,6 +118,8 @@ DATA="/dts-v1/;
 
 ${FDT}
 
+${SCRIPT}
+
 	};
 
 	configurations {
-- 
2.20.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list