Packing and unpacking initrd: Difference between revisions
From Leo's Notes
This page was last edited on 24 February 2017, at 19:13.
No edit summary |
m Text replacement - "<code>" to "{{code|" |
||
| Line 1: | Line 1: | ||
modify | modify {{code|initird.img</code> or other similar images | ||
To extract | To extract {{code|initird.img</code>: | ||
<syntaxhighlight lang="bash" line start="1" enclose="div"> | <syntaxhighlight lang="bash" line start="1" enclose="div"> | ||
# Go to an empty directory before extracting the image. | # Go to an empty directory before extracting the image. | ||
| Line 8: | Line 8: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
To pack files back into | To pack files back into {{code|initrd.img</code> | ||
<syntaxhighlight lang="bash" line start="1" enclose="div"> | <syntaxhighlight lang="bash" line start="1" enclose="div"> | ||
# Go to the directory containing the contents of the image. | # Go to the directory containing the contents of the image. | ||
| Line 15: | Line 15: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
You may want to run | You may want to run {{code|file /path/to/initrd.img</code> in order to determine the exact method of compression. The above commands above assumes {{code|cpio + gzip</code>. | ||
[[Category:Linux]] | [[Category:Linux]] | ||
{{Navbox Linux}} | {{Navbox Linux}} | ||
Revision as of 19:13, 24 February 2017
modify {{code|initird.img or other similar images
To extract {{code|initird.img:
# Go to an empty directory before extracting the image.
mkdir -p /mnt/initrd_extract && cd /mnt/initrd_extract
gzip -dc < /path/to/initrd.img | cpio -i
To pack files back into {{code|initrd.img
# Go to the directory containing the contents of the image.
cd /mnt/initrd_extract
find . | cpio -o -c | gzip -9 > /path/to/initrd.img
You may want to run {{code|file /path/to/initrd.img in order to determine the exact method of compression. The above commands above assumes {{code|cpio + gzip.