How vmlinux is recognized?
Vikram Narayanan
vikram186 at gmail.com
Sun May 15 23:14:03 EDT 2011
On Fri, May 13, 2011 at 7:12 AM, Dave Hylands <dhylands at gmail.com> wrote:
>
> Hi Vikram,
>
> ...snip...
> > So when compiling the kernel, what is the purpose of the other
> > files(mentioned below)
> > linux-2.6/vmlinux - ELF executable, not stripped
> > linux-2.6/arch/x86/boot/vmlinux.bin - Raw binary (Guess this is the
> > one which is inside the bzImage)
> > linux-2.6/arch/x86/boot/compressed/vmlinux.bin - ELF executable, stripped
> > linux-2.6/arch/x86/boot/compressed/vmlinux - ELF executable, not stripped
>
> Take luca's email and start at the bottom working towards the top.
>
> linux-2.6/vmlinux is the output of the linker. As such, it is an ELF file.
> A binary is then extracted from this to create
> arch/x86/boot/compressed/vmlinux.bin
> This binary is then compressed to produce
> arch/x86/boot/compressed/vmlinux.bin.gz
> This gzipped binary is then converted into an object file (which just
> contains the gzipped data) but now we're back to having an ELF file
> called arch/x86/boot/compressed/piggy.o
> The linker then compiles a decompressor (misc.o) and piggy.o together
> to produce arch/x86/boot/compressed/vmlinux (an ELF file).
> objcopy is used again to convert this ELF into a binary:
> arch/x86/boot/compressed/vmlinux arch/x86/boot/vmlinux.bin
> Finally, the binary is compressed to produce bzImage.
>
> So what you get is a compressed binary which contains a decompressor
> and another compressed binary, this inner compressed binary being the
> kernel.
>
> GRUB loads bzImage into memory and decompresses it and then executes
> the resulting binary.
> This binary starts with a decompressor which then decompresses the
> kernel, and executes the resulting binary.
> This binary may relocate itself (probably depends on the architecture)
> to a different spot in memory, and then runs.
> The kernel is now running.
Thanks for the detailed explanation. Clarified. :)
-
Thanks
Vikram
More information about the Kernelnewbies
mailing list