kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: graeme.russ@gmail.com (Graeme Russ)
To: kernelnewbies@lists.kernelnewbies.org
Subject: x86: Executing a raw vmlinux image (embedded environment)
Date: Tue, 22 Nov 2011 22:00:25 +1100	[thread overview]
Message-ID: <4ECB80C9.5000300@gmail.com> (raw)
In-Reply-To: <CAE6JOJ8Fz8Q5OYqmpB3hc=ZsTW=_ZRsv7ssKEACfAoto6uCORw@mail.gmail.com>

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

      reply	other threads:[~2011-11-22 11:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22  0:55 x86: Executing a raw vmlinux image (embedded environment) Graeme Russ
2011-11-22  5:34 ` sk.syed2
2011-11-22 11:00   ` Graeme Russ [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ECB80C9.5000300@gmail.com \
    --to=graeme.russ@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).