<div class="gmail_quote">Hi Vikram,<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
How the vmlinux (an ELF executable) is recognized by the processor?<br></blockquote><div><br>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).<br>
<br>The format is simply a set of rules defined in the specification (a pretty nice introduction is available at <span><cite><a href="http://www.skyfree.org/linux/references/ELF_Format.pdf" target="_blank">www.skyfree.org/linux/references/<b>ELF</b>_Format.pdf</a>)</cite></span>. 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).<br>
<br>As for the vmlinux file specifically, the Wikipedia page on vmlinux (<a href="http://en.wikipedia.org/wiki/Vmlinux" target="_blank">http://en.wikipedia.org/wiki/Vmlinux</a>) 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).<br>
<br>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:<br>
<br><a href="http://www.ibiblio.org/oswg/oswg-nightly/oswg/en_US.ISO_8859-1/articles/alessandro-rubini/boot/boot/zimage.html" target="_blank">http://www.ibiblio.org/oswg/oswg-nightly/oswg/en_US.ISO_8859-1/articles/alessandro-rubini/boot/boot/zimage.html</a><br>
<br>Hope this helped! :-)<br>
<br>-- <br></div></div>/manohar<br>