uboot-sign: fix the concatenation when multiple U-BOOT configurations are specified
PATCH 1/1 uboot-sign: fix the concatenation when multiple U-BOOT configurations are specified
Some BSPs, especially those of meta-freescale and meta-ti allow to build U-Boot binaries using different configuration for a given target, for example:
- UBOOT_CONFIG ??= "tfa-secure-boot tfa"
- UBOOT_CONFIG ??= "nand sdcard spi nor"
When this is the case the public key wasn't concatenated to all U-Boot binaries built.
--- meta/classes/uboot-sign.bbclass | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
meta/classes/uboot-sign.bbclass +15 -1
@@ -131,6 +131,20 @@ concat_dtb_helper() { elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then cd ${DEPLOYDIR} cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${B}/${CONFIG_B_PATH}/${UBOOT_BINARY} > ${UBOOT_IMAGE} + + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + cp ${UBOOT_IMAGE} ${B}/${CONFIG_B_PATH}/u-boot-$type.${UBOOT_SUFFIX} + fi + done + done + fi else bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available." fi
@@ -205,7 +219,7 @@ install_helper() { fi } -# Install SPL dtb and u-boot nodtb to datadir, +# Install SPL dtb and u-boot nodtb to datadir, install_spl_helper() { if [ -f "${SPL_DIR}/${SPL_DTB_BINARY}" ]; then install -Dm 0644 ${SPL_DIR}/${SPL_DTB_BINARY} ${D}${datadir}/${SPL_DTB_IMAGE}
Signature · 1 line
2.31.1
Quoted 39 lines · Thomas Perrot
Some BSPs, especially those of meta-freescale and meta-ti allow to build U-Boot binaries using different configuration for a given target, for example:
-UBOOT_CONFIG??= "tfa-secure-boot tfa"
-UBOOT_CONFIG??= "nand sdcard spi nor"When this is the case the public key wasn't concatenated to all U-Boot binaries built.
Signed-off-by Thomas Perrot <[email protected]>--- meta/classes/uboot-sign.bbclass | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)meta/classes/uboot-sign.bbclass +14
-0@@ -131,6 +131,20 @@ concat_dtb_helper() { elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then cd ${DEPLOYDIR} cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${B}/${CONFIG_B_PATH}/${UBOOT_BINARY} > ${UBOOT_IMAGE} + + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + cp ${UBOOT_IMAGE} ${B}/${CONFIG_B_PATH}/u-boot-$type.${UBOOT_SUFFIX} + fi + done + done + fi else bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available." fi
meta/classes/uboot-sign.bbclass install_helper() { · line 225
Quoted 8 lines
meta/classes/uboot-sign.bbclass +1
-1@@ -205,7 +219,7 @@ install_helper() { fi } -# Install SPL dtb and u-boot nodtb to datadir, +# Install SPL dtb and u-boot nodtb to datadir, install_spl_helper() { if [ -f "${SPL_DIR}/${SPL_DTB_BINARY}" ]; then install -Dm 0644 ${SPL_DIR}/${SPL_DTB_BINARY} ${D}${datadir}/${SPL_DTB_IMAGE}
We seem to be just piling more and more conditional code into these classes for different weird corner cases.
Are there some tests we should be adding to ensure people understand why this code is here and if/as/when something else changes it and regresses it?
Cheers,
Richard
Hello Richard,
Quoted 65 lines · Richard Purdie
Quoted 54 lines · Thomas Perrot
Some BSPs, especially those of meta-freescale and meta-ti allow to build U-Boot
binaries using different configuration for a given target, for example:
-UBOOT_CONFIG??= "tfa-secure-boot tfa"
-UBOOT_CONFIG??= "nand sdcard spi nor"When this is the case the public key wasn't concatenated to all U- Boot binaries
built.Signed-off-by Thomas Perrot <[email protected]>---
meta/classes/uboot-sign.bbclass | 16 +++++++++++++++-1 file changed, 15 insertions(+), 1 deletion(-)meta/classes/uboot- renamed from meta/classes/uboot-sign.bbclass +0
-0sign.bbclass
indexbae8cada0ac3..8d136e940589100644meta/classes/uboot-sign.bbclass +0
-0@@ -131,6 +131,20 @@ concat_dtb_helper() {elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then
cd ${DEPLOYDIR}
cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${B}/${CONFIG_B_PATH}/${UBOOT_BINARY} > ${UBOOT_IMAGE}
+
+ if [ -n "${UBOOT_CONFIG}" ]
+ then
+ for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do
+ j=$(expr $j + 1); + if [ $j -eq $i ] + then
+ cp ${UBOOT_IMAGE} ${B}/${CONFIG_B_PATH}/u-boot-$type.${UBOOT_SUFFIX} + fi
+ done
+ done
+ fi
else
bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available."
fimeta/classes/uboot-sign.bbclass +0
-0@@ -205,7 +219,7 @@ install_helper() {fi
}meta/classes/uboot-sign.bbclass +1
-1-# Install SPL dtb and u-boot nodtb to datadir, +# Install SPL dtb and u-boot nodtb to datadir,Quoted 4 lines
install_spl_helper() {
if [ -f "${SPL_DIR}/${SPL_DTB_BINARY}" ]; then install -Dm 0644 ${SPL_DIR}/${SPL_DTB_BINARY} ${D}${datadir}/${SPL_DTB_IMAGE}We seem to be just piling more and more conditional code into these classes for
different weird corner cases.
Quoted 5 lines
Are there some tests we should be adding to ensure people understand why this
code is here and if/as/when something else changes it and regresses it?
I should be able to add a test in "oeqa/selftest/fitimage". I will resubmit when it's done.
Best regards,
Thomas
Quoted 17 lines
Cheers,
Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#157562):
https://lists.openembedded.org/g/openembedded-core/message/157562
Mute This Topic: https://lists.openembedded.org/mt/86628322/5443093
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]
]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Thomas Perrot, Bootlin Embedded Linux and kernel engineering https://bootlin.com