[oe] [PATCH] remove duplicated code from linux.inc

Graham Gower graham.gower at gmail.com
Fri Jul 31 02:24:19 UTC 2009


Graeme Gregory wrote:
> Why dont you prepend it to the current uImage creation code running only 
> conditionally on UBOOT_ENTRYSYMBOL being set? As its in the same bit of 
> shell code your resetting of UBOOT_ENTRYPOINT will take precedence! Also 
> means other machines can use it.

Once I realised that ${FOO} is replaced before the shell function is run,
while $FOO is not, things made a lot more sense.

Allow a dynamic entry point via UBOOT_ENTRYSYMBOL and remove redundant
uboot-mkimage code in kernel.bbclass.

-Graham

diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass
index ef16669..94c73a5 100644
--- a/classes/kernel.bbclass
+++ b/classes/kernel.bbclass
@@ -497,21 +497,6 @@ do_deploy() {
 	tar -cvzf ${DEPLOY_DIR_IMAGE}/modules-${PV}-${PR}-${MACHINE}.tgz -C ${D} lib
 	fi
 
-	if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then 
-		if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
-			${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
-			uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin
-			rm -f linux.bin
-		else
-			${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
-			rm -f linux.bin.gz
-			gzip -9 linux.bin
-			uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin
-			rm -f linux.bin.gz
-		fi
-		package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin
-	fi
-
 	cd ${DEPLOY_DIR_IMAGE}
 	rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin
 	ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin
diff --git a/recipes/linux/linux.inc b/recipes/linux/linux.inc
index 96feba6..02243ca 100644
--- a/recipes/linux/linux.inc
+++ b/recipes/linux/linux.inc
@@ -159,16 +159,21 @@ do_configure_append() {
 }
 
 do_compile_append() {
+    ENTRYPOINT=${UBOOT_ENTRYPOINT}
+    if test -n "${UBOOT_ENTRYSYMBOL}"; then
+        ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
+               awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
+    fi
     if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then 
         if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
             ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
-            uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
+            uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
             rm -f linux.bin
         else
             ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
             rm -f linux.bin.gz
             gzip -9 linux.bin
-            uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
+            uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
             rm -f linux.bin.gz
         fi
     fi




More information about the Openembedded-devel mailing list