:: Re: [DNG] initramfs?
Top Pagina
Delete this message
Reply to this message
Auteur: KatolaZ
Datum:  
Aan: Rainer Weikusat
CC: dng
Onderwerp: Re: [DNG] initramfs?
On Wed, May 18, 2016 at 12:21:11PM +0100, Rainer Weikusat wrote:
> I have to build one of these things as part of packaging 'our' kernel
> (for more streamlined installations, ie, without compiling a dedicated
> kernel for each). I remember reading various criticisms about the
> impenetrable obscurity of the mechanism/ arrangement here in the past
> but so far, it seems reasonably straight-forward to me (the prereq
> arrangement is a bit weird but that's about it).
>
> Is there some hidden booby-trap I'm missing?


You are right Rainer. There is no trap at all, and no witchcraft
involved. Building an initramfs has always been quite
straigthforward. You just put on a directory (DIR) the filesystem you
want to have available before mounting root, which should contain as a
minimum any kernel module needed to mount "/" and a file "/init" which
takes charge of actually mounting "/", (and some utils in /bin, if you
want), and then you create the initrd with a simple:

cd ${DIR}; find ./ | cpio -H newc -o | gzip > initrd.img

where you can also replace "gzip" either with "bzip2" or with "xz"
(the kernel supports also other formats, including LZMA). You can also
start from an existing initrd.img, decompress it:

cd ${DIR}; gunzip -c ${INITRD_ORIG} | cpio -id

trim off all the unnecessary stuff, and repack it back, which is what
I have recently been doing for the initrd images of the minimal Devuan
live images. That's it. Some "complications" may arise if you need to
do strange things before mounting /, which you might not want to do
anyway :)

HND

KatolaZ

--
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]