How to edit initrd image

It usefull sometimes to edit the initrd/initramfs image of the system. This howto describes the simple and usual way to do it.

Hint: Mainstream distributions have own mechanisms to do this things. Take a look at mkinitramfs/mkinitrd. In such case your customized image can be overwritten by this tools, so try to do in on the right way;)

If you get something like “ASCII cpio archive (SVR4 with no CRC)” process with working with CPIO archive,
if you get something like “Linux rev 1.0 ext2 filesystem data” process with working with ext2 image