Difference between revisions of "cpio notes"

From Noah.org
Jump to: navigation, search
m (Create a cpio archive)
m (Extract a Linux kernel)
Line 33: Line 33:
 
</pre>
 
</pre>
  
Also, often see this; although, this does not have '''newc''' or no absolute filename support. Not sure why this is still used.
+
Also, often see this; although, this does not have '''newc''' or no absolute filename support. Probably not necessary for extraction.
 
<pre>
 
<pre>
 
cpio -id < initrd
 
cpio -id < initrd
 
</pre>
 
</pre>

Revision as of 18:16, 26 February 2014


Create a cpio archive

Note that archive should be outside of the directory tree that is being archived.

find . | cpio -o > ../archive
find . | cpio --create --format='newc' > ../archive

Create a Linux kernel initrd

An initramfs is a root filesystem embedded into the Linux kernel. It is the successor of initrd.

IMPORTANT: Do not use the '-depth' option with `find`!

find . | cpio -o -H newc | gzip > ../initrd.cpio.gz

List the contents of initrd

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

Extract a Linux kernel

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

Also, often see this; although, this does not have newc or no absolute filename support. Probably not necessary for extraction.

cpio -id < initrd