unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Boot-to-Guile!
@ 2013-02-16 11:59 Ludovic Courtès
  2013-02-16 14:49 ` Boot-to-Guile! Mike Gran
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ 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] 5+ 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 17:38   ` Boot-to-Guile! Ludovic Courtès
  2013-02-16 18:34 ` Boot-to-Guile! Aleix Conchillo Flaqué
  2013-02-16 21:54 ` Boot-to-Guile! Mark H Weaver
  2 siblings, 1 reply; 5+ 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] 5+ messages in thread

* Re: Boot-to-Guile!
  2013-02-16 14:49 ` Boot-to-Guile! Mike Gran
@ 2013-02-16 17:38   ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2013-02-16 17:38 UTC (permalink / raw)
  To: Mike Gran; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

Mike Gran <spk121@yahoo.com> skribis:

> Here's a fun message specific to your hack.
>
>   scheme@(guile-user)> (getgroups)
>   ERROR: In procedure getgroups:
>   ERROR: In procedure getgroups: Success

Heh, funny.  :-)

Actually you found a bug, fixed like this:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 463 bytes --]

diff --git a/libguile/posix.c b/libguile/posix.c
index 324f21b..52ade13 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -265,8 +265,10 @@ SCM_DEFINE (scm_getgroups, "getgroups", 0, 0, 0,
   GETGROUPS_T *groups;
 
   ngroups = getgroups (0, NULL);
-  if (ngroups <= 0)
+  if (ngroups < 0)
     SCM_SYSERROR;
+  else if (ngroups == 0)
+    return scm_c_make_vector (0, SCM_BOOL_F);
 
   size = ngroups * sizeof (GETGROUPS_T);
   groups = scm_malloc (size);

[-- Attachment #3: Type: text/plain, Size: 23 bytes --]


Thanks!

Ludo’.

^ permalink raw reply related	[flat|nested] 5+ 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 18:34 ` Aleix Conchillo Flaqué
  2013-02-16 21:54 ` Boot-to-Guile! Mark H Weaver
  2 siblings, 0 replies; 5+ messages in thread
From: Aleix Conchillo Flaqué @ 2013-02-16 18:34 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-user

On Sat, Feb 16, 2013 at 3:59 AM, Ludovic Courtès <ludo@gnu.org> wrote:
> 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
>

Just tried it. Three words: this is fantastic!

Aleix



^ permalink raw reply	[flat|nested] 5+ 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 18:34 ` Boot-to-Guile! Aleix Conchillo Flaqué
@ 2013-02-16 21:54 ` Mark H Weaver
  2 siblings, 0 replies; 5+ 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] 5+ messages in thread

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

Thread overview: 5+ 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 17:38   ` Boot-to-Guile! Ludovic Courtès
2013-02-16 18:34 ` Boot-to-Guile! Aleix Conchillo Flaqué
2013-02-16 21:54 ` Boot-to-Guile! Mark H Weaver

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