2017年3月7日星期二

What's inside initrd (x86_64)

1 File Only - GenuineIntel.bin
Suspect extraction failed.
Get the answer from stackexchange with few modification.

http://unix.stackexchange.com/questions/163346/why-is-it-that-my-initrd-only-has-one-directory-namely-kernel

$file initrd.img
initrd.img: ASCII cpio archive (SVR4 with no CRC)
$mkdir initTree && cd initTree
$cpio -idv < ../initrd.img
`-- kernel
    `-- x86
        `-- microcode
            `-- GenuineIntel.bin
The cpio block skip method given doesn't work reliably. That's because the initrd images didn't have both archives concatenated on a 512 byte boundary.

Instead, do this:

apt-get install binwalk
DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             ASCII cpio archive (SVR4 with no CRC), file name: "kernel", file name length: "0x00000007", file size: "0x00000000"
120           0x78            ASCII cpio archive (SVR4 with no CRC), file name: "kernel/x86", file name length: "0x0000000B", file size: "0x00000000"
244           0xF4            ASCII cpio archive (SVR4 with no CRC), file name: "kernel/x86/microcode", file name length: "0x00000015", file size: "0x00000000"
376           0x178           ASCII cpio archive (SVR4 with no CRC), file name: "kernel/x86/microcode/GenuineIntel.bin", file name length: "0x0000002A", file size: "0x00005400"
22032         0x5610          ASCII cpio archive (SVR4 with no CRC), file name: "TRAILER!!!", file name length: "0x0000000B", file size: "0x00000000"
22528         0x5800          gzip compressed data, from Unix, last modified: 2017-03-06 14:00:21
10181078      0x9B59D6        MySQL ISAM index file Version 3
 
dd if=initrd.img bs=22528 skip=1 | gunzip | cpio -id
1778+1 records in
1778+1 records out
40073444 bytes (40 MB, 38 MiB) copied, 3.15216 s, 12.7 MB/s
209980 blocks
 ls -l
total 39208
drwxr-xr-x  2 yip yip     4096 Mar  7 21:36 bin
drwxr-xr-x  3 yip yip     4096 Mar  7 21:36 conf
drwxr-xr-x 10 yip yip     4096 Mar  7 21:36 etc
-rwxr-xr-x  1 yip yip     6907 Mar  7 21:36 init
-rw-r--r--  1 yip yip 40095972 Mar  7 21:30 initrd.img
drwxr-xr-x  9 yip yip     4096 Mar  7 21:36 lib
drwxr-xr-x  2 yip yip     4096 Mar  7 21:36 lib64
drwxr-xr-x  2 yip yip     4096 Mar  7 21:36 run
drwxr-xr-x  2 yip yip     4096 Mar  7 21:36 sbin
drwxr-xr-x  7 yip yip     4096 Mar  7 21:36 scripts
drwxr-xr-x  4 yip yip     4096 Mar  7 21:36 usr
drwxr-xr-x  4 yip yip     4096 Mar  7 21:36 var

沒有留言:

發佈留言