guix-devel
[Top][All Lists]
Advanced

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

Re: extending initrd


From: Ludovic Courtès
Subject: Re: extending initrd
Date: Mon, 25 Jul 2016 23:48:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hi,

Tomáš Čech <address@hidden> skribis:

> I'm playing a bit with initrd and I miss there a way, how to add
> additional content to the image (busybox in my case now). Is there
> really no way yet how to do that?

The initrd automatically contains everything the given gexp refers to:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(guix)
scheme@(guile-user)> ,use(gnu system linux-initrd)
scheme@(guile-user)> ,use(gnu packages busybox)
scheme@(guile-user)> ,enter-store-monad
store-monad@(guile-user) [1]> (expression->initrd #~(execl (string-append 
#$busybox "/bin/uname") "uname" "-a"))
$2 = #<derivation /gnu/store/ns4abqm8llcm06r9wg8rrnaj5axvg3la-guile-initrd.drv 
=> /gnu/store/5m2vp3z30b8f9yxv6yqa0x5imssl2qvr-guile-initrd 377cc30>
store-monad@(guile-user) [1]> (built-derivations (list $2))
[...]
--8<---------------cut here---------------end--------------->8---

… and then:

--8<---------------cut here---------------start------------->8---
$ gunzip < /gnu/store/5m2vp3z30b8f9yxv6yqa0x5imssl2qvr-guile-initrd/initrd | 
cpio -tv|grep busybox.*bin/uname
lrwxrwxrwx   1 root     root            7 Jan  1  1970 
./gnu/store/0rgimvxi572zncpr87q3867hkwkfmlva-busybox-1.25.0/bin/uname -> busybox
106143 blocks
--8<---------------cut here---------------end--------------->8---

> In expression->initrd it refers to closure yet I fail to find how is
> it found/constructed...

If you look at the definition of ‘expression->initrd’, you’ll see that
it turns the given gexp into a script using ‘gexp->script’.  In the
example above, said script refers to Busybox, because our expression
refers to Busybox.

Then, ‘expression->initrd’ queries the closure of this script via
#:references-graphs and populates the initrd with exclusively what’s in
that closure.  In this example, the closure includes Busybox and Guile.

Very short introduction, but I hope it helps!

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]