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.petazz...@bootlin.com>
---
 scripts/mkits.sh | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index 93c8cedaed..ce14f664d6 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;;
@@ -77,6 +80,18 @@ if [ -n "${DTB}" ]; then
        FDT_PROP="fdt = \"fdt@1\";"
 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/;
 
@@ -102,6 +117,9 @@ DATA="/dts-v1/;
                        };
                };
 ${FDT_NODE}
+
+${SCRIPT}
+
        };
 
        configurations {
-- 
2.23.0


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

Reply via email to