[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using initrd as livefs_root



Hi Daniel,

On Thu, 18 May 2017 14:12:46 +0200
Daniel Lindgren <bd.dali@gmail.com> wrote:

> Since then I've used live-build in Debian 7 to build images, manually
> unpacked initrd.img, added filesystem.squashfs and repacked
> initrd.img.
> (...)
> I installed Debian 8.8 and tried to use the same method as before,
> but the initrd.img file seems to be a concatenation of several cpio
> archives and I can't seem to repack it succesfully. I've googled for
> a solution, haven't found one.

I think this should still work and you can use the fact that the
initramfs can contain multiple cpio archives [1] (as you have noticed)
to avoid repacking altogether.

I suggest you create an additional cpio archive (newc format) which
just contains the filesystem.squashfs file (in the appropriate folder)
and nothing else. 

Now you have multiple options:

1. Most bootloaders have an option of specifying more than one file as
   initramfs; just try adding your cpio archive as a second file (check
   your bootloader's documentation).

2. Alternatively you can compress the new archive and append that to
   the existing initrd, using something like

       gzip --fast -c YOURARCHIVE.cpio >> initrd.img

3. You can do the same as (2) without the compression (which makes
   more sense since the squashfs file is already compressed), but then
   you might have to add null bytes to initrd.img first so the archive
   is properly aligned (see [1])


I hope that helps.

Regards
Lukas

[1] https://www.kernel.org/doc/Documentation/early-userspace/buffer-format.txt

Attachment: pgp31M82LAuil.pgp
Description: OpenPGP digital signature


Reply to: