[U-Boot] uImage load address and entry point with Minnowboard

Hello,
I am working on an embedded project to optimize the boot time on minnowboard. Currently I am working with the u-boot. With compressed kernel (bzImage) everything works fine, I want to check the performance with uncompressed kernel (vmlinux).
I have found that u-boot cannot support the raw vmlinux and I need to generate the uImage using the u-boot tools.
I tried creating the uImage from the vmlinux --but I did not understand what does the -a (load address) and -e (entry point ) points to? I assume that it is the same load address used when loading the kernel image from sd card to RAM.
uImage creation:
mkimage -A x86 -O linux -T kernel -a 0x01000000 -e 0x01000000 -n Linux -d vmlinux uImage Image Name: Linux Created: Wed Jun 22 16:31:07 2016 Image Type: Intel x86 Linux Kernel Image (gzip compressed) Data Size: 21966248 Bytes = 21451.41 kB = 20.95 MB Load Address: 01000000 Entry Point: 01000000
Now at start up I am seeing that the kernel is not running, Seeing the following error messages,
reading uImage 21966312 bytes read in 481 ms (43.6 MiB/s) Wrong Image Format for bootm command ERROR: can't get kernel image!
The bootcmd is "bootcmd=fatload mmc 0:1 01000000 uImage ; bootm 01000000"
Do you have any idea why it is happening?
Mit Freundlichen Grüßen VinothKumar +49 1798909072

Dear vinoth,
In message CAJst-kGL+cNWys125Y9Xtj=XZvRhStdjnG7cfKMgiQN7dR5=jQ@mail.gmail.com you wrote:
I tried creating the uImage from the vmlinux --but I did not understand what does the -a (load address) and -e (entry point ) points to? I assume that it is the same load address used when loading the kernel image from sd card to RAM.
No, it is not.
There are actually two "load addresses". Uusally I prefer to call the first the "download address": this is the address in memory space where you download the uImage file to, i. e. the first address of the uImage file in the system memory (RAM or parallel NOR flash etc.).
The payload of the uImage is often a _compressed_ kernel image. To boot it, U-Boot will have to uncompress and _load_ it to some other address in RAM. This is the "load address", given by the "-a" option to mkimage. Afther that, you have the uncompressed, executable kerl image sitting in RAM, starting at the "load address" - but this is not necessarily the same as the entry point address - the latter is given by the "-e" argument.
While you can download and store the uImage file at an arbitrary address in memory, the addresses for the executable (uncompressed) image and for the entry point are often fixed - this is why they re registered in the uImage file.
Note that because you usually uncompress and load (copy) the image to the load address, you must not download the uImage to the load address; this will usually result in memory corruptuin and boot failure.
Best regards,
Wolfgang Denk

Dear Mr.Wolfgang Denk,
On Wed, Jun 22, 2016 at 8:41 PM, Wolfgang Denk wd@denx.de wrote:
Dear vinoth,
In message CAJst-kGL+cNWys125Y9Xtj=XZvRhStdjnG7cfKMgiQN7dR5=jQ@mail.gmail.com you wrote:
I tried creating the uImage from the vmlinux --but I did not understand what does the -a (load address) and -e (entry point ) points to? I assume that it is the same load address used when loading the kernel image from sd card to RAM.
No, it is not.
There are actually two "load addresses". Uusally I prefer to call the first the "download address": this is the address in memory space where you download the uImage file to, i. e. the first address of the uImage file in the system memory (RAM or parallel NOR flash etc.).
The payload of the uImage is often a _compressed_ kernel image. To boot it, U-Boot will have to uncompress and _load_ it to some other address in RAM. This is the "load address", given by the "-a" option to mkimage. Afther that, you have the uncompressed, executable kerl image sitting in RAM, starting at the "load address" - but this is not necessarily the same as the entry point address - the latter is given by the "-e" argument.
Thanks for your explanation. But I still have some questions , sorry if it is naive:
1) What's the address in the bootcmd corresponds to , I think it is the address where we want the u-boot to load the Linux kernel image into RAM
For ex: fatload mmc 0:1 01000000 bzImage; zboot 01000000
Here 01000000 is the address and bzImage is the compressed Linux kernel stored in mmc0 partition1. Once the Kernel is copied to RAM we are using zboot command to start the kernel, so after it Kernel unpacks itself and starts running
2) I want to use uncompressed Kernel(vmlinux) instead of bzImage. U-boot directly doesn't support running vmlinux, so I need to generate the uImage using the mkImage tool. So the payload in my case in uncompressed kernel. To generate this I want two addresses , load address and entry point address. You have mentioned that the addresses are often fixed. How can I get these addresses?
I am using the same address in bootcmd: fatload mmc 0:1 01000000 uImage; bootm 01000000
While you can download and store the uImage file at an arbitrary address in memory, the addresses for the executable (uncompressed) image and for the entry point are often fixed - this is why they re registered in the uImage file.
Note that because you usually uncompress and load (copy) the image to the load address, you must not download the uImage to the load address; this will usually result in memory corruptuin and boot failure.
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de There is nothing in this world constant but inconstancy. - Swift

