summary refs log tree commit diff
path: root/gnu/system/linux-initrd.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-30 06:49:38 +0200
committerLudovic Courtès <ludo@gnu.org>2014-07-01 09:23:32 +0200
commit24e0160a4a319a849a9d48da52883a1979df76f9 (patch)
tree826b8d2793056e0529c13d538b1778c8a825b4e0 /gnu/system/linux-initrd.scm
parentcafc3f5ad76b534662ced753f7f2f07841da6bf4 (diff)
downloadguix-24e0160a4a319a849a9d48da52883a1979df76f9.tar.gz
linux-initrd: Make the virtio kernel modules optional.
* gnu/system/linux-initrd.scm (qemu-initrd): Add #:virtio? parameter.
  Use it.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Pass
  'qemu-initrd' #:virtio?.
  (virtualized-operating-system): Likewise.
Diffstat (limited to 'gnu/system/linux-initrd.scm')
-rw-r--r--gnu/system/linux-initrd.scm18
1 files changed, 13 insertions, 5 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 17fec4f7f4..5e3263e37c 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -203,16 +203,18 @@ initrd code."
 
 (define* (qemu-initrd file-systems
                       #:key
-                      guile-modules-in-chroot?
                       (qemu-networking? #t)
-                      volatile-root?)
+                      virtio?
+                      volatile-root?
+                      guile-modules-in-chroot?)
   "Return a monadic derivation that builds an initrd for use in a QEMU guest
 where the store is shared with the host.  FILE-SYSTEMS is a list of
 file-systems to be mounted by the initrd, possibly in addition to the root
 file system specified on the kernel command line via '--root'.
 
 When QEMU-NETWORKING? is true, set up networking with the standard QEMU
-parameters.
+parameters.  When VIRTIO? is true, load additional modules so the initrd can
+be used as a QEMU guest with para-virtualized I/O drivers.
 
 When VOLATILE-ROOT? is true, the root file system is writable but any changes
 to it are lost.
@@ -221,6 +223,11 @@ When GUILE-MODULES-IN-CHROOT? is true, make core Guile modules available in
 the new root.  This is necessary is the file specified as '--load' needs
 access to these modules (which is the case if it wants to even just print an
 exception and backtrace!)."
+  (define virtio-modules
+    ;; Modules for Linux para-virtualized devices, for use in QEMU guests.
+    '("virtio.ko" "virtio_ring.ko" "virtio_pci.ko"
+      "virtio_balloon.ko" "virtio_blk.ko" "virtio_net.ko"))
+
   (define cifs-modules
     ;; Modules needed to mount CIFS file systems.
     '("md4.ko" "ecb.ko" "cifs.ko"))
@@ -235,8 +242,9 @@ exception and backtrace!)."
 
   (define linux-modules
     ;; Modules added to the initrd and loaded from the initrd.
-    `("virtio.ko" "virtio_ring.ko" "virtio_pci.ko"
-      "virtio_balloon.ko" "virtio_blk.ko" "virtio_net.ko"
+    `(,@(if (or virtio? qemu-networking?)
+            virtio-modules
+            '())
       ,@(if (find (file-system-type-predicate "cifs") file-systems)
             cifs-modules
             '())