All of lore.kernel.org
 help / color / mirror / Atom feed
* [warrior][PATCH] uboot-sign: add support for different u-boot configurations
@ 2019-05-06  7:45 Richard Leitner
  2019-05-07  9:14 ` Alex Kiernan
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Leitner @ 2019-05-06  7:45 UTC (permalink / raw)
  To: openembedded-core

From: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>

This is done by concatenating the DTB with the kernels public key
to all built u-boot binaries. Furthermore the installation of all
the binaries is required.

Signed-off-by: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
 meta/classes/uboot-sign.bbclass | 85 +++++++++++++++++++++------------
 1 file changed, 54 insertions(+), 31 deletions(-)

diff --git a/meta/classes/uboot-sign.bbclass b/meta/classes/uboot-sign.bbclass
index 9e3d1d6fc1..2da43655aa 100644
--- a/meta/classes/uboot-sign.bbclass
+++ b/meta/classes/uboot-sign.bbclass
@@ -45,49 +45,72 @@ UBOOT_NODTB_SYMLINK ?= "u-boot-nodtb-${MACHINE}.${UBOOT_SUFFIX}"
 # Functions in this bbclass is for u-boot only
 UBOOT_PN = "${@d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'}"
 
+concat_dtb_helper() {
+	if [ -e ${UBOOT_DTB_BINARY} ]; then
+		ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_BINARY}
+		ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_SYMLINK}
+	fi
+
+	if [ -f ${UBOOT_NODTB_BINARY} ]; then
+		install ${UBOOT_NODTB_BINARY} ${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}
+		ln -sf ${UBOOT_NODTB_IMAGE} ${UBOOT_NODTB_SYMLINK}
+		ln -sf ${UBOOT_NODTB_IMAGE} ${UBOOT_NODTB_BINARY}
+	fi
+
+	# Concatenate U-Boot w/o DTB & DTB with public key
+	# (cf. kernel-fitimage.bbclass for more details)
+	deployed_uboot_dtb_binary='${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_IMAGE}'
+	if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \
+		[ -e "$deployed_uboot_dtb_binary" ]; then
+		oe_runmake EXT_DTB=$deployed_uboot_dtb_binary
+		install ${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
+	elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then
+		cd ${DEPLOYDIR}
+		cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${UBOOT_BINARY} > ${UBOOT_IMAGE}
+	elif [ -n "${UBOOT_DTB_BINARY}" ]; then
+		bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available."
+	fi
+}
+
 concat_dtb() {
 	if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${PN}" = "${UBOOT_PN}" ]; then
 		mkdir -p ${DEPLOYDIR}
-		if [ -e ${B}/${UBOOT_DTB_BINARY} ]; then
-			ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_BINARY}
-			ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_SYMLINK}
-		fi
-
-		if [ -f ${B}/${UBOOT_NODTB_BINARY} ]; then
-            install ${B}/${UBOOT_NODTB_BINARY} ${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}
-            ln -sf ${UBOOT_NODTB_IMAGE} ${UBOOT_NODTB_SYMLINK}
-            ln -sf ${UBOOT_NODTB_IMAGE} ${UBOOT_NODTB_BINARY}
-		fi
-
-		# Concatenate U-Boot w/o DTB & DTB with public key
-		# (cf. kernel-fitimage.bbclass for more details)
-		deployed_uboot_dtb_binary='${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_IMAGE}'
-		if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \
-			[ -e "$deployed_uboot_dtb_binary" ]; then
+		if [ -n "${UBOOT_CONFIG}" ]; then
+			for config in ${UBOOT_MACHINE}; do
+				cd ${B}/${config}
+				concat_dtb_helper
+			done
+		else
 			cd ${B}
-			oe_runmake EXT_DTB=$deployed_uboot_dtb_binary
-			install ${B}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
-		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}/${UBOOT_BINARY} > ${UBOOT_IMAGE}
-		elif [ -n "${UBOOT_DTB_BINARY}" ]; then
-			bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available."
+			concat_dtb_helper
 		fi
 	fi
 }
 
 # Install UBOOT_DTB_BINARY to datadir, so that kernel can use it for
 # signing, and kernel will deploy UBOOT_DTB_BINARY after signs it.
+install_helper() {
+	if [ -f ${UBOOT_DTB_BINARY} ]; then
+		install -d ${D}${datadir}
+		# UBOOT_DTB_BINARY is a symlink to UBOOT_DTB_IMAGE, so we
+		# need both of them.
+		install ${UBOOT_DTB_BINARY} ${D}${datadir}/${UBOOT_DTB_IMAGE}
+		ln -sf ${UBOOT_DTB_IMAGE} ${D}${datadir}/${UBOOT_DTB_BINARY}
+	elif [ -n "${UBOOT_DTB_BINARY}" ]; then
+		bbwarn "${UBOOT_DTB_BINARY} not found"
+	fi
+}
+
 do_install_append() {
 	if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${PN}" = "${UBOOT_PN}" ]; then
-		if [ -f ${B}/${UBOOT_DTB_BINARY} ]; then
-			install -d ${D}${datadir}
-			# UBOOT_DTB_BINARY is a symlink to UBOOT_DTB_IMAGE, so we
-			# need both of them.
-			install ${B}/${UBOOT_DTB_BINARY} ${D}${datadir}/${UBOOT_DTB_IMAGE}
-			ln -sf ${UBOOT_DTB_IMAGE} ${D}${datadir}/${UBOOT_DTB_BINARY}
-		elif [ -n "${UBOOT_DTB_BINARY}" ]; then
-			bbwarn "${B}/${UBOOT_DTB_BINARY} not found"
+		if [ -n "${UBOOT_CONFIG}" ]; then
+			for config in ${UBOOT_MACHINE}; do
+				cd ${B}/${config}
+				install_helper
+			done
+		else
+			cd ${B}
+			install_helper
 		fi
 	fi
 }
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [warrior][PATCH] uboot-sign: add support for different u-boot configurations
  2019-05-06  7:45 [warrior][PATCH] uboot-sign: add support for different u-boot configurations Richard Leitner
@ 2019-05-07  9:14 ` Alex Kiernan
  2019-05-07  9:24   ` Richard Leitner
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Kiernan @ 2019-05-07  9:14 UTC (permalink / raw)
  To: Richard Leitner; +Cc: Patches and discussions about the oe-core layer

On Mon, May 6, 2019 at 8:53 AM Richard Leitner
<richard.leitner@skidata.com> wrote:
>
> From: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>
>
> This is done by concatenating the DTB with the kernels public key
> to all built u-boot binaries. Furthermore the installation of all
> the binaries is required.
>
> Signed-off-by: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>

If this gets applied, please can we get:

https://patchwork.openembedded.org/patch/160510/

applied on top of it?

-- 
Alex Kiernan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [warrior][PATCH] uboot-sign: add support for different u-boot configurations
  2019-05-07  9:14 ` Alex Kiernan
@ 2019-05-07  9:24   ` Richard Leitner
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Leitner @ 2019-05-07  9:24 UTC (permalink / raw)
  To: Alex Kiernan; +Cc: openembedded-core

On 07/05/2019 11:14, Alex Kiernan wrote:
> On Mon, May 6, 2019 at 8:53 AM Richard Leitner
> <richard.leitner@skidata.com> wrote:
>>
>> From: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>
>>
>> This is done by concatenating the DTB with the kernels public key
>> to all built u-boot binaries. Furthermore the installation of all
>> the binaries is required.
>>
>> Signed-off-by: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>
>> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
> 
> If this gets applied, please can we get:
> 
> https://patchwork.openembedded.org/patch/160510/
> 
> applied on top of it?
> 

ACK. Thanks for the catch, I missed there is a fix on top of this patch 
already.

regards;Richard.L


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-07  9:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-06  7:45 [warrior][PATCH] uboot-sign: add support for different u-boot configurations Richard Leitner
2019-05-07  9:14 ` Alex Kiernan
2019-05-07  9:24   ` Richard Leitner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.