]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
uboot-sign: Use bitbake variables directly
authorSean Anderson <sean.anderson@seco.com>
Fri, 21 Oct 2022 23:37:24 +0000 (19:37 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 26 Oct 2022 11:26:17 +0000 (12:26 +0100)
uboot_fitimage_assemble is called from one place with the same
arguments. Instead of using shell variables as intermediaries, simplify
the function by using the bitbake variables directly. Removing a layer
of indirection makes it easier to determine what values are being
substituted in. Some variables can't be fully converted, but they will
be addressed in the a few commits.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
meta/classes-recipe/uboot-sign.bbclass

index 4b5912a01dc3a86bff27060e7a6435d80ef0ecf7..85e23b963f1e82b0235c6a6f7aabe05c91c121c3 100644 (file)
@@ -311,14 +311,8 @@ addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compi
 # Create a ITS file for the U-boot FIT, for use when
 # we want to sign it so that the SPL can verify it
 uboot_fitimage_assemble() {
-       uboot_its="$1"
-       uboot_nodtb_bin="$2"
-       uboot_dtb="$3"
-       uboot_bin="$4"
-       spl_dtb="$5"
-       uboot_csum="${UBOOT_FIT_HASH_ALG}"
-       uboot_sign_algo="${UBOOT_FIT_SIGN_ALG}"
-       uboot_sign_keyname="${SPL_SIGN_KEYNAME}"
+       uboot_its="$(basename ${STAGING_DATADIR}/u-boot-its-*)"
+       uboot_bin="$(basename ${STAGING_DATADIR}/u-boot-fitImage-*)"
 
        rm -f $uboot_its $uboot_bin
 
@@ -333,7 +327,7 @@ uboot_fitimage_assemble() {
     images {
         uboot {
             description = "U-Boot image";
-            data = /incbin/("$uboot_nodtb_bin");
+            data = /incbin/("${UBOOT_NODTB_BINARY}");
             type = "standalone";
             os = "u-boot";
             arch = "${UBOOT_ARCH}";
@@ -345,8 +339,8 @@ EOF
        if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
                cat << EOF >> $uboot_its
             signature {
-                algo = "$uboot_csum,$uboot_sign_algo";
-                key-name-hint = "$uboot_sign_keyname";
+                algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}";
+                key-name-hint = "${SPL_SIGN_KEYNAME}";
             };
 EOF
        fi
@@ -355,7 +349,7 @@ EOF
         };
         fdt {
             description = "U-Boot FDT";
-            data = /incbin/("$uboot_dtb");
+            data = /incbin/("${UBOOT_DTB_BINARY}");
             type = "flat_dt";
             arch = "${UBOOT_ARCH}";
             compression = "none";
@@ -364,8 +358,8 @@ EOF
        if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
                cat << EOF >> $uboot_its
             signature {
-                algo = "$uboot_csum,$uboot_sign_algo";
-                key-name-hint = "$uboot_sign_keyname";
+                algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}";
+                key-name-hint = "${SPL_SIGN_KEYNAME}";
             };
 EOF
        fi
@@ -400,7 +394,7 @@ EOF
                ${UBOOT_MKIMAGE_SIGN} \
                        ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \
                        -F -k "${SPL_SIGN_KEYDIR}" \
-                       -K "$spl_dtb" \
+                       -K "${SPL_DTB_BINARY}" \
                        -r $uboot_bin \
                        ${SPL_MKIMAGE_SIGN_ARGS}
        fi
@@ -430,12 +424,8 @@ do_uboot_assemble_fitimage() {
                cp -P ${STAGING_DATADIR}/u-boot-spl*.dtb ${B}
                cp -P ${STAGING_DATADIR}/u-boot-nodtb*.bin ${B}
                rm -rf ${B}/u-boot-fitImage-* ${B}/u-boot-its-*
-               kernel_uboot_fitimage_name=`basename ${STAGING_DATADIR}/u-boot-fitImage-*`
-               kernel_uboot_its_name=`basename ${STAGING_DATADIR}/u-boot-its-*`
                cd ${B}
-               uboot_fitimage_assemble $kernel_uboot_its_name ${UBOOT_NODTB_BINARY} \
-                                       ${UBOOT_DTB_BINARY} $kernel_uboot_fitimage_name \
-                                       ${SPL_DTB_BINARY}
+               uboot_fitimage_assemble
        fi
 }