如何解压和生成initrd.gz 或 initrd.img总结:
<一>如何解压或是打包mini-rootfs-arm64.cpio.gz?如何解压或是打包mini-rootfs-arm64.cpio.gz?
参考:http://blog.csdn.net/u011774239/article/details/51720817
这种类型的包,是通过cpio和gzip这两步压包获得的,所以解压也需要经过这两步。
一:解压
yaolan@ubuntu3:~/fs/test$ ls
test.cpio.gz
yaolan@ubuntu3:~/fs/test$ gunzip test.cpio.gz
yaolan@ubuntu3:~/fs/test$ ls
test.cpio
yaolan@ubuntu3:~/fs/test$ cpio -idmv < test.cpio
.
root
var
.................
boot
116753 blocks
test@ubuntu3:~/fs/test$ ls
bin dev home lib mnt proc run share test.cpio usr
boot etc init linuxrc opt root sbin sys tmp var
二:压包
test@ubuntu3:~/fs/test$ ls
bin dev home lib mnt proc run share tmp var
boot etc init linuxrc opt root sbin sys usr
test@ubuntu3:~/fs/test$ find ./* | cpio -H newc -o > test.cpio (或者 find ./* | cpio -H tar -o > test.cpio)
116753 blocks
test@ubuntu3:~/fs/test$ ls
bin dev home lib mnt proc run share test.cpio usr
boot etc init linuxrc opt root sbin sys tmp var
test@ubuntu3:~/fs/test$ gzip test.cpio
test@ubuntu3:~/fs/test$ ls
bin dev home lib mnt proc run share test.cpio.gz usr
boot etc init linuxrc opt root sbin sys tmp var
便以可以获取test.cpio.gz.
对于centos用的initrd.img
现在可以用 xzcat initrd.img | cpio -d -i -m 直接将initrd包导出(旧版本的除外)
压包方式:find . | cpio -o -H newc | xz --check=crc32 --lzma2=dict=512KiB > ../initrd.img
其他资料还有:http://dreamfromars.blog.sohu.com/219542655.html