Skip to contentSkip to conversation

remove duplicated code from linux.inc

PATCH NAK Graham Gower 6 participants 22 messages Jul 29, 2009 – Aug 3, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove duplicated code from linux.inc

Hello,

The contents of the do_compile_append() function below can also be found in kernel.bbclass: do_deploy().

I've removed it from linux.inc because I want to dynamically set UBOOT_ENTRYPOINT in my linux-blah.bb based upon the resultant kernel binary and this makes it easier.

-Graham

recipes/linux/linux.inc +0 -0
index 96feba6..3dbb1ec 100644
@@ -158,22 +158,6 @@ do_configure_append() {

fi
}

-do_compile_append() {
- 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
-            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
-            rm -f linux.bin.gz

- fi
- fi
-}
-

do_devicetree_image() {
    if test -n "${KERNEL_DEVICETREE}" ; then
        dtc -I dts -O dtb ${KERNEL_DEVICETREE_FLAGS} -o devicetree ${KERNEL_DEVICETREE}
#1 lore raw

NAK, this breaks the resulting kernel-image ipk

Quoted 42 lines · Graham Gower

The contents of the do_compile_append() function below can also be found in kernel.bbclass: do_deploy().

I've removed it from linux.inc because I want to dynamically set UBOOT_ENTRYPOINT in my linux-blah.bb based upon the resultant kernel binary and this makes it easier.

(quoted diff) +0 -1
-Graham
recipes/linux/linux.inc +0 -0
index 96feba6..3dbb1ec 100644
@@ -158,22 +158,6 @@ do_configure_append() {

fi
}

-do_compile_append() {
- 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
- 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
- rm -f linux.bin.gz
- fi
- fi

recipes/linux/linux.inc +0 -2
-}
-

do_devicetree_image() {
if test -n "${KERNEL_DEVICETREE}" ; then
dtc -I dts -O dtb ${KERNEL_DEVICETREE_FLAGS} -o devicetree ${KERNEL_DEVICETREE}

#2 lore raw

Dnia środa, 29 lipca 2009 o 09:34:05 Koen Kooi napisał(a):

Quoted 1 line

NAK, this breaks the resulting kernel-image ipk

So we have to check why this code has to be duplicated.

Regards,

Signature · 3 lines
JID:      [email protected]
Website:  http://marcin.juszkiewicz.com.pl/
LinkedIn: http://www.linkedin.com/in/marcinjuszkiewicz
#3 lore raw
In reply to Koen Kooi
Quoted 2 lines · Koen Kooi

NAK, this breaks the resulting kernel-image ipk

Double NAK, read the git log, I put this there to specifically make stuff work, I thought I had removed it from kernel.bbclass but I obviously forgot to push that patch. Doing it in do_deploy is just totally wrong.

Graeme

Quoted 51 lines · Graham Gower
Quoted 39 lines

The contents of the do_compile_append() function below can also be found in kernel.bbclass: do_deploy().

I've removed it from linux.inc because I want to dynamically set UBOOT_ENTRYPOINT in my linux-blah.bb based upon the resultant kernel binary and this makes it easier.

(quoted diff) +0 -1
-Graham
recipes/linux/linux.inc +0 -0
index 96feba6..3dbb1ec 100644
@@ -158,22 +158,6 @@ do_configure_append() {

fi
}

-do_compile_append() {
- 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
- 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
- rm -f linux.bin.gz
- fi
- fi

recipes/linux/linux.inc +0 -2
-}
-
Quoted 4 lines

do_devicetree_image() {
if test -n "${KERNEL_DEVICETREE}" ; then
dtc -I dts -O dtb ${KERNEL_DEVICETREE_FLAGS} -o devicetree ${KERNEL_DEVICETREE}

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

#4 lore raw

Dnia środa, 29 lipca 2009 o 10:38:12 Graeme Gregory napisał(a):

Quoted 7 lines
Quoted 1 line · Koen Kooi

NAK, this breaks the resulting kernel-image ipk

Double NAK, read the git log, I put this there to specifically make stuff work, I thought I had removed it from kernel.bbclass but I obviously forgot to push that patch. Doing it in do_deploy is just totally wrong.

So maybe remove it from kernel.bbclass/do_deploy and move linux.inc/do_compile_append to kernel.bbclass?

We need to clean linux.inc by moving stuff from it to kernel.bbclass.

Regards,

Signature · 3 lines
JID:      [email protected]
Website:  http://marcin.juszkiewicz.com.pl/
LinkedIn: http://www.linkedin.com/in/marcinjuszkiewicz
#5 lore raw

2009/7/29 Marcin Juszkiewicz <[email protected]>:

Quoted 9 lines

Dnia środa, 29 lipca 2009 o 10:38:12 Graeme Gregory napisał(a):

Quoted 7 lines
Quoted 1 line · Koen Kooi

NAK, this breaks the resulting kernel-image ipk

Double NAK, read the git log, I put this there to specifically make stuff work, I thought I had removed it from kernel.bbclass but I obviously forgot to push that patch. Doing it in do_deploy is just totally wrong.

Quoted 5 lines

So maybe remove it from kernel.bbclass/do_deploy and move linux.inc/do_compile_append to kernel.bbclass?

We need to clean linux.inc by moving stuff from it to kernel.bbclass.

Ok, my patch is bogus. It doesn't even let me do what I wanted. *smacks self for not testing first*

The real issue is that my kernel entry point is not fixed. The entry point can be found by searching for the 'kernel_entry' symbol in the vmlinux. And unfortunately, I can't search for this at an appropriate time to be able to set UBOOT_ENTRYPOINT.

What I would need is something like the following, post do_compile.

UBOOT_ENTRYPOINT=`${NM} ${S}/vmlinux | \
		awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'

Where UBOOT_ENTRYSYMBOL="kernel_entry" could be set from the ${MACHINE}.conf.

Presumably no one else's machine with a variable entry point is using u-boot.... The uImage makefile target in my kernel tree generates a uImage anyway. Perhaps this step could simply be skipped if the ${S}/arch/${ARCH}/uImage file already exists?

-Graham

#6 lore raw

On Thu, Jul 30, 2009 at 02:41:30PM +0930, Graham Gower wrote:
[snip]

Quoted 11 lines

The real issue is that my kernel entry point is not fixed. The entry point can be found by searching for the 'kernel_entry' symbol in the vmlinux. And unfortunately, I can't search for this at an appropriate time to be able to set UBOOT_ENTRYPOINT.

What I would need is something like the following, post do_compile.

UBOOT_ENTRYPOINT=`${NM} ${S}/vmlinux | \
		awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'

Where UBOOT_ENTRYSYMBOL="kernel_entry" could be set from the ${MACHINE}.conf.

That should work.

Signature · 1 line
Tom Rini
#7 lore raw

2009/7/30 Tom Rini <[email protected]>:

Quoted 1 line

That should work.

Could you show me how?
I have tried, but the ${UBOOT_ENTRYPOINT} used by either linux.inc or kernel.bbclass is parsed and put into the run.do_foo file before the symbol searching occurs.

#8 lore raw
Quoted 11 lines · Graham Gower

2009/7/30 Tom Rini <[email protected]>:

Quoted 2 lines

That should work.

Could you show me how?
I have tried, but the ${UBOOT_ENTRYPOINT} used by either linux.inc or kernel.bbclass is parsed and put into the run.do_foo file before the symbol searching occurs.

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.

Graeme

#9 lore raw
Quoted 1 line · Graeme Gregory

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

classes/kernel.bbclass +0 -0
index ef16669..94c73a5 100644
@@ -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
recipes/linux/linux.inc +0 -0
index 96feba6..02243ca 100644
@@ -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

#10 lore raw
Quoted 9 lines · Graham Gower
Quoted 1 line · Graeme Gregory

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.

Looks good to me, do you fancy moving that do_compile_append into kernel.bbclass? You can then have the added kudos of fixing OE core files :-)

Graeme

#11 lore raw
Quoted 1 line · Graeme Gregory

Looks good to me, do you fancy moving that do_compile_append into kernel.bbclass? You can then have the added kudos of fixing OE core files :-)

Kudos sound tasty.

-Graham

classes/kernel.bbclass +0 -0
index ef16669..b498760 100644
@@ -485,6 +485,29 @@ do_sizecheck() {
 

addtask sizecheck before do_install after do_compile

+do_uboot_mkimage() {
+ if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then + ENTRYPOINT=${UBOOT_ENTRYPOINT}
+ if test -n "${UBOOT_ENTRYSYMBOL}"; then
+ ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
+ awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
+ fi
+ 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 $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 $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
+            rm -f linux.bin.gz

+ fi
+ fi
+}
+
+addtask uboot_mkimage before do_install after do_compile
+
KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}" KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"

@@ -497,21 +520,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
recipes/linux/linux.inc +0 -0
index 96feba6..3dbb1ec 100644
@@ -158,22 +158,6 @@ do_configure_append() {

fi
}

-do_compile_append() {
- 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
-            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
-            rm -f linux.bin.gz

- fi
- fi
-}
-

do_devicetree_image() {
    if test -n "${KERNEL_DEVICETREE}" ; then
        dtc -I dts -O dtb ${KERNEL_DEVICETREE_FLAGS} -o devicetree ${KERNEL_DEVICETREE}
#12 lore raw
Quoted 5 lines · Graham Gower
Quoted 1 line · Graeme Gregory

Looks good to me, do you fancy moving that do_compile_append into kernel.bbclass? You can then have the added kudos of fixing OE core files :-)

Kudos sound tasty.

Works in my testing thanks for your work.

#14 lore raw
In reply to Graham Gower
Quoted 5 lines · Graham Gower
Quoted 1 line · Graeme Gregory

Looks good to me, do you fancy moving that do_compile_append into kernel.bbclass? You can then have the added kudos of fixing OE core files :-)

