diff options
| author | Sean Anderson <sean.anderson@seco.com> | 2022-10-21 19:37:24 -0400 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-10-26 12:28:40 +0100 |
| commit | deb6b92d44bf31265b6187d29c1b068517ec25c2 (patch) | |
| tree | aca41cc6a64a325bff483a5d8a3ae0a949bc06dd /meta/classes-recipe | |
| parent | 63b4efbbf4592113e8b6a7640b5048d9c21613f2 (diff) | |
| download | poky-deb6b92d44bf31265b6187d29c1b068517ec25c2.tar.gz | |
uboot-sign: Use bitbake variables directly
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.
(From OE-Core rev: 27f42c9b9a91742d3ee358aa8dc29627379b2539)
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe')
| -rw-r--r-- | meta/classes-recipe/uboot-sign.bbclass | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass index 4b5912a01d..85e23b963f 100644 --- a/meta/classes-recipe/uboot-sign.bbclass +++ b/meta/classes-recipe/uboot-sign.bbclass | |||
| @@ -311,14 +311,8 @@ addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compi | |||
| 311 | # Create a ITS file for the U-boot FIT, for use when | 311 | # Create a ITS file for the U-boot FIT, for use when |
| 312 | # we want to sign it so that the SPL can verify it | 312 | # we want to sign it so that the SPL can verify it |
| 313 | uboot_fitimage_assemble() { | 313 | uboot_fitimage_assemble() { |
| 314 | uboot_its="$1" | 314 | uboot_its="$(basename ${STAGING_DATADIR}/u-boot-its-*)" |
| 315 | uboot_nodtb_bin="$2" | 315 | uboot_bin="$(basename ${STAGING_DATADIR}/u-boot-fitImage-*)" |
| 316 | uboot_dtb="$3" | ||
| 317 | uboot_bin="$4" | ||
| 318 | spl_dtb="$5" | ||
| 319 | uboot_csum="${UBOOT_FIT_HASH_ALG}" | ||
| 320 | uboot_sign_algo="${UBOOT_FIT_SIGN_ALG}" | ||
| 321 | uboot_sign_keyname="${SPL_SIGN_KEYNAME}" | ||
| 322 | 316 | ||
| 323 | rm -f $uboot_its $uboot_bin | 317 | rm -f $uboot_its $uboot_bin |
| 324 | 318 | ||
| @@ -333,7 +327,7 @@ uboot_fitimage_assemble() { | |||
| 333 | images { | 327 | images { |
| 334 | uboot { | 328 | uboot { |
| 335 | description = "U-Boot image"; | 329 | description = "U-Boot image"; |
| 336 | data = /incbin/("$uboot_nodtb_bin"); | 330 | data = /incbin/("${UBOOT_NODTB_BINARY}"); |
| 337 | type = "standalone"; | 331 | type = "standalone"; |
| 338 | os = "u-boot"; | 332 | os = "u-boot"; |
| 339 | arch = "${UBOOT_ARCH}"; | 333 | arch = "${UBOOT_ARCH}"; |
| @@ -345,8 +339,8 @@ EOF | |||
| 345 | if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then | 339 | if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then |
| 346 | cat << EOF >> $uboot_its | 340 | cat << EOF >> $uboot_its |
| 347 | signature { | 341 | signature { |
| 348 | algo = "$uboot_csum,$uboot_sign_algo"; | 342 | algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}"; |
| 349 | key-name-hint = "$uboot_sign_keyname"; | 343 | key-name-hint = "${SPL_SIGN_KEYNAME}"; |
| 350 | }; | 344 | }; |
| 351 | EOF | 345 | EOF |
| 352 | fi | 346 | fi |
| @@ -355,7 +349,7 @@ EOF | |||
| 355 | }; | 349 | }; |
| 356 | fdt { | 350 | fdt { |
| 357 | description = "U-Boot FDT"; | 351 | description = "U-Boot FDT"; |
| 358 | data = /incbin/("$uboot_dtb"); | 352 | data = /incbin/("${UBOOT_DTB_BINARY}"); |
| 359 | type = "flat_dt"; | 353 | type = "flat_dt"; |
| 360 | arch = "${UBOOT_ARCH}"; | 354 | arch = "${UBOOT_ARCH}"; |
| 361 | compression = "none"; | 355 | compression = "none"; |
| @@ -364,8 +358,8 @@ EOF | |||
| 364 | if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then | 358 | if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then |
| 365 | cat << EOF >> $uboot_its | 359 | cat << EOF >> $uboot_its |
| 366 | signature { | 360 | signature { |
| 367 | algo = "$uboot_csum,$uboot_sign_algo"; | 361 | algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}"; |
| 368 | key-name-hint = "$uboot_sign_keyname"; | 362 | key-name-hint = "${SPL_SIGN_KEYNAME}"; |
| 369 | }; | 363 | }; |
| 370 | EOF | 364 | EOF |
| 371 | fi | 365 | fi |
| @@ -400,7 +394,7 @@ EOF | |||
| 400 | ${UBOOT_MKIMAGE_SIGN} \ | 394 | ${UBOOT_MKIMAGE_SIGN} \ |
| 401 | ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \ | 395 | ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \ |
| 402 | -F -k "${SPL_SIGN_KEYDIR}" \ | 396 | -F -k "${SPL_SIGN_KEYDIR}" \ |
| 403 | -K "$spl_dtb" \ | 397 | -K "${SPL_DTB_BINARY}" \ |
| 404 | -r $uboot_bin \ | 398 | -r $uboot_bin \ |
| 405 | ${SPL_MKIMAGE_SIGN_ARGS} | 399 | ${SPL_MKIMAGE_SIGN_ARGS} |
| 406 | fi | 400 | fi |
| @@ -430,12 +424,8 @@ do_uboot_assemble_fitimage() { | |||
| 430 | cp -P ${STAGING_DATADIR}/u-boot-spl*.dtb ${B} | 424 | cp -P ${STAGING_DATADIR}/u-boot-spl*.dtb ${B} |
| 431 | cp -P ${STAGING_DATADIR}/u-boot-nodtb*.bin ${B} | 425 | cp -P ${STAGING_DATADIR}/u-boot-nodtb*.bin ${B} |
| 432 | rm -rf ${B}/u-boot-fitImage-* ${B}/u-boot-its-* | 426 | rm -rf ${B}/u-boot-fitImage-* ${B}/u-boot-its-* |
| 433 | kernel_uboot_fitimage_name=`basename ${STAGING_DATADIR}/u-boot-fitImage-*` | ||
| 434 | kernel_uboot_its_name=`basename ${STAGING_DATADIR}/u-boot-its-*` | ||
| 435 | cd ${B} | 427 | cd ${B} |
| 436 | uboot_fitimage_assemble $kernel_uboot_its_name ${UBOOT_NODTB_BINARY} \ | 428 | uboot_fitimage_assemble |
| 437 | ${UBOOT_DTB_BINARY} $kernel_uboot_fitimage_name \ | ||
| 438 | ${SPL_DTB_BINARY} | ||
| 439 | fi | 429 | fi |
| 440 | } | 430 | } |
| 441 | 431 | ||
