坑的cpio命令

cpio命令解压缩initramfs,如果不小心,会将操作系统覆盖.

修改方法:加--no-absolute-filenames选项

cpio -id --no-absolute-filenames < initramfs.cpio

原因:cpio命令默认使用cpio里的绝对路径

参考:

http://linux.die.net/man/1/cpio

文中说

' --no-absolute-filenames'
Create all files relative to the current directory in copy-in mode, even if they have an  absolute file name in the archive.
' --absolute-filenames' (default)
Do not strip leading file name components that contain '..' and leading slashes from file names in copy-in mode

你可能感兴趣的:(坑的cpio命令)