[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Boot-to-Guile!
From: |
Ludovic Courtès |
Subject: |
Boot-to-Guile! |
Date: |
Sat, 16 Feb 2013 12:59:13 +0100 |
User-agent: |
Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) |
Hello!
To celebrate Guile 2.0’s second anniversary [0], I’m 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=e1000 -net user,smb=$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 ‘example2’ 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: ‘mount’, ‘reboot’,
‘set-network-interface-address’, etc. [1]
Second, the build process of initrd images needed to be automated. So
the ‘expression->initrd’ procedure takes an expression, a list 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
‘load-linux-module’, networking primitives, along with ‘start-repl’. :-)
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 ‘expression->derivation-in-linux-vm’ runs an expression in a
VM running the Linux-Libre kernel, using QEMU’s ability to directly boot
a Linux kernel for that [4].
Finally, the ‘qemu-image’ 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’.
[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/guile-linux-syscalls.patch
[2]
http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/linux-initrd.scm#n41
[3]
http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/linux-initrd.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
pgpCFkW6jeF_o.pgp
Description: PGP signature
- Boot-to-Guile!,
Ludovic Courtès <=