unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* Boot-to-Guile!
@ 2013-02-16 11:59 Ludovic Courtès
  2013-02-16 14:49 ` Boot-to-Guile! Mike Gran
  2013-02-16 21:54 ` Boot-to-Guile! Mark H Weaver
  0 siblings, 2 replies; 3+ messages in thread
From: Ludovic Courtès @ 2013-02-16 11:59 UTC (permalink / raw)
  To: guile-user; +Cc: gnu-system-discuss, bug-guix

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Boot-to-Guile!
  2013-02-16 11:59 Boot-to-Guile! Ludovic Courtès
@ 2013-02-16 14:49 ` Mike Gran
  2013-02-16 21:54 ` Boot-to-Guile! Mark H Weaver
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Gran @ 2013-02-16 14:49 UTC (permalink / raw)
  To: Ludovic Courtès, guile-user@gnu.org
  Cc: gnu-system-discuss@gnu.org, bug-guix@gnu.org

> From: Ludovic Courtès <ludo@gnu.org>

> Hello!
> 
> To celebrate Guile 2.0’s second anniversary [0], I’m happy to announce
> this Boot-to-Guile QEMU image!

Amazing.

...

> 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’.  :-)

  scheme@(guile-user)> (scandir "bin")
  $12 = ("." ".." "guile")

Cool.

Here's a fun message specific to your hack.

  scheme@(guile-user)> (getgroups)
  ERROR: In procedure getgroups:
  ERROR: In procedure getgroups: Success

-Mike Gran

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Boot-to-Guile!
  2013-02-16 11:59 Boot-to-Guile! Ludovic Courtès
  2013-02-16 14:49 ` Boot-to-Guile! Mike Gran
@ 2013-02-16 21:54 ` Mark H Weaver
  1 sibling, 0 replies; 3+ messages in thread
From: Mark H Weaver @ 2013-02-16 21:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-user, bug-guix

Wow.  This is very exciting work, Ludovic.
You make our lives brighter :)

      Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-16 21:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-16 11:59 Boot-to-Guile! Ludovic Courtès
2013-02-16 14:49 ` Boot-to-Guile! Mike Gran
2013-02-16 21:54 ` Boot-to-Guile! Mark H Weaver

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).