x86: Executing a raw vmlinux image (embedded environment)
Graeme Russ
graeme.russ at gmail.com
Mon Nov 21 19:55:35 EST 2011
Hi All,
Firstly, a little introduction an background - I am currently the maintainer
for the x86 port of Das U-Boot (or more simply U-Boot). While the x86 port
is not as well known as the more major ports like ARM and PPC, it is
starting to gain more attention and more developer input which has beed
nice to see after my solo efforts over the last few years.
One of my biggest annoyances with the x86 U-Boot port is that, while it is
an embedded boot loader, it still tries to boot Linux as if it was a
conventional PC - i.e. it has 'real mode' and 'BIOS' implementation and
loads a bzImage. But this approach is completely unnecessary and only
adds to the boot time (load bzImage from storage into RAM, decompress,
then run).
So I want to shortcut bzImage and migrate towards treating the loading
of the Linux kernel from U-Boot like any other embedded environment:
- Decompress vmlinux directly from storage into the appropriate memory
location
- Setup required data structures
- Jump into vmlinux
U-Boot has it's own compressed kernel image container (uImage) and support
code which will allow me to decompress the vmlinux directly from storage
into RAM. In my current situation, I have ~1.7MB of onboard (i.e. cached)
flash memory where I plan to store the compressed kernel and an MMC where
I plan to store the file system.
So after building a very stripped down kernel (no TCP/IP for example) I
get:
/vmlinux 2,629,659 bytes
/vmlinux.o 2,889,050 bytes
/arch/i386/boot/bzImage 1,104,864 bytes
/arch/x86/boot/bzImage 1,104,864 bytes
/arch/x86/boot/vmlinux.bin 1,092,060 bytes
/arch/x86/boot/compressed/vmlinux 1,099,538 bytes
/arch/x86/boot/compressed/vmlinux.bin 2,094,132 bytes
/arch/x86/boot/compressed/vmlinux.bin.gz 1,074,711 bytes
I understand that /arch/x86/boot/compressed/vmlinux.bin.gz is a compressed
version of /arch/x86/boot/compressed/vmlinux.bin, and
/arch/i386/boot/bzImage and /arch/x86/boot/bzImage are the same file and
that it is the 16-bit boot code + /arch/x86/boot/compressed/vmlinux.bin.gz
but I don't understand the rest...
My guess is that /vmlinux.o is the ELF image generated by the compiler +
linker stage and /vmlinux may be /vmlinux.o objdump'd into a raw binary and
perhaps /arch/x86/boot/vmlinux.bin is a further stripped version
of/vmlinux, but I'm at a loss with /arch/x86/boot/compressed/vmlinux
In any event, it looks like either /arch/x86/boot/compressed/vmlinux.bin or
/vmlinux is what I need to copy into RAM @ 0x100000 (1MiB) which is where
my non-relocatable kernel is compiled to.
I also have looked at the documentation for the x86 32-boot protocol found
in linux/Documentation/x86/boot.txt
So what I'm needing is:
- Confirmation of exactly which vmlinux to use
- Confirmation that I do load it @ 0x100000
- How to setup the memory map (keeping in mind I have 2GB of contiguous
memory with no BIOS/ACPI etc to worry about clobbering
- Any other tricks I need to be aware of..
Any help will be greatly appreciated
Thanks,
Graeme
More information about the Kernelnewbies
mailing list