aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-11-06 22:58:12 +0100
committerLudovic Courtès <ludo@gnu.org>2014-11-06 22:58:31 +0100
commit3c1f0e3b996ff80aa6fffd572cdee6a95c2b97a5 (patch)
tree619d8e19f97d61c49831378fac9c27b80ffd5ddd /gnu
parent263d05be8ddf0cbb0437a255cc45ca0e878167ae (diff)
downloadgnu-guix-3c1f0e3b996ff80aa6fffd572cdee6a95c2b97a5.tar
gnu-guix-3c1f0e3b996ff80aa6fffd572cdee6a95c2b97a5.tar.gz
vm: Factorize common QEMU options.
* gnu/system/vm.scm (common-qemu-options): New procedure. (system-qemu-image/shared-store-script): Use it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system/vm.scm26
1 files changed, 15 insertions, 11 deletions
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index a962e41555..dc5b1bafd4 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -391,6 +391,17 @@ with the host."
#:register-closures? #f
#:copy-inputs? #f)))
+(define* (common-qemu-options image)
+ "Return the a string-value gexp with the common QEMU options to boot IMAGE."
+#~(string-append
+ " -enable-kvm -no-reboot -net nic,model=virtio \
+ -virtfs local,path=" #$(%store-prefix) ",security_model=none,mount_tag=store \
+ -net user \
+ -serial stdio \
+ -drive file=" #$image
+ ",if=virtio,cache=writeback,werror=report,readonly \
+ -m 256\n"))
+
(define* (system-qemu-image/shared-store-script
os
#:key
@@ -408,18 +419,11 @@ OS that shares its store with the host."
(display
(string-append "#!" #$bash "/bin/sh
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 \
+" -kernel " #$(operating-system-kernel os) "/bzImage \
-initrd " #$os-drv "/initrd \
--append \"" #$(if graphic? "" "console=ttyS0 ")
- "--system=" #$os-drv " --load=" #$os-drv "/boot --root=/dev/vda1\" \
- -serial stdio \
- -drive file=" #$image
- ",if=virtio,cache=writeback,werror=report,readonly \
- -m 256
-\n")
+ -append \"" #$(if graphic? "" "console=ttyS0 ")
+ "--system=" #$os-drv " --load=" #$os-drv "/boot --root=/dev/vda1\" "
+ #$(common-qemu-options image))
port)
(chmod port #o555))))