[OE-core] [PATCH] kernel-uimage.bbclass: introduce UBOOT_MKIMAGE_COMMANDS

liu.ming50 at gmail.com liu.ming50 at gmail.com
Wed May 30 19:44:33 UTC 2018


From: Ming Liu <liu.ming50 at gmail.com>

It allows the end users to be able to override it to set their own
customized mkimage commands instead of a fixed uboot-mkimage command
with fixed parameters.

Also splits out normalize_entrypoint to be used by other tasks.

Signed-off-by: Ming Liu <liu.ming50 at gmail.com>
---
 meta/classes/kernel-uimage.bbclass | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/meta/classes/kernel-uimage.bbclass b/meta/classes/kernel-uimage.bbclass
index a3a3d33..4826427 100644
--- a/meta/classes/kernel-uimage.bbclass
+++ b/meta/classes/kernel-uimage.bbclass
@@ -20,16 +20,31 @@ python __anonymous () {
             bb.build.addtask('do_uboot_mkimage', 'do_install', 'do_kernel_link_images', d)
 }
 
-do_uboot_mkimage[dirs] += "${B}"
-do_uboot_mkimage() {
-	uboot_prep_kimage
+normalize_entrypoint() {
+	local entrypoint=${UBOOT_ENTRYPOINT}
+	if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
+		entrypoint=`${HOST_PREFIX}nm ${B}/vmlinux | \
+			awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
+	fi
+	echo $entrypoint
+}
 
+uboot_make_kimage() {
 	ENTRYPOINT=${UBOOT_ENTRYPOINT}
 	if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
 		ENTRYPOINT=`${HOST_PREFIX}nm ${B}/vmlinux | \
 			awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
 	fi
 
-	uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage
+	uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} \
+		-e `normalize_entrypoint` -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage
+}
+
+UBOOT_MKIMAGE_COMMANDS ?= "uboot_make_kimage"
+
+do_uboot_mkimage[dirs] += "${B}"
+do_uboot_mkimage() {
+	uboot_prep_kimage
+	${UBOOT_MKIMAGE_COMMANDS}
 	rm -f linux.bin
 }
-- 
2.7.4




More information about the Openembedded-core mailing list