MAC OS X, Linux, Windows and other IT Tips and Tricks

18 Nov 14 Inspecting an initrd filesystem

Just in case you need to know the content of the filesystem used by the kernel at boot time (initrd), here is some instructions on how to uncompress it into a temporary directory.

Some explanation:
This initrd file system is a plain file tree structure in a CPIO format compressed by gzip. At boot time, this file tree is normally uncompressed by the kernel and saved inside a ramdisk, which the kernel also creates. It is needed in order for the kernel to do its inital work of booting the system(basic initialization peripherals, disks, etc) by running the bash script ‘init’ located in its root directory. When the process is finished, the kernel mounts the local hard disk partition where the Linux system is located and the control is given to it to do the rest of the booting procedure.

Creation of this initrd:
First the extra special modules that need to be loaded at boot time need to be listed (one module name per line)in:
Dewpending on the content of this configuration file the initrd file structure will be filled with the appropriate tools and modules to do the proper first initialization:
In order to create this initrd image file the following command is used:
One ‘initrd’ file per installed kernel will then be created in the directory:
The command used to then create the proper grub boot menus is:
Here is a small list of commands that you can do to inspect the content of such initrd image.
cd /tmp
cp /boot/initrd.img-2.6.32-5-amd64 initrd.gz
gunzip initrd.gz
mkdir a
cd a
cpio -i <../initrd
ls -la

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: