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
|