x86: Executing a raw vmlinux image (embedded environment)
Graeme Russ
graeme.russ at gmail.com
Tue Nov 22 06:00:25 EST 2011
Thanks syed,
Ok, I did a little more digging...
On 22/11/11 16:34, sk.syed2 wrote:
>> /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
> This is correct.
>> but I don't understand the rest...
I traced it all out. I sent a separate message to the ML documenting the
bzImage build chain - It's rather fascinating
>
>>
>> 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
>
> vmlinux is ELF image with ELF header. So actual point of kernel entry
> would be at an offset, somewhere after the ELF header.
> vmlinux.bin is what you would get after doing
> #objcopy -O binary vmlinux vmlinux.bin.
> vmlinux.bin has only obj code and nothing else.
To be more precise:
arch/x86/boot/compressed/vmlinux.bin is the result of
#objcopy -R .comment -S vmlinux
so it is still an ELF image
arch/x86/boot/vmlinux.bin is the result of:
#objcopy -O binary -R .note -R .comment -S arch/x86/boot/compressed/vmlinux
arch/x86/boot/compressed/vmlinux has the decompression stub + compressed
version of arch/x86/boot/compressed/vmlinux.bin
>>
>> 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.
>
> copy vmlinux.bin.
I don't think either is what I want - arch/x86/boot/vmlinux.bin still
contains a compressed kernel. And the contents of the compressed section is
an ELF image which requires more memcpys and memsets
What I really want, I think, is:
#objcopy -O binary -R .comment -S vmlinux
Which is not generated during the build process
>> - 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..
> Check if x86 kernel expects some parameters(like machineid, bootargs
> location etc) in some registers.
> Check if x86 has low level debug support(like DEBUG_LL).
> Also you might want to check how initial page tables are being setup in kernel.
I need to have a good look at what goes into arch/x86/boot/setup.bin - That
will really tell me what I need to do
Thanks,
Graeme
More information about the Kernelnewbies
mailing list