Extracting and repacking an initrd image

If you want to change the contents of an initrd image you need to extract it, make the changes and repack it. This is how you do it.

Open a bash terminal as root. Create a working directory, i will use `initrd`. Then create a directory called `root` in your working directory. Copy the initrd image to your working directory. To extract:

cd root
gzip -cd ../initrd.gz | cpio -i

Make the changes in the root directory

Repack the initrd image.

find | cpio --quiet -o -H newc --owner=0:0 | gzip -c9 -n > ../new_initrd.gz
Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *