How to unpack an Ubuntu or Fedora initrd file
Hi everyone,
I have read the Landley articles on the web as well as the relevant files under 'Documentation' in the kernel source. I have come to understand ( correct/incorrect ? ) that the 'image' file that is extracted into the 'rootfs' ( which itself is a fixed 'ramfs' filesystem available at boot-time ) by the kernel is a 'cpio' archive containing modules and the 'init' executable to facilitate the kernel's transition into userpace. That all sounds fine and reasonable. But can anyone tell me >how< to actually extract the contents of such a file that comes with one's distro? Assuming an X-ubuntu distro, how does one extract the contents of 'initrd.img-2.6.28-11-generic' for example, to examine what's in it? I have tried various forms of the 'cpio' command i) cpio -t < initrd.img-2.6.28-11-generic ii) cpio -idv < initrd.img-2.6.28-11-generic or even iii) cpio -i -d -H newc -F initrd.img-2.6.28-11-generic --no-absolute-filenames None of the above seem to work. I get: ................. cpio: Malformed number cpio: Malformed number cpio: Malformed number cpio: warning: skipped 14766 bytes of junk cpio: warning: archive header has reverse byte-order ................. as in the case of ii) or: cpio: premature end of file as under iii). a) What am I doing wrong? b) What is wrong in my understanding? c) Can you give me one example of how to correctly unpack and view the contents of one of these files? Regards Reza Mostafid |
Well, actually initrd is compressed and cpio can't handle it.
Try using "file" utility to find out its format and reverse the operations step-by-step. Actually, you need to run gunzip on initrd first. |
yes as raskin said initrd is a gunzip archive try the following
mv initrd-2.6.15-generic initrd-2.6.15-generic.gz gzip -d initrd-2.6.15-generic.gz cpio -i < initrd-2.6.15-generic |
Hi bsat,
Hi raskin, I tried your suggestions and it worked...great many thanks to you for helping me out with this...I had always been curious to look at on eof these things...it's like you helped me scratch an itch. Regards Reza |
All times are GMT -5. The time now is 06:07 AM. |