Skip to contentSkip to conversation

Revert "uboot-sign: fix U-Boot binary with public key"

PATCH In review Ryan Eatmon 2 participants 4 messages Dec 6, 2024 – Dec 16, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "uboot-sign: fix U-Boot binary with public key"

This reverts commit 0d14e99aa18ee38293df63d585fafc270a4538be.

The patch removed logic required for correct handling of UBOOT_SUFFIX=img or UBOOT_SUFFIX=rom. We need to find a better way to handle the fix for [YOCTO #15649].

---
 meta/classes-recipe/uboot-sign.bbclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/classes-recipe/uboot-sign.bbclass +7 -1
index 7ee73b872a..a17be745ce 100644
@@ -122,7 +122,13 @@ concat_dtb() {
 	# If we're not using a signed u-boot fit, concatenate SPL w/o DTB & U-Boot DTB
 	# with public key (otherwise U-Boot will be packaged by uboot_fitimage_assemble)
 	if [ "${SPL_SIGN_ENABLE}" != "1" ] ; then
-		if [ -e "${UBOOT_NODTB_BINARY}" -a -e "${UBOOT_DTB_BINARY}" ]; then
+		if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \
+			[ -e "${UBOOT_DTB_BINARY}" ]; then
+			oe_runmake EXT_DTB="${UBOOT_DTB_SIGNED}" ${UBOOT_MAKE_TARGET}
+			if [ -n "${binary}" ]; then
+				cp ${binary} ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
+			fi
+		elif [ -e "${UBOOT_NODTB_BINARY}" -a -e "${UBOOT_DTB_BINARY}" ]; then
 			if [ -n "${binary}" ]; then
 				cat ${UBOOT_NODTB_BINARY} ${UBOOT_DTB_SIGNED} | tee ${binary} > \
 					${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
Signature · 1 line
2.17.1
#1 lore raw
Quoted 27 lines · Ryan Eatmon via lists.openembedded.org

This reverts commit 0d14e99aa18ee38293df63d585fafc270a4538be.

The patch removed logic required for correct handling of UBOOT_SUFFIX=img or UBOOT_SUFFIX=rom.  We need to find a better way to handle the fix for [YOCTO #15649].

---
 meta/classes-recipe/uboot-sign.bbclass | 8 +++++++-

 1 file changed, 7 insertions(+), 1 deletion(-)
meta/classes-recipe/uboot-sign.bbclass +0 -0
index 7ee73b872a..a17be745ce 100644
@@ -122,7 +122,13 @@ concat_dtb() {
  	# If we're not using a signed u-boot fit, concatenate SPL w/o DTB & U-Boot DTB
  	# with public key (otherwise U-Boot will be packaged by uboot_fitimage_assemble)

  if [ "${SPL_SIGN_ENABLE}" != "1" ] ; then

meta/classes-recipe/uboot-sign.bbclass +7 -1
-		if [ -e "${UBOOT_NODTB_BINARY}" -a -e "${UBOOT_DTB_BINARY}" ]; then
+		if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \
+			[ -e "${UBOOT_DTB_BINARY}" ]; then
+			oe_runmake EXT_DTB="${UBOOT_DTB_SIGNED}" ${UBOOT_MAKE_TARGET}
+			if [ -n "${binary}" ]; then
+				cp ${binary} ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
+			fi
+		elif [ -e "${UBOOT_NODTB_BINARY}" -a -e "${UBOOT_DTB_BINARY}" ]; then
Quoted 4 lines

  if [ -n "${binary}" ]; then
  cat ${UBOOT_NODTB_BINARY} ${UBOOT_DTB_SIGNED} | tee ${binary} > \
  ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}

I'm in two minds about whether to take this or not. The code is clearly needed for some platforms however the selftests don't cover it and I doubt it is documented either :/

If I take this, can we add in some better testing please?

Cheers,

Richard

#2 lore raw
Quoted 37 lines · Richard Purdie
Quoted 21 lines · Ryan Eatmon via lists.openembedded.org

This reverts commit 0d14e99aa18ee38293df63d585fafc270a4538be.

The patch removed logic required for correct handling of UBOOT_SUFFIX=img or UBOOT_SUFFIX=rom.  We need to find a better way to handle the fix for [YOCTO #15649].

---
  meta/classes-recipe/uboot-sign.bbclass | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
meta/classes-recipe/uboot-sign.bbclass +0 -1
index 7ee73b872a..a17be745ce 100644
@@ -122,7 +122,13 @@ concat_dtb() {
  	# If we're not using a signed u-boot fit, concatenate SPL w/o DTB & U-Boot DTB
  	# with public key (otherwise U-Boot will be packaged by uboot_fitimage_assemble)
  	if [ "${SPL_SIGN_ENABLE}" != "1" ] ; then
-		if [ -e "${UBOOT_NODTB_BINARY}" -a -e "${UBOOT_DTB_BINARY}" ]; then

meta/classes-recipe/uboot-sign.bbclass concat_dtb() { · line 134

Quoted 10 lines
meta/classes-recipe/uboot-sign.bbclass +7 -0
+		if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \
+			[ -e "${UBOOT_DTB_BINARY}" ]; then
+			oe_runmake EXT_DTB="${UBOOT_DTB_SIGNED}" ${UBOOT_MAKE_TARGET}
+			if [ -n "${binary}" ]; then
+				cp ${binary} ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
+			fi
+		elif [ -e "${UBOOT_NODTB_BINARY}" -a -e "${UBOOT_DTB_BINARY}" ]; then
  			if [ -n "${binary}" ]; then
  				cat ${UBOOT_NODTB_BINARY} ${UBOOT_DTB_SIGNED} | tee ${binary} > \
  					${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}

I'm in two minds about whether to take this or not. The code is clearly needed for some platforms however the selftests don't cover it and I doubt it is documented either :/

Quoted 1 line

If I take this, can we add in some better testing please?

The initial commit that starts the img ball rolling came from 2016:

https://git.openembedded.org/openembedded-core/commit/meta/classes/uboot-sign.bbclass?id=4afee787e455ce1d4c002cd5c003182f1fc50028

The logic has morphed over time, but there is where it started. So it's been in there for a number of years.

I'm willing to take a stab at the selftest. Is there any documentation to help with that broadly means/entails? I'll also talk to Denys in our call tomorrow if he knows and can point me in a good direction for this.

Quoted 4 lines

Cheers,

Richard

Signature · 3 lines
Ryan Eatmon                [email protected]
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS
#3 lore raw
Quoted 44 lines · Ryan Eatmon
Quoted 37 lines · Richard Purdie
Quoted 27 lines · Ryan Eatmon via lists.openembedded.org

This reverts commit 0d14e99aa18ee38293df63d585fafc270a4538be.

The patch removed logic required for correct handling of UBOOT_SUFFIX=img or UBOOT_SUFFIX=rom.  We need to find a better way to handle the fix for [YOCTO #15649].

---
  meta/classes-recipe/uboot-sign.bbclass | 8 +++++++-

  1 file changed, 7 insertions(+), 1 deletion(-)
meta/classes-recipe/uboot-sign.bbclass +0 -0
index 7ee73b872a..a17be745ce 100644
@@ -122,7 +122,13 @@ concat_dtb() {
   	# If we're not using a signed u-boot fit, concatenate SPL w/o DTB & U-Boot DTB
   	# with public key (otherwise U-Boot will be packaged by uboot_fitimage_assemble)

   if [ "${SPL_SIGN_ENABLE}" != "1" ] ; then

meta/classes-recipe/uboot-sign.bbclass +7 -1
-		if [ -e "${UBOOT_NODTB_BINARY}" -a -e "${UBOOT_DTB_BINARY}" ]; then
+		if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \
+			[ -e "${UBOOT_DTB_BINARY}" ]; then
+			oe_runmake EXT_DTB="${UBOOT_DTB_SIGNED}" ${UBOOT_MAKE_TARGET}
+			if [ -n "${binary}" ]; then
+				cp ${binary} ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
+			fi
+		elif [ -e "${UBOOT_NODTB_BINARY}" -a -e "${UBOOT_DTB_BINARY}" ]; then
Quoted 4 lines

   if [ -n "${binary}" ]; then
   cat ${UBOOT_NODTB_BINARY} ${UBOOT_DTB_SIGNED} | tee ${binary} > \
   ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}

I'm in two minds about whether to take this or not. The code is clearly needed for some platforms however the selftests don't cover it and I doubt it is documented either :/

Quoted 1 line

If I take this, can we add in some better testing please?

The initial commit that starts the img ball rolling came from 2016:

Quoted 8 lines

https://git.openembedded.org/openembedded-core/commit/meta/classes/uboot-sign.bbclass?id=4afee787e455ce1d4c002cd5c003182f1fc50028

The logic has morphed over time, but there is where it started.  So it's been in there for a number of years.

I'm willing to take a stab at the selftest.  Is there any documentation to help with that broadly means/entails?  I'll also talk to Denys in our call tomorrow if he knows and can point me in a good direction for this.

You can run a subset of selftest with "oe-selftest -r uboot" wich would run the test cases in meta/lib/oeqa/selftest/cases/uboot.py. You can narrow it to a specific class of tests within that file or a specific test too, e.g.: "oe-selftest -r uboot.UBootTest.test_boot_uboot".

The aim is to have test cases for key workflows we need to ensure work.

There is some information in the manual:
https://docs.yoctoproject.org/test-manual/index.html
but it probably doesn't go into the level of detail you're looking for about writing individual tests. That is something we've wanted to aim to add but we're probably not there yet.

Cheers,

Richard