Kudos sound tasty.

Thanks for your hard work, have now applied to OE.

Graeme

#15 lore raw

And for those playing at home, the value to assign to UBOOT_ENTRYSYM for a given arch can be found by grepping linux/arch/${ARCH}/kernel/vmlinux.lds.S for 'ENTRY'.

-Graham

#16 lore raw

Dnia piątek, 31 lipca 2009 o 14:35:19 Graham Gower napisał(a):

Quoted 3 lines

And for those playing at home, the value to assign to UBOOT_ENTRYSYM for a given arch can be found by grepping linux/arch/${ARCH}/kernel/vmlinux.lds.S for 'ENTRY'.

So according to your post for ARM it will be 'stext':

15:10 hrw@home:linux-2.6.30$ grep ^ENTRY arch/arm/kernel/vmlinux.lds.S ENTRY(stext)

For AT91SAM9263-EK we get:

15:10 hrw@home:linux-2.6.30$ arm-angstrom-linux-gnueabi-nm vmlinux|grep stext
c0008000 T _stext
c0008000 T stext

But when I boot this device I have:

## Booting kernel from Legacy Image at 22200000 ...

   Image Name:   Angstrom/2.6.30/at91sam9263ek                                                                                                             
   Image Type:   ARM Linux Kernel Image (uncompressed)                                                                                                     
   Data Size:    2074384 Bytes =  2 MB                                                                                                                     

Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
Loading Kernel Image ... OK

