cpio打包和压包*.cpio.gz操作方法示例

如何解压或是打包mini-rootfs-arm64.cpio.gz?

这种类型的包,是通过cpio和gzip这两步压包获得的,所以解压也需要经过这两步。

一:解压
yaolan@ubuntu3:~/fs/test$
yaolan@ubuntu3:~/fs/test$ ls
test.cpio.gz
yaolan@ubuntu3:~/fs/test$
yaolan@ubuntu3:~/fs/test$
yaolan@ubuntu3:~/fs/test$ gunzip test.cpio.gz
yaolan@ubuntu3:~/fs/test$
yaolan@ubuntu3:~/fs/test$ ls
test.cpio
yaolan@ubuntu3:~/fs/test$
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$
test@ubuntu3:~/fs/test$

二:压包
例如:打包test目录下
test@ubuntu3:~/fs/test$
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$
test@ubuntu3:~/fs/test$ find ./* | cpio -H newc -o > test.cpio (或者 find ./* | cpio -H tar -o > test.cpio)
116753 blocks
test@ubuntu3:~/fs/test$
test@ubuntu3:~/fs/test$
test@ubuntu3:~/fs/test$
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$
test@ubuntu3:~/fs/test$
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@ubuntu3:~/fs/test$
便以可以获取test.cpio.gz.

猜你喜欢

转载自blog.csdn.net/qq_38350702/article/details/112790138