From: gmate.amit@gmail.com (Kumar amit mehta)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Does kernel Image file contains the elf format information ?
Date: Tue, 27 Nov 2012 10:40:37 +0530 [thread overview]
Message-ID: <20121127051036.GA2789@gmail.com> (raw)
In-Reply-To: <13ab559b.8734.13b402e787a.Coremail.horse_rivers@126.com>
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
next prev parent reply other threads:[~2012-11-27 5:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-27 4:44 Does kernel Image file contains the elf format information ? horse_rivers
2012-11-27 5:10 ` Kumar amit mehta [this message]
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
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=20121127051036.GA2789@gmail.com \
--to=gmate.amit@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.