Difference between revisions of "cpio notes"
From Noah.org
Jump to navigationJump to searchm |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category: Engineering]] | [[Category: Engineering]] | ||
− | == Create a cpio archive == | + | == Create a cpio archive to create a Linux kernel inited == |
− | Note that ''' | + | 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. | |
− | |||
− | |||
<pre> | <pre> | ||
− | find . | cpio -o - | + | 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 | ||
</pre> | </pre> | ||
Line 29: | Line 21: | ||
== Extract a Linux kernel == | == Extract a Linux kernel == | ||
+ | Note that '''newc''' format is probably not necessary for extraction. | ||
<pre> | <pre> | ||
gunzip --to-stdout /boot/initrd.img-2.6.31-22-server | cpio -i -d -H newc --no-absolute-filenames | gunzip --to-stdout /boot/initrd.img-2.6.31-22-server | cpio -i -d -H newc --no-absolute-filenames | ||
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> |
Latest revision as of 18:26, 26 February 2014
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