So entry point is different.

For NHK15 which runs kernel 2.6.20 I got "stext" same as Entry point used by U-Boot:

15:12 hrw@home:linux-2.6.20$ arm-angstrom-linux-gnueabi-nm vmlinux|grep stext
c0008000 T _stext
c02bcba0 t snstext
c0008000 T stext

## Booting image at 00100000 ...

   Image Name:   Linux-2.6.20   
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1714260 Bytes =  1.6 MB              

Load Address: 00008000
Entry Point: 00008000
OK

For BUG which runs 2.6.27.2 I got:

15:16 hrw@home:bug-linux-2.6.27.2$ arm-angstrom-linux-gnueabi-nm vmlinux|grep stext
c0008000 T _stext
c0008000 T stext

When U-Boot says:

## Booting kernel from Legacy Image at 80800000 ...

   Image Name:   Linux-2.6.27.2
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1722736 Bytes =  1.6 MB

Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK

I also have avr32 NGW100 but lack kernel tree for it to check values. Can test will those devices boot with entry point set to 0x00080000 address.

Regards,

Signature · 3 lines
JID:      [email protected]
Website:  http://marcin.juszkiewicz.com.pl/
LinkedIn: http://www.linkedin.com/in/marcinjuszkiewicz
#17 lore raw

2009/7/31 Marcin Juszkiewicz <[email protected]>:

Quoted 2 lines

Dnia piątek, 31 lipca 2009 o 14:35:19 Graham Gower napisał(a):

Quoted 1 line

And for those playing at home, the value to assign to UBOOT_ENTRYSYM

Of course, that should have read UBOOT_ENTRYSYMBOL.

Quoted 26 lines
Quoted 2 lines

for a given arch can be found by grepping linux/arch/${ARCH}/kernel/vmlinux.lds.S for 'ENTRY'.

So according to your post for ARM it will be 'stext':

15:10 hrw@home:linux-2.6.30$ grep ^ENTRY arch/arm/kernel/vmlinux.lds.S ENTRY(stext)

For AT91SAM9263-EK we get:

