:: Re: [DNG] initramfs?
Forside
Slet denne besked
Besvar denne besked
Skribent: aitor_czr
Dato:  
Til: dng
Emne: Re: [DNG] initramfs?
Hi,

On 11/17/2018 02:45 PM, Alessandro Selli wrote:
> On 16/11/18 at 21:01, Simon Hobson wrote:
>> Hendrik Boom<hendrik@???> wrote:
>>
>>> (1) Is initramfs so weird that only one or two people in the world can make one?
>> **AT THE MOMENT** no it isn't. AIUI (and I stand to be corrected) it's simply a CPIO archive that's been (optionally) compressed. So it can be uncompressed, extracted, modified, and rebuilt using standard tools.
>> Also ** at the moment** I can't see that changing since the process that needs to extract that archive at boot time isn't under Poettering's control.
>>
>> As for the future - who knows.
>>
>> Also, echoing another comment, I can't remember ever having to fiddle with the contents of one as a means of fixing a problem.
>>
>   In theory anybody could make their own custom initramfs.  And in
> theory you never have to do it.  In practice i needed to do it several
> times when encrypting the / filesystem became possible, but manually
> hacking the initramfs proves it to be a far different beast than just a
> cpio archive.


Hendrik, you can uncompress the content of the initrd.img by the
following way:

1) Rename it to initrd.gz and use gunzip:

# mv initrd.img initrd.gz
# gunzip initrd.gz

2) After that, you can extract the files using cpio:

# mkdir tmp
# cd tmp
# cpio -id < ../initrd

3) Look at the content (in this case is the initrd.img of debian-installer):

# ls
bin  conf  etc init  lib  sbin  scripts  usr

4) Now you can modify the content of the initrd, and generate the new
initrd in the parent directory:

# find . | cpio --create --format='newc' > ../newinitrd

Compress it with gzip and rename it to initrd.img

And ready :)

Aitor.