kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Does kernel Image file contains the elf format information ?
@ 2012-11-27  4:44 horse_rivers
  2012-11-27  5:10 ` Kumar amit mehta
  0 siblings, 1 reply; 6+ messages in thread
From: horse_rivers @ 2012-11-27  4:44 UTC (permalink / raw)
  To: kernelnewbies

hi,
? ?when we compile kernel,gcc will put elf format information into the target file ,then we use build-tools construct the kernel Image,

? during this procedure,will elf information be copyed into Image file ?


thanks!
BestRegards!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Does kernel Image file contains the elf format information ?
  2012-11-27  4:44 Does kernel Image file contains the elf format information ? horse_rivers
@ 2012-11-27  5:10 ` Kumar amit mehta
  2012-11-27  7:08   ` horse_rivers
  0 siblings, 1 reply; 6+ messages in thread
From: Kumar amit mehta @ 2012-11-27  5:10 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Nov 27, 2012 at 12:44:45PM +0800, horse_rivers wrote:
> hi,
> ? ?when we compile kernel,gcc will put elf format information into the target file ,then we use build-tools construct the kernel Image,
> 
> ? during this procedure,will elf information be copyed into Image file ?
> 
Yes, it does but as you know that the kernel image will be in the compressed
format, therefore you'll have to decompress it first. I tried following with my
kernel image and then I was able to use the 'readelf' and 'objdump' on the
extracted elf:

amit at ubuntu:/tmp$ cp /boot/vmlinuz-3.7.0-rc3-next-20121029 /tmp/
amit at ubuntu:/tmp$ od -A d -t x1 vmlinuz-3.7.0-rc3-next-20121029 | grep '1f 8b 08
00'
0016992 f3 a5 fc 5e 8d 83 b4 91 4f 00 ff e0 1f 8b 08 00
                             
amit at ubuntu:/tmp$ dd if=vmlinuz bs=1 skip=17004 | zcat > vmlinux

How did i calculated 17004 ?
0016992 + offset of GZ signature(1f 8b 08 00), i.e.
0016992 + 12

amit at ubuntu:/tmp$ dd if=vmlinuz-3.7.0-rc3-next-20121029 bs=1 skip=17004 | 
zcat > vmlinux
5233764+0 records in
5233764+0 records out
5233764 bytes (5.2 MB) copied

amit at ubuntu:/tmp$ file vmlinux
vmlinux: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically
linked, BuildID[sha1]=0xb874d61ffd40167270bdc1a95274976200223cc0, stripped

amit at ubuntu:/tmp$ objdump -f vmlinux

vmlinux:     file format elf32-i386
architecture: i386, flags 0x00000102:
EXEC_P, D_PAGED
start address 0x01000000

For more information check the link [1] below.

- Amit

[1] http://forums.codeguru.com/showthread.php?415186-convert-vmlinuz-to-vmlinux

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Does kernel Image file contains the elf format information ?
  2012-11-27  5:10 ` Kumar amit mehta
@ 2012-11-27  7:08   ` horse_rivers
  2012-11-27  7:58     ` Mulyadi Santosa
  0 siblings, 1 reply; 6+ messages in thread
From: horse_rivers @ 2012-11-27  7:08 UTC (permalink / raw)
  To: kernelnewbies

At?2012-11-27?13:10:37,"Kumar?amit?mehta"?<gmate.amit@gmail.com>?wrote:
>On?Tue,?Nov?27,?2012?at?12:44:45PM?+0800,?horse_rivers?wrote:
>>?hi,
>>????when?we?compile?kernel,gcc?will?put?elf?format?information?into?the?target?file?,then?we?use?build-tools?construct?the?kernel?Image,
>>?
>>???during?this?procedure,will?elf?information?be?copyed?into?Image?file??
>>?
>Yes,?it?does?but?as?you?know?that?the?kernel?image?will?be?in?the?compressed
>format,?therefore?you'll?have?to?decompress?it?first.?I?tried?following?with?my
>kernel?image?and?then?I?was?able?to?use?the?'readelf'?and?'objdump'?on?the
>extracted?elf:
>
? ?and ?this ?file can ?boot inux os ? ?if I put this file into ?floppy ,and boot from floppy ,can I boot this kernel ?

thanks!

