cpio notes

From Noah.org
Jump to: navigation, search


Create a cpio archive to create a Linux kernel inited

This shows how to create an initrd. Note that an initramfs is a root filesystem embedded into the Linux kernel. It is the successor of initrd.

Note that inited.cpio should be outside of the directory tree that is being archived. In this case I just assume it is in the directory above the inited.tree.

find initrd.tree | cpio -H newc -o > initrd.cpio
# find initrd.tree | cpio --format=newc --create > initrd.cpio
gzip initrd.cpio
mv initrd.cpio.gz initrd

List the contents of initrd

gunzip --to-stdout /boot/initrd.img-2.6.31-22-server | cpio -t

Extract a Linux kernel

Note that newc format is probably not necessary for extraction.

gunzip --to-stdout /boot/initrd.img-2.6.31-22-server | cpio -i -d -H newc --no-absolute-filenames