修改ramdisk文件总结
2015-08-18 21:59
323 查看
简介
本文总结如何对已有的RAMDISK文件进行修改。配置步骤
用户可以在任一Linux发布版本中操作下列步骤,但要求有root权限:创建文件夹rootfs
将initrd.img拷贝到rootfs目录下
重命名initrd.img为initrd.cpio.gz
使用gunzip解压initrd.cpio.gz文件,解压后的文件名为initrd.cpio
使用su命令登录root账户
使用"cpio -idv < initrd.cpio"解压
删除initrd.cpio临时文件
根据需要对解压后的文件进行修改
在root用户下,进入rootfs的根目录,使用"find . | cpio -H newc -o | gzip -9 > ../initrd.img"命令重新打包ramdisk文件,将在rootfs的上级目录生成新的initrd.img文件
注:具体解压的方式与文件的格式(--format)有关,可能与此处示例不同。
命令解析
cpio是用来建立、还原备份档的工具程序,它可以加入、解开cpio或tar备份档内的文件。其常用选项如下:-o :将数据copy到文件或设备上 -i :将数据从文件或设备上还原到系统中 -t :查看cpio建立的文件或设备内容 -c :一种比较新的portableformat方式存储 -v :在屏幕上显示备份过程中的文件名 -B :让预设的blocks可以增加到5120bytes,默认是512bytes,这样可以使备份速度加快 -d :自动建立目录,这样还原时才不会出现找不到路径的问题 -u :更新,用较新的文件覆盖旧的文件 -H : 指定文件格式cpio支持的文件格式如下:
-H, --format=format Use archive format format. The valid formats are listed below with file size limits for individual files in parentheses; the same names are also recognized in all-caps. The default in copy-in mode is to automatically detect the archive format, and in copy-out mode is‘bin’. ‘bin’ The obsolete binary format. (2147483647 bytes) ‘odc’ The old (POSIX.1) portable format. (8589934591 bytes) ‘newc’ The new (SVR4) portable format, which supports file systems having more than 65536 i-nodes. (4294967295 bytes) ‘crc’ The new (SVR4) portable format with a checksum added. ‘tar’ The old tar format. (8589934591 bytes) ‘ustar’ The POSIX.1 tar format. Also recognizes GNU tar archives, which aresimilar but not identical. (8589934591 bytes) ‘hpbin’ The obsolete binary format used by HPUX's cpio (which stores devicefiles differently). ‘hpodc’ The portable format used by HPUX's cpio (which stores device files differently).
相关文章推荐
- Path的配置问题
- 高性能缓存服务器Squid架构配置
- RT-Thread finsh源码分析: finsh_error.c
- Android的五种布局
- Linux压缩包的制作与解压
- 的士
- 2015年8月18日工作日志--------赵鑫
- 2015 7 1 java核心技术 卷1 第6章 接口与内部类
- BZOJ 1698 [Usaco2007 Feb]Lilypad Pond 荷叶池塘 BFS+最短路
- 蓝牙4.0BLE cc2540 cc2541 ios OAD课程(空中固件升级)[原版的,多图]
- scala学习第一章 基础
- 二叉树后续遍历算法
- Android Button
- Objective-C(面向对象的三大特性)
- 转:js-sdk探索之微信网页分享
- Linux用户、用户组
- 常用DOS命令-telnet
- 深度学习:像人脑一样深层次地思考
- 8.18 volley使用https
- 费用流 hdu3376 Matrix Again