From: ludo@gnu.org (Ludovic Courtès)
To: guile-user@gnu.org
Cc: gnu-system-discuss@gnu.org, bug-guix@gnu.org
Subject: Boot-to-Guile!
Date: Sat, 16 Feb 2013 12:59:13 +0100 [thread overview]
Message-ID: <87obfkjwq6.fsf@gnu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2959 bytes --]
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
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next reply other threads:[~2013-02-16 11:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-16 11:59 Ludovic Courtès [this message]
2013-02-16 14:49 ` Boot-to-Guile! Mike Gran
2013-02-16 21:54 ` Boot-to-Guile! Mark H Weaver
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87obfkjwq6.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=bug-guix@gnu.org \
--cc=gnu-system-discuss@gnu.org \
--cc=guile-user@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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).