From eac026e5c80caae88a6cef317a46007dca343578 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 3 Mar 2018 09:33:34 +0100 Subject: linux-initrd: Add virtio modules to '%base-initrd-modules'. Fixes a regression in installation tests, whereby 'guix system init' would report that virtio modules are missing for the target devices. In practice virtio modules were always available since 'base-initrd' was always called with #:virtio? #t. This commit simply moves them to '%base-initrd-modules' so that 'guix system' knows they're available. Reported by Danny Milosavljevic at . * gnu/system/linux-initrd.scm (default-initrd-modules): Add virtio modules. (base-initrd): Remove #:virtio? and 'virtio-modules'. * gnu/system/vm.scm (expression->derivation-in-linux-vm) (system-qemu-image, virtualized-operating-system): Remove uses of #:virtio?. * doc/guix.texi (Initial RAM Disk): Update 'base-initrd' doc. --- doc/guix.texi | 18 +++++++++--------- gnu/system/linux-initrd.scm | 26 ++++++++++---------------- gnu/system/vm.scm | 9 +-------- 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 70e53b3825..50438f7cb4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19893,18 +19893,18 @@ to it are lost. @deffn {Monadic Procedure} base-initrd @var{file-systems} @ [#:mapped-devices '()] [#:qemu-networking? #f] [#:volatile-root? #f]@ - [#:virtio? #t] [#:extra-modules '()] -Return a monadic derivation that builds a generic initrd. @var{file-systems} is -a list of file systems to be mounted by the initrd like for @code{raw-initrd}. -@var{mapped-devices}, @var{qemu-networking?} and @var{volatile-root?} -also behaves as in @code{raw-initrd}. + [#:linux-modules '()] +Return a monadic derivation that builds a generic initrd, with kernel +modules taken from @var{linux}. @var{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 @code{--root}. @var{mapped-devices} is a list of device +mappings to realize before @var{file-systems} are mounted. -When @var{virtio?} is true, load additional modules so that the -initrd can be used as a QEMU guest with para-virtualized I/O drivers. +@var{qemu-networking?} and @var{volatile-root?} behaves as in @code{raw-initrd}. The initrd is automatically populated with all the kernel modules necessary -for @var{file-systems} and for the given options. However, additional kernel -modules can be listed in @var{extra-modules}. They will be added to the initrd, and +for @var{file-systems} and for the given options. Additional kernel +modules can be listed in @var{linux-modules}. They will be added to the initrd, and loaded at boot time in the order in which they appear. @end deffn diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index 7a7592bf0a..e0cb59c009 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -280,6 +280,11 @@ (define (file-system-modules file-systems) (define* (default-initrd-modules #:optional (system (%current-system))) "Return the list of modules included in the initrd by default." + (define virtio-modules + ;; Modules for Linux para-virtualized devices, for use in QEMU guests. + '("virtio_pci" "virtio_balloon" "virtio_blk" "virtio_net" + "virtio_console")) + `("ahci" ;for SATA controllers "usb-storage" "uas" ;for the installation image etc. "usbhid" "hid-generic" "hid-apple" ;keyboards during early boot @@ -288,7 +293,9 @@ (define* (default-initrd-modules #:optional (system (%current-system))) ,@(if (string-match "^(x86_64|i[3-6]86)-" system) '("pata_acpi" "pata_atiixp" ;for ATA controllers "isci") ;for SAS controllers like Intel C602 - '()))) + '()) + + ,@virtio-modules)) (define-syntax %base-initrd-modules ;; This more closely matches our naming convention. @@ -301,7 +308,6 @@ (define* (base-initrd file-systems (mapped-devices '()) qemu-networking? volatile-root? - (virtio? #t) (extra-modules '()) ;deprecated (on-error 'debug)) "Return a monadic derivation that builds a generic initrd, with kernel @@ -312,25 +318,13 @@ (define* (base-initrd file-systems QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd. -When VIRTIO? is true, load additional modules so the initrd can -be used as a QEMU guest with the root file system on a para-virtualized block -device. - The initrd is automatically populated with all the kernel modules necessary -for FILE-SYSTEMS and for the given options. However, additional kernel -modules can be listed in EXTRA-MODULES. They will be added to the initrd, and +for FILE-SYSTEMS and for the given options. Additional kernel +modules can be listed in LINUX-MODULES. They will be added to the initrd, and loaded at boot time in the order in which they appear." - (define virtio-modules - ;; Modules for Linux para-virtualized devices, for use in QEMU guests. - '("virtio_pci" "virtio_balloon" "virtio_blk" "virtio_net" - "virtio_console")) - (define linux-modules* ;; Modules added to the initrd and loaded from the initrd. `(,@linux-modules - ,@(if (or virtio? qemu-networking?) - virtio-modules - '()) ,@(file-system-modules file-systems) ,@(if volatile-root? '("overlay") diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index db29fd5ce9..91ff32ce9a 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -144,7 +144,6 @@ (define* (expression->derivation-in-linux-vm name exp (base-initrd %linux-vm-file-systems #:linux linux #:linux-modules %base-initrd-modules - #:virtio? #t #:qemu-networking? #t)))) (define builder @@ -513,12 +512,7 @@ (define root-uuid (let ((os (operating-system (inherit os) - ;; Use an initrd with the whole QEMU shebang. - (initrd (lambda (file-systems . rest) - (apply (operating-system-initrd os) - file-systems - #:virtio? #t - rest))) + ;; Assume we have an initrd with the whole QEMU shebang. ;; Force our own root file system. Refer to it by UUID so that ;; it works regardless of how the image is used ("qemu -hda", @@ -615,7 +609,6 @@ (define virtual-file-systems (apply (operating-system-initrd os) file-systems #:volatile-root? #t - #:virtio? #t rest))) ;; Disable swap. -- cgit v1.2.3