Does kernel Image file contains the elf format information ?
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!
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@ubuntu:/tmp$ cp /boot/vmlinuz-3.7.0-rc3-next-20121029 /tmp/ amit@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@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@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@ubuntu:/tmp$ file vmlinux vmlinux: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, BuildID[sha1]=0xb874d61ffd40167270bdc1a95274976200223cc0, stripped amit@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
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@ubuntu:/tmp$ cp /boot/vmlinuz-3.7.0-rc3-next-20121029 /tmp/ amit@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@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@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@ubuntu:/tmp$ file vmlinux vmlinux: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, BuildID[sha1]=0xb874d61ffd40167270bdc1a95274976200223cc0, stripped
amit@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
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
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
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
participants (3)
-
horse_rivers -
Kumar amit mehta -
Mulyadi Santosa