From 66670cf39c2f3d294edf3596d8a9173e5289f3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 13 Jul 2014 16:07:26 +0200 Subject: [PATCH] vm: Add support for i686. Partially fixes . Reported by David Thompson . * guix/build/vm.scm (qemu-command): Add optional 'system' parameter. Special-case "^i[3456]86$". * gnu/system/vm.scm (system-qemu-image/shared-store-script): Use it. --- gnu/system/vm.scm | 5 ++++- guix/build/vm.scm | 18 +++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index a90b24305d..ab3997bd5d 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -23,6 +23,8 @@ #:use-module (guix derivations) #:use-module (guix packages) #:use-module (guix monads) + #:use-module ((guix build vm) + #:select (qemu-command)) #:use-module ((gnu packages base) #:select (%final-inputs)) #:use-module (gnu packages guile) @@ -414,7 +416,8 @@ OS that shares its store with the host." (lambda (port) (display (string-append "#!" #$bash "/bin/sh -exec " #$qemu "/bin/qemu-system-x86_64 -enable-kvm -no-reboot -net nic,model=virtio \ +exec " #$qemu "/bin/" #$(qemu-command (%current-system)) +" -enable-kvm -no-reboot -net nic,model=virtio \ -virtfs local,path=" #$(%store-prefix) ",security_model=none,mount_tag=store \ -net user \ -kernel " #$(operating-system-kernel os) "/bzImage \ diff --git a/guix/build/vm.scm b/guix/build/vm.scm index 805ce10bf9..11e05f70be 100644 --- a/guix/build/vm.scm +++ b/guix/build/vm.scm @@ -21,10 +21,12 @@ #:use-module (guix build linux-initrd) #:use-module (guix build install) #:use-module (ice-9 match) + #:use-module (ice-9 regex) #:use-module (ice-9 rdelim) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) - #:export (load-in-linux-vm + #:export (qemu-command + load-in-linux-vm format-partition initialize-root-partition initialize-partition-table @@ -37,12 +39,14 @@ ;;; ;;; Code: -(define (qemu-command) - "Return the default name of the QEMU command for the current host." - (string-append "qemu-system-" - (substring %host-type 0 - (string-index %host-type #\-)))) - +(define* (qemu-command #:optional (system %host-type)) + "Return the default name of the QEMU command for SYSTEM." + (let ((cpu (substring %host-type 0 + (string-index %host-type #\-)))) + (string-append "qemu-system-" + (if (string-match "^i[3456]86$" cpu) + "i386" + cpu)))) (define* (load-in-linux-vm builder #:key