From: vikram186@gmail.com (Vikram Narayanan)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How vmlinux is recognized?
Date: Mon, 16 May 2011 08:44:03 +0530 [thread overview]
Message-ID: <BANLkTikcKX53ZkYnmxNKj51Y29pn0WNkMg@mail.gmail.com> (raw)
In-Reply-To: <BANLkTimMGNcP_9Rt8eMqYs__E6yP3AJ56w@mail.gmail.com>
On Fri, May 13, 2011 at 7:12 AM, Dave Hylands <dhylands@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
next prev parent reply other threads:[~2011-05-16 3:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-11 18:06 How vmlinux is recognized? Vikram Narayanan
2011-05-11 19:17 ` Dave Hylands
2011-05-11 19:31 ` Vikram Narayanan
2011-05-11 19:45 ` Mulyadi Santosa
2011-05-11 20:04 ` Vikram Narayanan
2011-05-11 20:09 ` Mulyadi Santosa
2011-05-11 20:11 ` Vikram Narayanan
2011-05-11 20:21 ` Mulyadi Santosa
2011-05-12 3:32 ` Vikram Narayanan
2011-05-12 4:32 ` Sudheer Divakaran
2011-05-12 6:21 ` Sudheer Divakaran
2011-05-12 7:26 ` luca ellero
2011-05-12 8:17 ` Mulyadi Santosa
2011-05-13 0:19 ` Vikram Narayanan
2011-05-13 1:42 ` Dave Hylands
2011-05-16 3:14 ` Vikram Narayanan [this message]
2011-05-16 3:44 ` Peter Teoh
2011-05-16 14:12 ` Vikram Narayanan
2011-05-12 9:31 ` अनुज
2011-05-11 20:33 ` Manohar Vanga
2011-05-12 3:34 ` Vikram Narayanan
2011-05-12 16:46 ` mindentropy
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=BANLkTikcKX53ZkYnmxNKj51Y29pn0WNkMg@mail.gmail.com \
--to=vikram186@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).