Extracting content from the file uInitrd

In uInitrd file there is a kernel file system of some system as a rule.

If you check the file information using the standard utility linux - file you can see like that shown below:

$ file uInitrd 
uInitrd: u-boot legacy uImage, debian-installer ramdisk, Linux/ARM, RAMDisk Image (gzip), 19068823 bytes, Thu Apr 24 12:07:39 2014, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0x7CC7FE2B, Data CRC: 0x1847C3DF

The file is an image of ramdisk created using mkimage:

$ mkimage -l ./uInitrd 
Image Name:   debian-installer ramdisk
Created:      Thu Apr 24 12:03:25 2014
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    4839295 Bytes = 4725.87 kB = 4.62 MB
Load Address: 00000000
Entry Point:  00000000

The utility mkimage adds its header to the beginning of the file that should be deleted. The header can be deleted as shown below:

$ dd if=./uInitrd of=initrd skip=64 bs=1

Let's check the created file using the utility file:

$ file initrd 
initrd: gzip compressed data, was "initrd", from Unix, last modified: Thu Apr 24 12:03:14 2014, max compression

Let's try to unzip the file:

$ gunzip initrd
gzip: initrd: unknown suffix -- ignored

It's not working out because of the file extension. It is to be gz. Let's correct it as shown below:

$ mv initrd initrd.gz
$ gunzip initrd.gz 

Let's check the information of the extracted file:

$ file initrd 
initrd: ASCII cpio archive (SVR4 with no CRC)

For data extracting from the cpio archive we can use the following command:

$ cpio -i -F initrd

Or we can click right mouse button on the file and then "Extract here"