Unable to extract initrd content after removing U-boot header from uInitrd in Ubuntu Headless 11.04 Natty Narwhal for OMAP4 released on 26th April

Asked by smith

Hi,

I have downloaded Ubuntu Headless 11.04 Natty Narwhal released on 16th April 2011 for OMAP4 ( OMAP4 preinstalled headless image) from:

http://cdimage.ubuntu.com/releases/natty/release/

and then zcat it to 4GB Micro SD car as well as on 4GB usb driver.
sudo sh -c 'zcat ubuntu-11.04-preinstalled-headless-armel+omap4.img.gz > /dev/sdc'
Where 'sdY' is the device where the SD card is mapped

After zcat, 2 partition have been created on SD card. First one is Vfat boot partition and 2nd ext3 rootfs partition.

Now i want to see the content of initrd. So i first removed U-boot headers from uInitrd and created initrd using below command:

sumit@sumit-localhost:/media/D6E3-E7A7$ ls -l uInitrd
-rwxr-xr-x 1 sumit sumit 3467529 2011-04-26 05:51 uInitrd

sumit@sumit-localhost:/media/D6E3-E7A7$ mkimage -l uInitrd
Image Name: Ubuntu Initrd
Created: Tue Apr 26 11:21:41 2011
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 3467465 Bytes = 3386.20 kB = 3.31 MB
Load Address: 0x00000000
Entry Point: 0x00000000

The header size is the uInitrd file size minus the data size listed by mkimage. i.e. 3467529 - 3467465 = 64

Then i removed U-boot header from uInitrd as
dd if=uInitrd of=initrd skip=64 bs=1

Now initrd is created which is not in cpio compressed format. i found it is in data format. On doing "file" on created initrd as

sumit@sumit-localhost:/media/D6E3-E7A7$ file initrd
initrd: data

So on doing zcat initrd | cpio -id, it is giving me the error as

sumit@sumit-localhost:/media/D6E3-E7A7$ zcat initrd | cpio -id

gzip: initrd: not in gzip format
cpio: premature end of archive

or on doing sumit@sumit-localhost:/media/D6E3-E7A7$ cpio -id < initrd

cpio: Malformed number
cpio: Malformed number
cpio: Malformed number
cpio: Malformed number
cpio: Malformed number
cpio: Malformed number
cpio: warning: skipped 18927 bytes of junk
cpio: warning: archive header has reverse byte-order
cpio: premature end of file

So is there any way to extract initrd and to view/edit it contents? And for ubuntu headless, initrd created from uInitrd is in "data format" instead of cpio compressed format.

Please suggest me the way to extract initrd for OMAP4 preinstalled ubuntu headless Natty narwhal image.
Thanks...

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Bjarne Steinsbø
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

You may need to extract the image. It is compressed, hence the .gz extension.

Revision history for this message
smith (smithjamadar) said :
#2

Hi actionparsnip,

Thanks for your reply. But it is not satisfied me. Actually i am facing problem in extracting the initrd which is in "data format" not in "cpio cpmpressed gz" format.

I got uInitrd after flashing 26th April "OMAP4 preinstalled headless" image on SD card vfat partition. I removed u-boot headers using below command to initrd. (explained in details in previous description)
dd if=uInitrd of=initrd skip=64 bs=1

Now i am unable to extract initrd because it is not compressed in cpio gz format.

Here is the output of "file" linux command for initrd.
sumit@sumit-localhost:/media/D6E3-E7A7$ file initrd
initrd: data

i tried all possible way to extract initrd but failed.

Please let me know how do i extract initrd or is there a way to get initrd image of ubuntu headless?

Your support will very helpful to me.
Thanks...

Revision history for this message
Best Bjarne Steinsbø (bsteinsbo) said :
#3

It's compressed in xz format. Try uncompressing it using "unrx < initrd > initrd.cpio".

Revision history for this message
Bjarne Steinsbø (bsteinsbo) said :
#4

Sorry.. that should be unxz, not unrx..

Revision history for this message
smith (smithjamadar) said :
#5

Hi Bjarne Steinsbø ,

Thanks a lot.. your command "unxz < initrd > initrd.cpio" is worked. I am able to extract initrd with your help..
I am very thankful to you for your support.

Revision history for this message
smith (smithjamadar) said :
#6

Thanks Bjarne Steinsbø, that solved my question.