From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Boot-to-Guile! Date: Sat, 16 Feb 2013 12:59:13 +0100 Message-ID: <87obfkjwq6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6gQX-0003jN-0G for bug-guix@gnu.org; Sat, 16 Feb 2013 06:59:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6gQV-0000rK-M9 for bug-guix@gnu.org; Sat, 16 Feb 2013 06:59:32 -0500 List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: guile-user@gnu.org Cc: gnu-system-discuss@gnu.org, bug-guix@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello! To celebrate Guile 2.0=E2=80=99s second anniversary [0], I=E2=80=99m happy = to announce this Boot-to-Guile QEMU image! http://www.fdn.fr/~lcourtes/software/guix/boot-to-guile.qcow2 sha1: c796a91be2efcae192a4032c13821c52ea9db07f sig: http://www.fdn.fr/~lcourtes/software/guix/boot-to-guile.qcow2.asc You can run it with: qemu-system-x86_64 qemu-image.qcow2 Or, even better, with networking and an SMB share with the host: qemu-system-x86_64 -net nic,model=3De1000 -net user,smb=3D$PWD \ -hda qemu-image.qcow2 You will be dropped into a familiar & friendly REPL, run straight from the initrd! Neat, no? :-) The build process for this image is automated with GNU Guix (it can be built by calling =E2=80=98example2=E2=80=99 in the (gnu system vm) module.) The initrd in the image contains just a statically-linked Guile and a few Linux modules. So first, to do things one normally do in an initrd, Guile needed to be extended with new procedures: =E2=80=98mount=E2=80=99, = =E2=80=98reboot=E2=80=99, =E2=80=98set-network-interface-address=E2=80=99, etc. [1] Second, the build process of initrd images needed to be automated. So the =E2=80=98expression->initrd=E2=80=99 procedure takes an expression, a l= ist of Linux modules to add to the initrd, and returns an initrd that runs Guile to evaluate the given expression [2]. Third, we need an actual initrd that does useful things at boot time, such as mounting /proc and the host SMB/CIFS share setup by QEMU. The actual code that runs is at [3]. Notice the lovely uses of =E2=80=98load-linux-module=E2=80=99, networking primitives, along with =E2= =80=98start-repl=E2=80=99. :-) Fourth, we need a way to create a disk image, partition it, and install GRUB on it. This requires root privileges on GNU/Linux, so we do it in a VM. The =E2=80=98expression->derivation-in-linux-vm=E2=80=99 runs an exp= ression in a VM running the Linux-Libre kernel, using QEMU=E2=80=99s ability to directly= boot a Linux kernel for that [4]. Finally, the =E2=80=98qemu-image=E2=80=99 procedure builds the final, stand= -alone disk image, with its partition table, GRUB, etc. [5]. A long way! My initial intent for the potluck was actually quite different: I wanted to push Guile in the init process, via the nice dmd released some time ago [6,7]. Something for the next few weeks/months. Guile everywhere! Happy birthday, Guile 2.0! Ludo=E2=80=99. [0] http://lists.gnu.org/archive/html/guile-user/2013-01/msg00007.html [1] http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/patches/gui= le-linux-syscalls.patch [2] http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/linux-initr= d.scm#n41 [3] http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/linux-initr= d.scm#n174 [4] http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system/vm.scm#n43 [5] http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system/vm.scm#n144 [6] http://lists.gnu.org/archive/html/guile-user/2003-04/msg00007.html [7] https://gitorious.org/guix/dmd --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlEfdJcACgkQd92V4upS7PTM3wCeOuPpRfvfMbUxIiGgzvalDsTB WX0An3Ccb2Kc6DEouCPBkLrLiHdQo/vt =DN7B -----END PGP SIGNATURE----- --=-=-=--