Dear Vinoth,
In message CAJst-kGA9s24O=BKa8ESWmtg-HgZ8oPC+i1h0BJWc0_c1uczrg@mail.gmail.com you wrote:
- What's the address in the bootcmd corresponds to , I think it is
Define "bootcmd" - this can be anything.
the address where we want the u-boot to load the Linux kernel image into RAM
For ex: fatload mmc 0:1 01000000 bzImage; zboot 01000000
This does not apply to your previous question. We were talking about the address entries in uImage files - but there you use a bzImage which does not include the uImage header, and so it doesn not have any "load address" or "entry point address" settings stored in the image. Here you need to know these yourself.
Here 01000000 is the address and bzImage is the compressed Linux kernel stored in mmc0 partition1. Once the Kernel is copied to RAM we are using zboot command to start the kernel, so after it Kernel unpacks itself and starts running
Correct - but this is a totally different scenario.
Note also that th enotation of "kernel unpacks itself" is dependent on the image type and to some parts on the architecture.
- I want to use uncompressed Kernel(vmlinux) instead of bzImage.
U-boot directly doesn't support running vmlinux, so I need to generate the uImage using the mkImage tool. So the payload in my case in uncompressed kernel. To generate this I want two addresses , load address and entry point address. You have mentioned that the addresses are often fixed. How can I get these addresses?
They are defined in the kerel build process; check Linux Makefiles, and/or study the linker commands used when linking the kernel image.
I am using the same address in bootcmd: fatload mmc 0:1 01000000 uImage; bootm 01000000
In this case 0x01000000 is what I usually call the "download address", i. e. the location where the uImage is stored in memory. This has nothing to do with the load address or entry pint address (except that you will likely run into trouble if these should be the same or close to it).
Best regards,
Wolfgang Denk

