Editing the initial ramdisk

First of all download the initrd.img file. You can find the 32-bit version here and the 64-bit version here.

Input: file initrd.img
Output: initrd.img: gzip compressed data, from Unix, last modified: Mon Apr 16 11:45:12 2012
As you can see it’s an gzip archive. Extract the content with zcat initrd.img > initrd.cpio

Input: file initrd.cpio
Output: initrd.cpio: ASCII cpio archive (SVR4 with no CRC)
Okay, a cpio archive. Extract the content with: mkdir initrd && cd initrd && cpio -idv < ../initrd.cpio

You can recreate the initrd.cpio file with find . -depth | cpio -ov -H newc > initrd.cpio
Recreate the gzip archive with gzip -cn initrd.cpio > initrd.img