How to extract the cpio archive in the kernel image?



Hello,

Does anyone know a simple, command line way to extract the cpio archive embedded in a (compressed) kernel image?

That would be useful to modify the initramfs included in the kernel image even if one only has the kernel binary and sources, but not the initramfs sources.

Of course, it is always possible to get the initramfs contents from the running kernel and dump them somewhere, or to write a custom program for this purpose (accessing and uncompressing the embedded cpio archive as the kernel does), but it would be nice it there was a simpler way with regular Unix commands (I guess involving gunzip and cpio).

In a nutshell, how to open the penguin and still get the golden egg? ;-)

Cheers,

Michael.

--
Michael Opdenacker, Free Electrons
Free Embedded Linux Training Materials
on http://free-electrons.com/training
(More than 1000 pages!)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: klibc and whats the next step?
    ... Well, we already have an initramfs, and it can do quite some stuff the ... current kernel doesn't do. ... Latest suse doesn't use klibc any more. ... After adding the "fsck rootfs" feature we had glibc ...
    (Linux-Kernel)
  • Re: swsusp: allow resume from initramfs
    ... swap device depends on a module that is loaded from initramfs, ... This patch (or the version in the kernel i am running right now at ... PCI Interrupt Link enabled at IRQ 11 ... Probing IDE interface ide0... ...
    (Linux-Kernel)
  • Re: ipw2200 [was Re: RFC: Starting a stable kernel series off the 2.6 kernel]
    ... >> the initramfs initialization earlier in the boot sequence), ... building modular kernel for a test is not *that* much work. ... contains an initramfs that contains binary only firmware. ... As separate files in the same tarball, ...
    (Linux-Kernel)
  • Re: [PATCH] MODULE_FIRMWARE for binary firmware(s)
    ... at least not in the current kernel. ... normal userspace is good enough for me. ... The real question seems to be if we want to keep the firmware inside the ... reason enough to create an initramfs. ...
    (Linux-Kernel)
  • [PATCH] Initramfs docs update.
    ... New section on creating an external initramfs image using cpio, ... +to check for and handle an empty list, it's smaller and simpler for the kernel ... All this differs from the old initrd in several ways: ...
    (Linux-Kernel)