Skip to contentSkip to conversation

kernel-uimage.bbclass: introduce UBOOT_MKIMAGE_COMMANDS

PATCH New [email protected] 1 participant 1 message May 30, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-uimage.bbclass: introduce UBOOT_MKIMAGE_COMMANDS

From: Ming Liu <[email protected]>

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.

---
 meta/classes/kernel-uimage.bbclass | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
meta/classes/kernel-uimage.bbclass +19 -4
index a3a3d33..4826427 100644
@@ -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
 }
Signature · 1 line
2.7.4