Skip to contentSkip to conversation

Automate uboot entry/load addresses detection.

PATCH NAK Ihar Hrachyshka 4 participants 12 messages Jan 30, 2009 – Jul 3, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Automate uboot entry/load addresses detection.

Automated UBOOT_LOADADDRESS and UBOOT_ENTRYPOINT variables detection (no need to specify them for every machine and/or kernel now).

---
 classes/kernel.bbclass |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
classes/kernel.bbclass +4 -4
index d1f59e5..f7a7014 100644
@@ -69,10 +69,6 @@ KERNEL_LOCALVERSION ?= ""
 # kernels are generally machine specific
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-# U-Boot support
-UBOOT_ENTRYPOINT ?= "20008000"
-UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
-
 kernel_do_compile() {
 	if [ ! -z "${INITRAMFS_IMAGE}" ]; then
 		cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz" initramfs.cpio.gz
@@ -489,12 +485,16 @@ do_deploy() {
 	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_LOADADDRESS=`${OBJDUMP} -p arch/${ARCH}/boot/compressed/vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'`; \
+			UBOOT_ENTRYPOINT=`${OBJDUMP} -f arch/${ARCH}/boot/compressed/vmlinux | sed -n 's/.*start address \([^ ]*\).*/\1/p'`; \
 			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_LOADADDRESS=`${OBJDUMP} -p vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'`; \
+			UBOOT_ENTRYPOINT=`${OBJDUMP} -f vmlinux | sed -n 's/.*start address \([^ ]*\).*/\1/p'`; \
 			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
Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 4 lines · Ihar Hrachyshka

Automated UBOOT_LOADADDRESS and UBOOT_ENTRYPOINT variables detection (no need to specify them for every machine and/or kernel now).

Looks like a nice patch! I think this should probably go it.

Graeme

#2 lore raw
In reply to Ihar Hrachyshka

Any chances for inclusion?

Quoted 45 lines · Ihar Hrachyshka

Automated UBOOT_LOADADDRESS and UBOOT_ENTRYPOINT variables detection (no need to specify them for every machine and/or kernel now).

---
 classes/kernel.bbclass |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
classes/kernel.bbclass +4 -5
index d1f59e5..f7a7014 100644
@@ -69,10 +69,6 @@ KERNEL_LOCALVERSION ?= ""
 # kernels are generally machine specific
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-# U-Boot support
-UBOOT_ENTRYPOINT ?= "20008000"
-UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
-
 kernel_do_compile() {
       if [ ! -z "${INITRAMFS_IMAGE}" ]; then
               cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz" initramfs.cpio.gz
@@ -489,12 +485,16 @@ do_deploy() {
       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_LOADADDRESS=`${OBJDUMP} -p arch/${ARCH}/boot/compressed/vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'`; \
+                       UBOOT_ENTRYPOINT=`${OBJDUMP} -f arch/${ARCH}/boot/compressed/vmlinux | sed -n 's/.*start address \([^ ]*\).*/\1/p'`; \
                       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_LOADADDRESS=`${OBJDUMP} -p vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'`; \
+                       UBOOT_ENTRYPOINT=`${OBJDUMP} -f vmlinux | sed -n 's/.*start address \([^ ]*\).*/\1/p'`; \
                       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
--

1.5.6.3

#3 lore raw
Quoted 1 line · Ihar Hrachyshka

Any chances for inclusion?

It looks pretty good to me, but I'd like to hear from people that tested it :)

regards,

Koen

Quoted 47 lines
Quoted 45 lines · Ihar Hrachyshka

Automated UBOOT_LOADADDRESS and UBOOT_ENTRYPOINT variables detection (no need to specify them for every machine and/or kernel now).

---
  classes/kernel.bbclass |    8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)
classes/kernel.bbclass +4 -5
index d1f59e5..f7a7014 100644
@@ -69,10 +69,6 @@ KERNEL_LOCALVERSION ?= ""
  # kernels are generally machine specific
  PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-# U-Boot support
-UBOOT_ENTRYPOINT ?= "20008000"
-UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
-
  kernel_do_compile() {
        if [ ! -z "${INITRAMFS_IMAGE}" ]; then
                cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz" initramfs.cpio.gz
@@ -489,12 +485,16 @@ do_deploy() {
        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_LOADADDRESS=`${OBJDUMP} -p arch/${ARCH}/boot/compressed/vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'`; \
+                       UBOOT_ENTRYPOINT=`${OBJDUMP} -f arch/${ARCH}/boot/compressed/vmlinux | sed -n 's/.*start address \([^ ]*\).*/\1/p'`; \
                        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_LOADADDRESS=`${OBJDUMP} -p vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'`; \
+                       UBOOT_ENTRYPOINT=`${OBJDUMP} -f vmlinux | sed -n 's/.*start address \([^ ]*\).*/\1/p'`; \
                        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
--

1.5.6.3

#4 lore raw

Bumping the thread after a month of no activity...

Quoted 84 lines · Koen Kooi
Quoted 2 lines · Ihar Hrachyshka

Any chances for inclusion?

It looks pretty good to me, but I'd like to hear from people that tested it :)

regards,

Koen

Quoted 56 lines
Quoted 54 lines · Ihar Hrachyshka

Automated UBOOT_LOADADDRESS and UBOOT_ENTRYPOINT variables detection (no need to specify them for every machine and/or kernel now).

---
 classes/kernel.bbclass |    8 ++++----

 1 files changed, 4 insertions(+), 4 deletions(-)
classes/kernel.bbclass +0 -0
index d1f59e5..f7a7014 100644
@@ -69,10 +69,6 @@ KERNEL_LOCALVERSION ?= ""
  # kernels are generally machine specific

 PACKAGE_ARCH = "${MACHINE_ARCH}"

classes/kernel.bbclass +0 -4
-# U-Boot support
-UBOOT_ENTRYPOINT ?= "20008000"
-UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
-

 kernel_do_compile() {
       if [ ! -z "${INITRAMFS_IMAGE}" ]; then
               cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz" initramfs.cpio.gz

classes/kernel.bbclass +0 -0
@@ -489,12 +485,16 @@ do_deploy() {

       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_LOADADDRESS=${OBJDUMP} -p arch/${ARCH}/boot/compressed/vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'; \
+                       UBOOT_ENTRYPOINT=${OBJDUMP} -f arch/${ARCH}/boot/compressed/vmlinux | sed -n 's/.*start address \([^ ]*\).*/\1/p'; \
                       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_LOADADDRESS=${OBJDUMP} -p vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'; \
+                       UBOOT_ENTRYPOINT=${OBJDUMP} -f vmlinux | sed -n 's/.*start address \([^ ]*\).*/\1/p'; \
                       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

Quoted 8 lines
Quoted 8 lines

${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin
                       rm -f linux.bin.gz
               fi
--
1.5.6.3

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#5 lore raw

Hi, I've tested the patch and it seems to work.
Thanks

Andrea

#6 lore raw

PATCH 1/1 kernel.bbclass: Automate uboot entry/load addresses detection.

---
 classes/kernel.bbclass |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
classes/kernel.bbclass +4 -4
index 17e8941..85a2e07 100644
@@ -69,10 +69,6 @@ KERNEL_LOCALVERSION ?= ""
 # kernels are generally machine specific
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-# U-Boot support
-UBOOT_ENTRYPOINT ?= "20008000"
-UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
-
 kernel_do_compile() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 	oe_runmake include/linux/version.h CC="${KERNEL_CC}" LD="${KERNEL_LD}"
@@ -491,12 +487,16 @@ do_deploy() {
 	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_LOADADDRESS=`${OBJDUMP} -p arch/${ARCH}/boot/compressed/vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'`; \
+			 UBOOT_ENTRYPOINT=`${OBJDUMP} -f arch/${ARCH}/boot/compressed/vmlinux | sed -n 's/.*start address \([^ ]*\).*/\1/p'`; \
 			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_LOADADDRESS=`${OBJDUMP} -p vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'`; \
+			 UBOOT_ENTRYPOINT=`${OBJDUMP} -f vmlinux | sed -n 's/.*start address \([^ ]*\).*/\1/p'`; \
 			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
Signature · 1 line
1.6.0.6
#8 lore raw

ehm...the Author part doesn't appear..sorry.
For the rest, I replied to my own message (and here you see it correctly threaded:
http://lists.linuxtogo.org/pipermail/openembedded-devel/2009-March/thread.html).

There is a problem anyway...it works if you pre-define the two vars...otherwise these are not expanded.

uboot-mkimage -A arm -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e ${UBOOT_ENTRYPOINT} -n "Angstrom/2.6.26/c7x0" -d linux.bin /oe/build/tmp/angstrom /deploy/glibc/images/c7x0/uImage-2.6.26-r9-c7x0.bin

I need to check more thoroughly.

NACK

Sorry for the noise

Andrea

Acked-by
#9 lore raw

uboot-mkimage -A arm -O linux -T kernel -C none -a 0x800
08000 -e 0x80008000 -n "Angstrom/2.6.26/c7x0" -d linux.bin /oe/build/tmp/angstro m/deploy/glibc/images/c7x0/uImage-2.6.26-r9-c7x0.bin

Ok, it just works after some cleanings...silly me... I'm not a core-dev but I tested it and you get my ack.

Regards
Andrea

#10 lore raw

Any chance for patch inclusion?

Quoted 17 lines · Andrea Adami

uboot-mkimage -A arm -O linux -T kernel -C none -a 0x800
08000 -e 0x80008000 -n "Angstrom/2.6.26/c7x0" -d linux.bin /oe/build/tmp/angstro m/deploy/glibc/images/c7x0/uImage-2.6.26-r9-c7x0.bin

Ok, it just works after some cleanings...silly me... I'm not a core-dev but I tested it and you get my ack.

Regards
Andrea

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#11 lore raw

Ihar,

the patch sounds very interesting but I had issues with the version you posted...

1) You need to ECHO out the two vars, then it 'works' -UBOOT_LOADADDRESS=`${OBJDUMP} -p ...
+echo UBOOT_LOADADDRESS=`${OBJDUMP} -p ...

2) the values don't correspond to the mkimage parameters...(tested for Zaurus+u-boot)

So, for the moment, NACK, my ack was premature
Still, I appreciate very much your efforts, unfortunately I have not yet full knowledge about that matter.
Hopefully some kernel hacker will jump in...

Regards

Andrea