Dear Mr.Wolfgang Denk,
Your reply had helped me a lot in figuring out the solution, but I run into another issue.
I had identified the kernel file where load address is defined: kexec-bzimage64.c:#define MIN_KERNEL_LOAD_ADDR 0x100000
I am using the following command to create uImage. Here in the architecture argument I am not seeing any option corresponding to the Intel-x86_64. So I had used x86, which I am not sure is valid or not. The kernel is 64 bit.
mkimage -A x86 -O linux -T kernel -C none -a 0x100000 -e 0x00000 -n Linux -d vmlinux-4.4.6-ina uImage Image Name: Linux Created: Fri Jun 24 10:35:40 2016 Image Type: Intel x86 Linux Kernel Image (uncompressed) Data Size: 21966248 Bytes = 21451.41 kB = 20.95 MB Load Address: 00100000 Entry Point: 00000000
The bootcmd is "bootcmd fatload mmc 1:1 02000000 uImage ; bootm 02000000". Now after copying the kernel to RAM I am seeing the following error messages:
Error: Invalid Boot Flag (found 0x0000, expected 0xaa55) Setup at 0x000000 Magic signature not found
Is is I need to load setup.bin also?
After Starting Kernel I am seeing the following message:
Invalid Opcode (Undefined Opcode) EIP: 0010:[<00000058>] EFLAGS: 00010006 Original EIP :[<849a4058>] EAX: 05050616 EBX: 00000000 ECX: 00000000 EDX: 00000000 ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: 7b348150 DS: 0018 ES: 0018 FS: 0020 GS: 0018 SS: 0018 CR0: 00000033 CR2: 00000000 CR3: 00000000 CR4: 00000600 DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000 DR6: ffff0ff0 DR7: 00000400 Stack: 0x7b348190 : 0x00009000 0x7b34818c : 0x7b5cf088 0x7b348188 : 0x00000007 0x7b348184 : 0x7b5ae4e8 0x7b348180 : 0x00010000 0x7b34817c : 0x00000000 0x7b348178 : 0x7b3481bc 0x7b348174 : 0x00000001 0x7b348170 : 0xcb6e3ac1 0x7b34816c : 0x7b55f663 0x7b348168 : 0x7b36035c 0x7b348164 : 0x00000000 0x7b348160 : 0x00000400 0x7b34815c : 0x7b5cf088 0x7b348158 : 0x00000000 0x7b348154 : 0x00000000 --->0x7b348150 : 0x00009000 0x7b34814c : 0x00010006 0x7b348148 : 0x00000010 0x7b348144 : 0x00000058 ### ERROR ### Please RESET the board ###
I didn't understand what#s happening here? Do I need to load the *.dtb file also or this will be done internally by the u-boot.
Thanks & Regards, Vinothkumar
On Thu, Jun 23, 2016 at 8:21 PM, Wolfgang Denk wd@denx.de wrote:
Dear Vinoth,
In message <CAJst-kGA9s24O= BKa8ESWmtg-HgZ8oPC+i1h0BJWc0_c1uczrg@mail.gmail.com> you wrote:
- What's the address in the bootcmd corresponds to , I think it is
Define "bootcmd" - this can be anything.
the address where we want the u-boot to load the Linux kernel image into RAM
For ex: fatload mmc 0:1 01000000 bzImage; zboot 01000000
This does not apply to your previous question. We were talking about the address entries in uImage files - but there you use a bzImage which does not include the uImage header, and so it doesn not have any "load address" or "entry point address" settings stored in the image. Here you need to know these yourself.
Here 01000000 is the address and bzImage is the compressed Linux kernel stored in mmc0 partition1. Once the Kernel is copied to RAM we are using zboot command to start the kernel, so after it Kernel unpacks itself and starts running
Correct - but this is a totally different scenario.
Note also that th enotation of "kernel unpacks itself" is dependent on the image type and to some parts on the architecture.
- I want to use uncompressed Kernel(vmlinux) instead of bzImage.
U-boot directly doesn't support running vmlinux, so I need to generate the uImage using the mkImage tool. So the payload in my case in uncompressed kernel. To generate this I want two addresses , load address and entry point address. You have mentioned that the addresses are often fixed. How can I get these addresses?
They are defined in the kerel build process; check Linux Makefiles, and/or study the linker commands used when linking the kernel image.
I am using the same address in bootcmd: fatload mmc 0:1 01000000 uImage; bootm 01000000
In this case 0x01000000 is what I usually call the "download address", i. e. the location where the uImage is stored in memory. This has nothing to do with the load address or entry pint address (except that you will likely run into trouble if these should be the same or close to it).
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de You get a wonderful view from the point of no return. - Terry Pratchett, _Making_Money_

Dear Vinoth,
In message CAJst-kFZjA_Nq7K25CEPri9Aq7r=-mmtGyeNYwwg-P2CrN4dbA@mail.gmail.com you wrote:
I am using the following command to create uImage. Here in the architecture argument I am not seeing any option corresponding to the Intel-x86_64. So I had used x86, which I am not sure is valid or not. The kernel is 64 bit.
mkimage -A x86 -O linux -T kernel -C none -a 0x100000 -e 0x00000 -n Linux -d vmlinux-4.4.6-ina uImage Image Name: Linux Created: Fri Jun 24 10:35:40 2016 Image Type: Intel x86 Linux Kernel Image (uncompressed) Data Size: 21966248 Bytes = 21451.41 kB = 20.95 MB Load Address: 00100000 Entry Point: 00000000
This makes no sense to me. When the kernel image is loaded to RAM starting at address 0x00100000, then ther eis no valid code at address 0x00000000. So 0x00000000 cannot be a valid entry oint address. The entry point address must be somewhare in the range between "load address" and "load address + size of uncompressed kernel image".
Error: Invalid Boot Flag (found 0x0000, expected 0xaa55) Setup at 0x000000 Magic signature not found
Is is I need to load setup.bin also?
I have no idea. I didn't know that you were asking for x86... I'm not an expert in this area. I added Simon and Bin to cc: who might be in a much better position to answer such a question.
Best regards,
Wolfgang Denk