15:10 hrw@home:linux-2.6.30$ arm-angstrom-linux-gnueabi-nm vmlinux|grep stext
c0008000 T _stext
c0008000 T stext

But when I boot this device I have:

## Booting kernel from Legacy Image at 22200000 ... Image Name:   Angstrom/2.6.30/at91sam9263ek Image Type:   ARM Linux Kernel Image (uncompressed) Data Size:    2074384 Bytes =  2 MB
  Load Address: 20008000
  Entry Point:  20008000
  Verifying Checksum ... OK
  Loading Kernel Image ... OK

Quoted 1 line

So entry point is different.

Yes, the linux kernel links to a virtual address. If u-boot leaves the MMU disabled on your platform then you will need to use a physical address. I haven't checked u-boot to see if this is common or not.

Does the resulting uImage with entry point c0008000 boot for you?

-Graham

#18 lore raw

Dnia sobota, 1 sierpnia 2009 o 11:45:12 Graham Gower napisał(a):

Quoted 20 lines

2009/7/31 Marcin Juszkiewicz <[email protected]>:

Quoted 18 lines

For AT91SAM9263-EK we get:

15:10 hrw@home:linux-2.6.30$ arm-angstrom-linux-gnueabi-nm vmlinux|grep stext
c0008000 T _stext
c0008000 T stext

But when I boot this device I have:

## Booting kernel from Legacy Image at 22200000 ...

  Image Name:   Angstrom/2.6.30/at91sam9263ek
  Image Type:   ARM Linux Kernel Image (uncompressed)
  Data Size:    2074384 Bytes =  2 MB

Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
Loading Kernel Image ... OK

Quoted 8 lines
Quoted 1 line

So entry point is different.

Yes, the linux kernel links to a virtual address. If u-boot leaves the MMU disabled on your platform then you will need to use a physical address. I haven't checked u-boot to see if this is common or not.

Does the resulting uImage with entry point c0008000 boot for you?

## Booting kernel from Legacy Image at 22200000 ...

   Image Name:   Angstrom/2.6.30/at91sam9263ek
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2074380 Bytes =  2 MB

Load Address: 20008000
Entry Point: c0008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...

And HANG...

Then I changed kernel.bbclass so LoadAddress == EntryPoint and that hangs at loading kernel (which was expected). So it looks like that patch is not so safe to use...

Regards,

Signature · 3 lines
JID:      [email protected]
Website:  http://marcin.juszkiewicz.com.pl/
LinkedIn: http://www.linkedin.com/in/marcinjuszkiewicz
#19 lore raw
In reply to Graeme Gregory
Quoted 9 lines · Graeme Gregory
Quoted 7 lines · Graham Gower
Quoted 3 lines · Graeme Gregory

Looks good to me, do you fancy moving that do_compile_append into kernel.bbclass? You can then have the added kudos of fixing OE core files :-)

Kudos sound tasty.

Thanks for your hard work, have now applied to OE.

"Oh nooooes! My build fails!" -> bitbake -c clean virtual/kernel

regards,

Koen

#20 lore raw
In reply to Graeme Gregory
Quoted 3 lines
Quoted 1 line

Graeme Gregory wrote:

Looks good to me, do you fancy moving that do_compile_append into kernel.bbclass? You can then have the added kudos of fixing OE core files

Graeme, do you remember "[oe] [PATCH] Automate uboot entry/load addresses detection" [*] from Ihar (booxter) ? Perhaps Graham could try it.

I tested it but had strange results...

Regards

Andrea

[*] http://thread.gmane.org/gmane.comp.handhelds.openembedded/20843/focus=25154

#21 lore raw

2009/7/31 Andrea Adami <[email protected]>:

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Graeme Gregory wrote:

Looks good to me, do you fancy moving that do_compile_append into kernel.bbclass? You can then have the added kudos of fixing OE core files

Graeme, do you remember "[oe] [PATCH] Automate uboot entry/load addresses detection" [*] from Ihar (booxter) ? Perhaps Graham could try it.

Quoted 8 lines

I tested it but had strange results...

Regards

Andrea

[*] http://thread.gmane.org/gmane.comp.handhelds.openembedded/20843/focus=25154

Well, the objdump command(s) work on the mipsel kernel that I'm building, but on my i686 host vmlinux,

[grg@rak linux]$ objdump -p vmlinux | sed -n 's/LOAD.*vaddr \([^ ]*\).*/\1/p'

    0xc0100000
    0xc08f0000

Multiple lines beginning with 'LOAD'. I don't know whether this is typical of other architectures also. I'll keep playing on Monday and report back.

-Graham