all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guix-devel@gnu.org
Subject: Re: extending initrd
Date: Mon, 25 Jul 2016 23:48:22 +0200	[thread overview]
Message-ID: <87a8h5e6e1.fsf@gnu.org> (raw)
In-Reply-To: <20160725074606.66hhcgeehmcsv2pf@venom> ("Tomáš Čech"'s message of "Mon, 25 Jul 2016 09:46:06 +0200")

Hi,

Tomáš Čech <sleep_walker@gnu.org> 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’.

      parent reply	other threads:[~2016-07-25 21:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-25  7:46 extending initrd Tomáš Čech
2016-07-25 20:10 ` [PATCH] linux-initrd: Introduce way to add more packages to initrd Tomáš Čech
2016-08-01 10:39   ` Tomáš Čech
2016-08-01 15:44     ` Andy Wingo
2016-08-02  7:43       ` extra-packages - second wave Tomáš Čech
2016-08-02  7:43         ` [PATCH 1/2] linux-initrd: Introduce way to add more packages to initrd Tomáš Čech
2016-08-02  7:43         ` [PATCH 2/2] doc: Document extra-packages argument of base-initrd Tomáš Čech
2016-08-02  8:19           ` Vincent Legoll
2016-08-01 16:09     ` [PATCH] linux-initrd: Introduce way to add more packages to initrd Ludovic Courtès
2016-08-01 18:26       ` Tomáš Čech
2016-08-02 12:53         ` Ludovic Courtès
2016-08-02 18:03           ` Tomáš Čech
2016-07-25 21:48 ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8h5e6e1.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.