On Fri, 24 Jun 2016, Wolfgang Denk wrote:
Dear Vinoth,
In message CAJst-kFZjA_Nq7K25CEPri9Aq7r=-mmtGyeNYwwg-P2CrN4dbA@mail.gmail.com you wrote:
I am using the following command to create uImage. Here in the architecture argument I am not seeing any option corresponding to the Intel-x86_64. So I had used x86, which I am not sure is valid or not. The kernel is 64 bit.
mkimage -A x86 -O linux -T kernel -C none -a 0x100000 -e 0x00000 -n Linux -d vmlinux-4.4.6-ina uImage Image Name: Linux Created: Fri Jun 24 10:35:40 2016 Image Type: Intel x86 Linux Kernel Image (uncompressed) Data Size: 21966248 Bytes = 21451.41 kB = 20.95 MB Load Address: 00100000 Entry Point: 00000000
This makes no sense to me. When the kernel image is loaded to RAM starting at address 0x00100000, then ther eis no valid code at address 0x00000000. So 0x00000000 cannot be a valid entry oint address. The entry point address must be somewhare in the range between "load address" and "load address + size of uncompressed kernel image".
Error: Invalid Boot Flag (found 0x0000, expected 0xaa55) Setup at 0x000000 Magic signature not found
Is is I need to load setup.bin also?
i'm sure i'm not adding much to this discussion, but 0xaa55 is the last two bytes of an MBR that identifies that 512-byte block as a legitimate master boot record, so *something* is looking for an MBR and not finding it.
rday

On Fri, Jun 24, 2016 at 1:57 PM, Wolfgang Denk wd@denx.de wrote:
Dear Vinoth,
In message CAJst-kFZjA_Nq7K25CEPri9Aq7r=-mmtGyeNYwwg-P2CrN4dbA@mail.gmail.com you wrote:
I am using the following command to create uImage. Here in the architecture argument I am not seeing any option corresponding to the Intel-x86_64. So I had used x86, which I am not sure is valid or not. The kernel is 64 bit.
mkimage -A x86 -O linux -T kernel -C none -a 0x100000 -e 0x00000 -n Linux -d vmlinux-4.4.6-ina uImage Image Name: Linux Created: Fri Jun 24 10:35:40 2016 Image Type: Intel x86 Linux Kernel Image (uncompressed) Data Size: 21966248 Bytes = 21451.41 kB = 20.95 MB Load Address: 00100000 Entry Point: 00000000
This makes no sense to me. When the kernel image is loaded to RAM starting at address 0x00100000, then ther eis no valid code at address 0x00000000. So 0x00000000 cannot be a valid entry oint address. The entry point address must be somewhare in the range between "load address" and "load address + size of uncompressed kernel image".
Dear Mr.Simon Glass,
Could you please explain how the load address and entry address work in x86. I am using the same address as defined in image.its and still could run the Linux kernel.
Defined in image.its file: kernel@1 { description = "Vanilla Linux kernel"; data = /incbin/("./vmlinux.bin"); type = "kernel"; arch = "x86_64"; os = "linux"; compression = "none"; load = <0x01000000>; entry = <0x00000000>; }
As pointed out by Mr.Wolfgang it doesn't make sense, as the kernel is loaded at the address '0x01000000' and entry is '0x0000000'. Or in x86_64 arch these addresses are stored in setup.bin files and loaded at run time?
Regards, Vinothkumar
Error: Invalid Boot Flag (found 0x0000, expected 0xaa55) Setup at 0x000000 Magic signature not found
Is is I need to load setup.bin also?
I have no idea. I didn't know that you were asking for x86... I'm not an expert in this area. I added Simon and Bin to cc: who might be in a much better position to answer such a question.
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de To be is to program.

