From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: extending initrd Date: Mon, 25 Jul 2016 23:48:22 +0200 Message-ID: <87a8h5e6e1.fsf@gnu.org> References: <20160725074606.66hhcgeehmcsv2pf@venom> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRnjh-0004Am-VD for guix-devel@gnu.org; Mon, 25 Jul 2016 17:48:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRnjd-0005Le-Rb for guix-devel@gnu.org; Mon, 25 Jul 2016 17:48:28 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57167) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRnjd-0005LE-O0 for guix-devel@gnu.org; Mon, 25 Jul 2016 17:48:25 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:58876 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bRnjd-0003HA-18 for guix-devel@gnu.org; Mon, 25 Jul 2016 17:48:25 -0400 In-Reply-To: <20160725074606.66hhcgeehmcsv2pf@venom> (=?utf-8?B?IlRvbcOh?= =?utf-8?B?xaEgxIxlY2giJ3M=?= message of "Mon, 25 Jul 2016 09:46:06 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Hi, Tom=C3=A1=C5=A1 =C4=8Cech 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 =3D # /gnu/store/5m2vp3z30b8f9yxv6yqa0x5imssl2qvr-guile-initrd 377cc30> store-monad@(guile-user) [1]> (built-derivations (list $2)) [...] --8<---------------cut here---------------end--------------->8--- =E2=80=A6 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/0rgimvxi= 572zncpr87q3867hkwkfmlva-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 =E2=80=98expression->initrd=E2=80=99, you= =E2=80=99ll see that it turns the given gexp into a script using =E2=80=98gexp->script=E2=80=99.= In the example above, said script refers to Busybox, because our expression refers to Busybox. Then, =E2=80=98expression->initrd=E2=80=99 queries the closure of this scri= pt via #:references-graphs and populates the initrd with exclusively what=E2=80=99= s in that closure. In this example, the closure includes Busybox and Guile. Very short introduction, but I hope it helps! Ludo=E2=80=99.