Skip to contentSkip to conversation

Why vmlinux.bin are changed from raw image to elf for x86 ?

DISCUSSION Jacky 2 participants 3 messages Mar 2, 2013

lore
Share & tools
lore

Jacky

author
#0 lore raw

Hi All,

Recently, I found that x86 vmlinux.bin are changed from raw image to elf, we can got it from the following objcopy flags:

linux-3.7.x/arch/x86/boot/compressed/Makefile?
OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
$(obj)/vmlinux.bin: vmlinux FORCE

    $(call if_changed,objcopy)

we can see that kbuild pass no "-O binary" to objcopy.

And I double check the vmlinux.bin as following:

linux-3.7.x/arch/x86/boot/compressed$ file vmlinux.bin
vmlinux.bin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, BuildID[sha1]=0x7ad967473a9b36bc529551eecd326b5dfd15a426, stripped

Make sure the vmlinux.bin is elf, not raw binary. Anyone knows the rootcause ?

Thanks,
Jacky

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130302/b18ed171/attachment.html

author
#1 lore raw

And I just double check, the transition happened from 2.6.25 to 2.6.26:

This is makefile fragment of 2.6.25:

linux-2.6.25/arch/x86/boot/compressed/Makefile OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S $(obj)/vmlinux.bin: vmlinux FORCE

    $(call if_changed,objcopy)

while the following is makefile fragment of 2.6.26:

linux-2.6.26/arch/x86/boot/compressed/Makefile:
OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
$(obj)/vmlinux.bin: vmlinux FORCE

    $(call if_changed,objcopy)

The "-O binary" is removed. And I don't find any changelog.

Jacky

At 2013-03-02 15:54:33,Jacky <[email protected]> wrote:

Hi All,

Recently, I found that x86 vmlinux.bin are changed from raw image to elf, we can got it from the following objcopy flags:

linux-3.7.x/arch/x86/boot/compressed/Makefile?
OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
$(obj)/vmlinux.bin: vmlinux FORCE

    $(call if_changed,objcopy)

we can see that kbuild pass no "-O binary" to objcopy.

And I double check the vmlinux.bin as following:

linux-3.7.x/arch/x86/boot/compressed$ file vmlinux.bin
vmlinux.bin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, BuildID[sha1]=0x7ad967473a9b36bc529551eecd326b5dfd15a426, stripped

Make sure the vmlinux.bin is elf, not raw binary. Anyone knows the rootcause ?

Thanks,
Jacky

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130302/a4613918/attachment.html

#2 lore raw
Quoted 1 line · Jacky

The "-O binary" is removed. And I don't find any changelog.

A quick course on researching kernel development history...

Step 1: 'git blame arch/x86/boot/compressed/Maekfile'

That gives us the line:

099e1377 (Ian Campbell 2008-02-13 20:54:58 +0000 42) OBJCOPYFLAGS_vmlinux.bin := -R .comment -S

(Fortunately, this is the commit we wanted - figuring out how to get git to trace through the history if a subsequent commit had touched this line is left as an exercise for the reader :)

Step 2: 'git log 099e1377' gives us this:

commit 099e1377269a47ed30a00ee131001988e5bcaa9c

Author: Ian Campbell <[email protected]>
Date:   Wed Feb 13 20:54:58 200

x86: use ELF format in compressed images.

Cc Ian Campbell <[email protected]>
Cc Jeremy Fitzhardinge <[email protected]>
Cc virtualization at lists.linux-foundation.org
Cc H. Peter Anvin <[email protected]>
Cc Jeremy Fitzhardinge <[email protected]>
Cc virtualization at lists.linux-foundation.org

The one-liner summary matches exactly with what we're interested in, so it's quite likely the commit we care about.

Step 3: That's a pretty damned sparse Changelog. Fortunately, that's enough to feed to Google, and in about 25 seconds, I find this message:

http://www.gossamer-threads.com/lists/linux/kernel/902407

[PATCHv3 1/3] x86: use ELF format in compressed images.
This allows other boot loaders such as the Xen domain builder the opportunity to extract the ELF file.

So there's the complete patch, including the things it touched besides the Makefile, plus the reason for doing it.

Have a nice day.. ;)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130302/116ce1ed/attachment.bin