How vmlinux is recognized?
Sudheer Divakaran
inbox1.sudheer at gmail.com
Thu May 12 02:21:25 EDT 2011
On Thu, May 12, 2011 at 10:02 AM, Sudheer Divakaran
<inbox1.sudheer at gmail.com> wrote:
> Hi Vikram,
>
> On Thu, May 12, 2011 at 9:02 AM, Vikram Narayanan <vikram186 at gmail.com> wrote:
>> On Thu, May 12, 2011 at 1:51 AM, Mulyadi Santosa
>> <mulyadi.santosa at gmail.com> wrote:
>>> On Thu, May 12, 2011 at 03:11, Vikram Narayanan <vikram186 at gmail.com> wrote:
>>>> Yes. I agree. But how who converts the ELF binary to raw binary so
>>>> that the processor understands. Or how is it actually done?
>>>
>>> OK I try my best to understand your question :)
>>>
>>> i think I got it...you probably guessed that vmlinux created first,
>>> then vmlinuz... AFAIK, it's the other way around...or more precisely,
>>> not both.
>>
>> I think you got it wrong. I will try to put my question more elaborately.
>> 1) The system is on and BIOS code runs. It gives the control to the
>> boot loader, say GRUB.
>> 2) Grub picks up the kernel from the specific partition. (i.e a
>> vmlinuz image), which denotes that it is compressed.
>> 3) There are uncompression routines in the kernel itself, If I am not
>> wrong. So the kernel uncompresses itself.
>> 4) Now the uncompressed thing is the vmlinux image, right?
>> 5) The vmlinux is in ELF format. Correct?
>> 6) If the OS boots and if u try to run an ELF file, the loader knows
>> how to load that in the RAM. (I mean it knows how to interpret the ELF
>> format)
>> 7) Coming back to the vmlinux image, Who takes care of the loading activity.?
>> 8) Who recognizes that the image is ELF format and do the necessary
>> things accordingly.?
>>
>> Hope I have my question clear now.
>>
>
>
>
> If understand your question correctly, you believe that the
> uncompressed kernel is in elf format. correct?. it is in binary
> format, so elf interpretation is not required, #5 is wrong.
>
> You can see this by building the kernel using 'make V=1' and note the
> following line in the output,
>
> "arch/x86/boot/tools/build arch/x86/boot/setup.bin
> arch/x86/boot/vmlinux.bin CURRENT > arch/x86/boot/bzImage"
>
> means bzImage is made out of two binary files extracted from the elf images.
One more info I want to clarify is, vmlinux.bin mentioned in the
above snippet contains the compressed binary image and some other
routines. Just go through the 'make V=1' output, you can see that the
build process is actually compressing binary file extracted from the
vmlinux elf image, which is again combined with some object files,
creates another elf and again extracts the binary and finally combined
with the setup.bin to create the final bzImage. So, elf interpretation
doesn't happen on the uncompressed code.
--
Thanks
Sudheer
More information about the Kernelnewbies
mailing list