diff options
-rw-r--r-- | meta/classes-recipe/uboot-sign.bbclass | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass index 73e9ce3f11..01c53c7448 100644 --- a/meta/classes-recipe/uboot-sign.bbclass +++ b/meta/classes-recipe/uboot-sign.bbclass | |||
@@ -50,6 +50,8 @@ UBOOT_FITIMAGE_BINARY ?= "u-boot-fitImage" | |||
50 | UBOOT_FITIMAGE_SYMLINK ?= "u-boot-fitImage-${MACHINE}" | 50 | UBOOT_FITIMAGE_SYMLINK ?= "u-boot-fitImage-${MACHINE}" |
51 | SPL_DIR ?= "spl" | 51 | SPL_DIR ?= "spl" |
52 | SPL_DTB_IMAGE ?= "u-boot-spl-${MACHINE}-${PV}-${PR}.dtb" | 52 | SPL_DTB_IMAGE ?= "u-boot-spl-${MACHINE}-${PV}-${PR}.dtb" |
53 | # When SPL is not used, set SPL_DTB_BINARY ?= "" to explicitly indicate | ||
54 | # that no SPL DTB should be created or signed. | ||
53 | SPL_DTB_BINARY ?= "u-boot-spl.dtb" | 55 | SPL_DTB_BINARY ?= "u-boot-spl.dtb" |
54 | SPL_DTB_SIGNED ?= "${SPL_DTB_BINARY}-signed" | 56 | SPL_DTB_SIGNED ?= "${SPL_DTB_BINARY}-signed" |
55 | SPL_DTB_SYMLINK ?= "u-boot-spl-${MACHINE}.dtb" | 57 | SPL_DTB_SYMLINK ?= "u-boot-spl-${MACHINE}.dtb" |
@@ -466,25 +468,31 @@ EOF | |||
466 | ${UBOOT_FITIMAGE_BINARY} | 468 | ${UBOOT_FITIMAGE_BINARY} |
467 | 469 | ||
468 | if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then | 470 | if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then |
469 | # | 471 | if [ -n "${SPL_DTB_BINARY}" ] ; then |
470 | # Sign the U-boot FIT image and add public key to SPL dtb | 472 | # |
471 | # | 473 | # Sign the U-boot FIT image and add public key to SPL dtb |
472 | ${UBOOT_MKIMAGE_SIGN} \ | 474 | # |
473 | ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \ | 475 | ${UBOOT_MKIMAGE_SIGN} \ |
474 | -F -k "${SPL_SIGN_KEYDIR}" \ | 476 | ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \ |
475 | -K "${SPL_DIR}/${SPL_DTB_BINARY}" \ | 477 | -F -k "${SPL_SIGN_KEYDIR}" \ |
476 | -r ${UBOOT_FITIMAGE_BINARY} \ | 478 | -K "${SPL_DIR}/${SPL_DTB_BINARY}" \ |
477 | ${SPL_MKIMAGE_SIGN_ARGS} | 479 | -r ${UBOOT_FITIMAGE_BINARY} \ |
478 | # | 480 | ${SPL_MKIMAGE_SIGN_ARGS} |
479 | # Verify the U-boot FIT image and SPL dtb | ||
480 | # | ||
481 | ${UBOOT_FIT_CHECK_SIGN} \ | ||
482 | -k "${SPL_DIR}/${SPL_DTB_BINARY}" \ | ||
483 | -f ${UBOOT_FITIMAGE_BINARY} | ||
484 | fi | ||
485 | 481 | ||
486 | if [ -e "${SPL_DIR}/${SPL_DTB_BINARY}" ]; then | 482 | # Verify the U-boot FIT image and SPL dtb |
487 | cp ${SPL_DIR}/${SPL_DTB_BINARY} ${SPL_DIR}/${SPL_DTB_SIGNED} | 483 | ${UBOOT_FIT_CHECK_SIGN} \ |
484 | -k "${SPL_DIR}/${SPL_DTB_BINARY}" \ | ||
485 | -f ${UBOOT_FITIMAGE_BINARY} | ||
486 | |||
487 | cp ${SPL_DIR}/${SPL_DTB_BINARY} ${SPL_DIR}/${SPL_DTB_SIGNED} | ||
488 | else | ||
489 | # Sign the U-boot FIT image | ||
490 | ${UBOOT_MKIMAGE_SIGN} \ | ||
491 | ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \ | ||
492 | -F -k "${SPL_SIGN_KEYDIR}" \ | ||
493 | -r ${UBOOT_FITIMAGE_BINARY} \ | ||
494 | ${SPL_MKIMAGE_SIGN_ARGS} | ||
495 | fi | ||
488 | fi | 496 | fi |
489 | } | 497 | } |
490 | 498 | ||
@@ -496,7 +504,7 @@ uboot_assemble_fitimage_helper() { | |||
496 | concat_dtb "$type" "$binary" | 504 | concat_dtb "$type" "$binary" |
497 | fi | 505 | fi |
498 | 506 | ||
499 | if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ]; then | 507 | if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ]; then |
500 | uboot_fitimage_assemble | 508 | uboot_fitimage_assemble |
501 | fi | 509 | fi |
502 | 510 | ||
@@ -543,7 +551,7 @@ deploy_helper() { | |||
543 | deploy_dtb $type | 551 | deploy_dtb $type |
544 | fi | 552 | fi |
545 | 553 | ||
546 | if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ]; then | 554 | if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ]; then |
547 | if [ -n "${type}" ]; then | 555 | if [ -n "${type}" ]; then |
548 | uboot_its_image="u-boot-its-${type}-${PV}-${PR}" | 556 | uboot_its_image="u-boot-its-${type}-${PV}-${PR}" |
549 | uboot_fitimage_image="u-boot-fitImage-${type}-${PV}-${PR}" | 557 | uboot_fitimage_image="u-boot-fitImage-${type}-${PV}-${PR}" |
@@ -561,7 +569,7 @@ deploy_helper() { | |||
561 | fi | 569 | fi |
562 | fi | 570 | fi |
563 | 571 | ||
564 | if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_SIGNED}" ] ; then | 572 | if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ] ; then |
565 | deploy_spl_dtb $type | 573 | deploy_spl_dtb $type |
566 | fi | 574 | fi |
567 | } | 575 | } |