방법 1.
- unpack
[root@tutorial img]# cpio -idmv < ./initramfs-6.14.0-63.fc42.x86_64.img
.
early_cpio
kernel
kernel/x86
kernel/x86/microcode
kernel/x86/microcode/AuthenticAMD.bin
kernel/x86/microcode/GenuineIntel.bin
23634 blocks
--> Note - Block Size
[root@tutorial img]# tree kernel/
kernel/
└── x86
└── microcode
├── AuthenticAMD.bin
└── GenuineIntel.bin
3 directories, 2 files
- skip='memo block size' by dd
[root@tutorial img]# dd if=./initramfs-6.14.0-63.fc42.x86_64.img bs=512 skip=23634 of=./inner-initramfs.img
171485+1 records in
171485+1 records out
87800559 bytes (88 MB, 84 MiB) copied, 0.383529 s, 229 MB/s
- uncompress by zstd
[root@tutorial img]# zstd -d -c inner-initramfs.img | cpio -id
zstd: inner-initramfs.img: unsupported format
375319 blocks
- list up inner files in image
[root@tutorial img]# ls -la
total 199888
drwxr-xr-x. 12 root root 440 May 14 11:04 .
drwxrwxrwt. 13 root root 280 May 14 10:50 ..
lrwxrwxrwx. 1 root root 7 May 14 11:04 bin -> usr/bin
drwxr-xr-x. 2 root root 40 May 14 11:04 dev
-rw-r--r--. 1 root root 2 Jan 1 1970 early_cpio
drwxr-xr-x. 15 root root 600 May 14 11:04 etc
lrwxrwxrwx. 1 root root 23 May 14 11:04 init -> usr/lib/systemd/systemd
-rw-r--r--. 1 root root 99901167 May 14 08:20 initramfs-6.14.0-63.fc42.x86_64.img
-rw-r--r--. 1 root root 87800559 May 14 10:55 inner-initramfs.img
lrwxrwxrwx. 1 root root 7 May 14 11:04 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 May 14 11:04 lib64 -> usr/lib64
drwxr-xr-x. 2 root root 40 May 14 11:04 proc
drwxr-xr-x. 2 root root 40 May 14 11:04 root
drwxr-xr-x. 2 root root 40 May 14 11:04 run
lrwxrwxrwx. 1 root root 8 May 14 11:04 sbin -> usr/sbin
-rwxr-xr-x. 1 root root 4784 May 14 11:04 shutdown
drwxr-xr-x. 2 root root 40 May 14 11:04 sys
drwxr-xr-x. 2 root root 40 May 14 11:04 sysroot
drwxr-xr-x. 2 root root 40 May 14 11:04 tmp
drwxr-xr-x. 7 root root 180 May 14 11:04 usr
drwxr-xr-x. 4 root root 120 May 14 11:04 var
-rwxr-xr-x. 1 root root 16968040 May 14 08:20 vmlinuz-6.14.0-63.fc42.x86_64
방법 2.
[root@tutorial img]# /usr/lib/dracut/skipcpio ./initramfs-6.14.0-63.fc42.x86_64.img | zstd -d -c | cpio -id
[root@tutorial img]# ls -la
total 199888
drwxr-xr-x. 12 root root 440 May 14 11:04 .
drwxrwxrwt. 13 root root 280 May 14 10:50 ..
lrwxrwxrwx. 1 root root 7 May 14 11:04 bin -> usr/bin
drwxr-xr-x. 2 root root 40 May 14 11:04 dev
-rw-r--r--. 1 root root 2 Jan 1 1970 early_cpio
drwxr-xr-x. 15 root root 600 May 14 11:04 etc
lrwxrwxrwx. 1 root root 23 May 14 11:04 init -> usr/lib/systemd/systemd
-rw-r--r--. 1 root root 99901167 May 14 08:20 initramfs-6.14.0-63.fc42.x86_64.img
lrwxrwxrwx. 1 root root 7 May 14 11:04 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 May 14 11:04 lib64 -> usr/lib64
drwxr-xr-x. 2 root root 40 May 14 11:04 proc
drwxr-xr-x. 2 root root 40 May 14 11:04 root
drwxr-xr-x. 2 root root 40 May 14 11:04 run
lrwxrwxrwx. 1 root root 8 May 14 11:04 sbin -> usr/sbin
-rwxr-xr-x. 1 root root 4784 May 14 11:04 shutdown
drwxr-xr-x. 2 root root 40 May 14 11:04 sys
drwxr-xr-x. 2 root root 40 May 14 11:04 sysroot
drwxr-xr-x. 2 root root 40 May 14 11:04 tmp
drwxr-xr-x. 7 root root 180 May 14 11:04 usr
drwxr-xr-x. 4 root root 120 May 14 11:04 var
-rwxr-xr-x. 1 root root 16968040 May 14 08:20 vmlinuz-6.14.0-63.fc42.x86_64
-> skipcpio 스크립트가 내부적으로 dd block skip 과정을 포함하여 unpack 해줌
Unpack - CoreOS Kernel Image (initramfs)