使用 cpio 解压文件中要非常注意一点,就是打包的文件是绝对路径时有可能

会覆盖系统路径的文件。那就非常悲催了,比如当前用户有root权限的话,那

你的/bin/ls被会被直接替换成arm的ls,那就这个系统就有的整了。

所以使用cpio时要记得追加下面的选项:

--no-absolute-filenames



用于解压文件到当前目录.



例:


cpio --no-absolute-filenames -idumv < ./initrd.img

对应的参数说明:
`-i'
 `--extract'
      Run in copy-in mode.  *Note Copy-in mode::.`-d'
 `--make-directories'
      Create leading directories where needed.`-u'
 `--unconditional'
      Replace all files, without asking whether to replace existing
      newer files with older files.`-m'
 `--preserve-modification-time'
      Retain previous file modification times when creating files.`-v'
 `--verbose'
      List the files processed, or with `-t', give an `ls -l' style
      table of contents listing.  In a verbose table of contents of a
      ustar archive, user and group names in the archive that do not
      exist on the local system are replaced by the names that
      correspond locally to the numeric UID and GID stored in the
      archive.