kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: manohar.vanga@gmail.com (Manohar Vanga)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How vmlinux is recognized?
Date: Wed, 11 May 2011 22:33:52 +0200	[thread overview]
Message-ID: <BANLkTim3dC6EY3d5ZBhCmmtZBiHbKL+Sew@mail.gmail.com> (raw)
In-Reply-To: <1305137213.2347.12.camel@ubuntu.ubuntu-domain>

Hi Vikram,

How the vmlinux (an ELF executable) is recognized by the processor?
>

ELF is just a file format. That is, the machine instructions and data are
stored in a specific format. The _processor_ simply recognizes machine
instructions and this needs to be taken from the ELF file and loaded into
memory (the instruction pointer is then pointed to the place the
instructions were loaded).

The format is simply a set of rules defined in the specification (a pretty
nice introduction is available at www.skyfree.org/linux/references/*ELF*
_Format.pdf <http://www.skyfree.org/linux/references/ELF_Format.pdf>). For
example, when you ask a Linux kernel to execute an ELF file, it has code to
know how to decode the information and place it into memory (see
fs/binfmt_elf.c).

As for the vmlinux file specifically, the Wikipedia page on vmlinux (
http://en.wikipedia.org/wiki/Vmlinux) seems like a good start. As shown
above with Linux, GRUB needs to have a way to decode whatever format is
passed to it (bzImage).

The kernel however places the unzipping code into the bzImage itself so that
it is loaded into memory by the bootloader and is then run. This code then
unzips the kernel. This way, GRUB doesn't need to know how to decode ELF
files and the job is left to the kernel code. You can see
arch/x86/boot/Makefile and look for the bzImage target to see what files
constitute the bzImage. I may be wrong about this with regard to newer
kernels so I hope others correct me in this case. Another great explanation
is by Alessandro Rubini at:

http://www.ibiblio.org/oswg/oswg-nightly/oswg/en_US.ISO_8859-1/articles/alessandro-rubini/boot/boot/zimage.html

Hope this helped! :-)

-- 
/manohar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110511/b7913e0b/attachment.html 

  parent reply	other threads:[~2011-05-11 20:33 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
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 [this message]
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=BANLkTim3dC6EY3d5ZBhCmmtZBiHbKL+Sew@mail.gmail.com \
    --to=manohar.vanga@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).