$ file /boot/initrd.img-2.6.31-22-generic
/boot/initrd.img-2.6.31-22-generic: gzip compressed data, from Unix, last modified: Tue Aug 24 15:48:34 2010, max compression
說明initrd.img-2.6.31-22-generic是gzip包。
Extract方法以下:
$ gzip -dc initrd.img-2.6.31-22-generic | cpio -idv
能夠修改initrd的內容而後repact,好比在打開/init,加入echo "Test modification initrd",而後Repact以下:
$ find . | cpio -H newc -o | gzip -9 > ../initrd.img-2.6.31-22-generic
而後把該文件拷貝到/boot路徑下,測試OK!
注意: cpio的格式須要參考使用的內核文檔,Documentation/initrd.txt,好比個人內核是2.6.31-22,相應文檔指明 -H newc。若是使用不對的格式,可能致使啓動不成功,由於initrd.img不能被識別。ide