>amit at ubuntu:/tmp$?cp?/boot/vmlinuz-3.7.0-rc3-next-20121029?/tmp/
>amit at ubuntu:/tmp$?od?-A?d?-t?x1?vmlinuz-3.7.0-rc3-next-20121029?|?grep?'1f?8b?08
>00'
>0016992?f3?a5?fc?5e?8d?83?b4?91?4f?00?ff?e0?1f?8b?08?00
>?????????????????????????????
>amit at ubuntu:/tmp$?dd?if=vmlinuz?bs=1?skip=17004?|?zcat?>?vmlinux
>
>How?did?i?calculated?17004??
>0016992?+?offset?of?GZ?signature(1f?8b?08?00),?i.e.
>0016992?+?12
>
>amit at ubuntu:/tmp$?dd?if=vmlinuz-3.7.0-rc3-next-20121029?bs=1?skip=17004?|?
>zcat?>?vmlinux
>5233764+0?records?in
>5233764+0?records?out
>5233764?bytes?(5.2?MB)?copied
>
>amit at ubuntu:/tmp$?file?vmlinux
>vmlinux:?ELF?32-bit?LSB?executable,?Intel?80386,?version?1?(SYSV),?statically
>linked,?BuildID[sha1]=0xb874d61ffd40167270bdc1a95274976200223cc0,?stripped
>
>amit at ubuntu:/tmp$?objdump?-f?vmlinux
>
>vmlinux:?????file?format?elf32-i386
>architecture:?i386,?flags?0x00000102:
>EXEC_P,?D_PAGED
>start?address?0x01000000
>
>For?more?information?check?the?link?[1]?below.
>
>-?Amit
>
>[1]?http://forums.codeguru.com/showthread.php?415186-convert-vmlinuz-to-vmlinux

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Does kernel Image file contains the elf format information ?
  2012-11-27  7:08   ` horse_rivers
@ 2012-11-27  7:58     ` Mulyadi Santosa
  2012-11-27  8:06       ` horse_rivers
  0 siblings, 1 reply; 6+ messages in thread
From: Mulyadi Santosa @ 2012-11-27  7:58 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Nov 27, 2012 at 2:08 PM, horse_rivers <horse_rivers@126.com> wrote:
>    and  this  file can  boot inux os ?  if I put this file into  floppy ,and boot from floppy ,can I boot this kernel ?

as long as your bootloader could load and boot it, then "yes"

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Does kernel Image file contains the elf format information ?
  2012-11-27  7:58     ` Mulyadi Santosa
@ 2012-11-27  8:06       ` horse_rivers
  2012-11-28  1:28         ` Mulyadi Santosa
  0 siblings, 1 reply; 6+ messages in thread
From: horse_rivers @ 2012-11-27  8:06 UTC (permalink / raw)
  To: kernelnewbies

At?2012-11-27?15:58:39,"Mulyadi?Santosa"?<mulyadi.santosa@gmail.com>?wrote:
>On?Tue,?Nov?27,?2012?at?2:08?PM,?horse_rivers?<horse_rivers@126.com>?wrote:
>>????and??this??file?can??boot?inux?os????if?I?put?this?file?into??floppy?,and?boot?from?floppy?,can?I?boot?this?kernel??
>
>as?long?as?your?bootloader?could?load?and?boot?it,?then?"yes"
>
? this is to say, there is a interpreter working for analysis elf informayion ?

?thanks!
>--?
>regards,
>
>Mulyadi?Santosa
>Freelance?Linux?trainer?and?consultant
>
>blog:?the-hydra.blogspot.com
>training:?mulyaditraining.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Does kernel Image file contains the elf format information ?
  2012-11-27  8:06       ` horse_rivers
@ 2012-11-28  1:28         ` Mulyadi Santosa
  0 siblings, 0 replies; 6+ messages in thread
From: Mulyadi Santosa @ 2012-11-28  1:28 UTC (permalink / raw)
  To: kernelnewbies

Hi...

On Tue, Nov 27, 2012 at 3:06 PM, horse_rivers <horse_rivers@126.com> wrote:
>   this is to say, there is a interpreter working for analysis elf informayion ?

AFAIK, no bootloader has such capability...it just load whatever you
point it to.....the rest is up to the kernel itself.

Think bootloader like rocket booster that help space shuttle to get
into the outer space.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-28  1:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-27  4:44 Does kernel Image file contains the elf format information ? horse_rivers
2012-11-27  5:10 ` Kumar amit mehta
2012-11-27  7:08   ` horse_rivers
2012-11-27  7:58     ` Mulyadi Santosa
2012-11-27  8:06       ` horse_rivers
2012-11-28  1:28         ` Mulyadi Santosa

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).