How to simple create initrd? Question which arise also for me when doing some modifications on rootfs and then need to compress it.
In this article I try to describe how to do it.
You need rootfs or initrd image which you would like to extract.
Extraction:
1. check initrd file:
file initrd-2.6.25.20-0.1-pae
initrd-2.6.25.20-0.1-pae: gzip compressed data, from Unix, last modified: Wed Jan 28 18:51:41 2009, max compression
Image is rootfs compressed with help of gzip and cpio.
2. use command for extraction:
zcat initfs.img |cpio -id --no-absolute-filenames
You need to be root when you perform create/extract actions.
If not then you can get errors because initrd could contain /dev nodes which have root privileges.
Creation:
1. run command in root directory tree which sould be add to initrd image
find |cpio -H newc -o |gzip -c > initfs.img
Note: inird file could be compressed into different filesystems (e.g squashfs …) use then appropriate command to create and extract initrd.
Marek

