On 04/25/2015 at 11:01 PM, Henrique de Moraes Holschuh wrote:

> On Sat, Apr 25, 2015, at 17:16, songbird wrote:
>
>> # cpio -i -v < /boot/initrd.img-3.18.0-trunk-686-pae
>> kernel
>> kernel/x86
>> kernel/x86/microcode
>> kernel/x86/microcode/GenuineIntel.bin
>> 22 blocks
> 
> Yeah, well, you have a multi-segment initramfs. There's an
> uncompressed cpio archive first with the "early initramfs" (used for
> platform firmware such as processor microcode updates and ACPI table
> overrides). It is followed by a compressed cpio archive with the rest
> of the initramfs contents.
> 
> The Linux kernel definition of an initramfs image is: "one or more
> cpio archives, compressed or uncompressed, one after the other. Any
> of these cpio archives can be zero-padded to any lenght, as long as
> it is a multiple of 4". It only supports a very specific subset of
> the possible cpio archive formats, too.
> 
> The kernel doesn't really care if you change compression type, or
> alternate compressed and uncompressed while loading the regular
> initramfs, but the early initramfs MUST be the first segment, and it
> MUST be uncompressed.

Hm. That's informative, thanks.

So how does one manually expand such a multi-segment archive, to examine
and possibly manipulate its contents?

The only method I can think of which seems likely to be effective is to
scan through the file for a gzip-or-suchlike header within the file,
then 'cat' the remainder of the file out to where gunzip can find it,
and proceed from there - but I don't know of any way to do that using
standard tools; if I wanted to try it, I'd have to write code for the
purpose myself.

Presumably appropriate tools do exist, if only within the kernel tree...

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to