Hi,
On 27 June 2016 at 01:13, vinoth eswaran evinoth1206@gmail.com wrote:
On Fri, Jun 24, 2016 at 1:57 PM, Wolfgang Denk wd@denx.de wrote:
Dear Vinoth,
In message CAJst-kFZjA_Nq7K25CEPri9Aq7r=-mmtGyeNYwwg-P2CrN4dbA@mail.gmail.com you wrote:
I am using the following command to create uImage. Here in the architecture argument I am not seeing any option corresponding to the Intel-x86_64. So I had used x86, which I am not sure is valid or not. The kernel is 64 bit.
mkimage -A x86 -O linux -T kernel -C none -a 0x100000 -e 0x00000 -n Linux -d vmlinux-4.4.6-ina uImage Image Name: Linux Created: Fri Jun 24 10:35:40 2016 Image Type: Intel x86 Linux Kernel Image (uncompressed) Data Size: 21966248 Bytes = 21451.41 kB = 20.95 MB Load Address: 00100000 Entry Point: 00000000
This makes no sense to me. When the kernel image is loaded to RAM starting at address 0x00100000, then ther eis no valid code at address 0x00000000. So 0x00000000 cannot be a valid entry oint address. The entry point address must be somewhare in the range between "load address" and "load address + size of uncompressed kernel image".
Dear Mr.Simon Glass,
Could you please explain how the load address and entry address work in x86. I am using the same address as defined in image.its and still could run the Linux kernel.
Defined in image.its file: kernel@1 { description = "Vanilla Linux kernel"; data = /incbin/("./vmlinux.bin"); type = "kernel"; arch = "x86_64"; os = "linux"; compression = "none"; load = <0x01000000>; entry = <0x00000000>; }
As pointed out by Mr.Wolfgang it doesn't make sense, as the kernel is loaded at the address '0x01000000' and entry is '0x0000000'. Or in x86_64 arch these addresses are stored in setup.bin files and loaded at run time?
The kernel is loaded to the load address and executed starting from its load address. The entry address is not used in this case, so it can be 0. The kernel requires that it be entered from the start address. The setup.bin information is passed to the kernel for it to use. It contains configuration info that dates back to the ark, but I believe it is essential.
Regards, Vinothkumar
Error: Invalid Boot Flag (found 0x0000, expected 0xaa55) Setup at 0x000000 Magic signature not found
Is is I need to load setup.bin also?
I have no idea. I didn't know that you were asking for x86... I'm not an expert in this area. I added Simon and Bin to cc: who might be in a much better position to answer such a question.
Best regards,
Wolfgang Denk
Regards, Simon

Hi,
On 22 June 2016 at 08:50, vinoth eswaran evinoth1206@gmail.com wrote:
Hello,
I am working on an embedded project to optimize the boot time on minnowboard. Currently I am working with the u-boot. With compressed kernel (bzImage) everything works fine, I want to check the performance with uncompressed kernel (vmlinux).
I have found that u-boot cannot support the raw vmlinux and I need to generate the uImage using the u-boot tools.
I tried creating the uImage from the vmlinux --but I did not understand what does the -a (load address) and -e (entry point ) points to? I assume that it is the same load address used when loading the kernel image from sd card to RAM.
uImage creation:
mkimage -A x86 -O linux -T kernel -a 0x01000000 -e 0x01000000 -n Linux -d vmlinux uImage
You should be using FIT, with the x86-fit-boot.txt that you mention in your other email. With this command line, you won't get setup.bin. But x86 needs this.
Image Name: Linux Created: Wed Jun 22 16:31:07 2016 Image Type: Intel x86 Linux Kernel Image (gzip compressed) Data Size: 21966248 Bytes = 21451.41 kB = 20.95 MB Load Address: 01000000 Entry Point: 01000000
Now at start up I am seeing that the kernel is not running, Seeing the following error messages,
reading uImage 21966312 bytes read in 481 ms (43.6 MiB/s) Wrong Image Format for bootm command ERROR: can't get kernel image!
The bootcmd is "bootcmd=fatload mmc 0:1 01000000 uImage ; bootm 01000000"
Do you have any idea why it is happening?
Mit Freundlichen Grüßen VinothKumar +49 1798909072 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Regards, Simon
participants (4)
-
Robert P. J. Day
-
Simon Glass
-
vinoth eswaran
-
Wolfgang Denk