aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-02-27 11:42:09 +0100
committerLudovic Courtès <ludo@gnu.org>2018-03-02 13:53:10 +0100
commitbc499b113a598c0e7863da9887a4133472985713 (patch)
tree5783f2dec99c5b0cd18ef5805fbf07448f4c2143 /gnu
parent615a89e3101b1a512008a3ca3239035674c7d098 (diff)
downloadguix-bc499b113a598c0e7863da9887a4133472985713.tar
guix-bc499b113a598c0e7863da9887a4133472985713.tar.gz
system: Add 'initrd-modules' field.
* gnu/system.scm (<operating-system>)[initrd-modules]: New field. (operating-system-initrd-file): Pass #:linux-modules to 'make-initrd'. * gnu/system/linux-initrd.scm (default-initrd-modules): New procedure. (%base-initrd-modules): New macro. (base-initrd): Add #:linux-modules and honor it. * gnu/system/install.scm (embedded-installation-os): Use 'initrd-modules' instead of 'initrd'. * gnu/tests/install.scm (%raid-root-os): Likewise. * doc/guix.texi (operating-system Reference): Add 'initrd-modules'. (Initial RAM Disk): Document it. Adjust example to not use #:extra-modules.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system.scm7
-rw-r--r--gnu/system/install.scm7
-rw-r--r--gnu/system/linux-initrd.scm34
-rw-r--r--gnu/tests/install.scm11
4 files changed, 36 insertions, 23 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 71beee8259..1bcc1e1384 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -74,6 +74,7 @@
operating-system-kernel
operating-system-kernel-file
operating-system-kernel-arguments
+ operating-system-initrd-modules
operating-system-initrd
operating-system-users
operating-system-groups
@@ -154,6 +155,10 @@ booted from ROOT-DEVICE"
(initrd operating-system-initrd ; (list fs) -> M derivation
(default base-initrd))
+ (initrd-modules operating-system-initrd-modules ; list of strings
+ (thunked) ; it's system-dependent
+ (default %base-initrd-modules))
+
(firmware operating-system-firmware ; list of packages
(default %base-firmware))
@@ -846,6 +851,8 @@ hardware-related operations as necessary when booting a Linux container."
(mlet %store-monad ((initrd (make-initrd boot-file-systems
#:linux (operating-system-kernel os)
+ #:linux-modules
+ (operating-system-initrd-modules os)
#:mapped-devices mapped-devices)))
(return (file-append initrd "/initrd"))))
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index b61660b4b9..37c591ec3a 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
@@ -396,10 +396,7 @@ The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET."
(kernel-arguments
(cons (string-append "console=" tty)
(operating-system-user-kernel-arguments installation-os)))
- (initrd (lambda (fs . rest)
- (apply base-initrd fs
- #:extra-modules extra-modules
- rest)))))
+ (initrd-modules (append extra-modules %base-initrd-modules))))
(define beaglebone-black-installation-os
(embedded-installation-os u-boot-beaglebone-black-bootloader
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 830445ac83..e7f97bb88d 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -43,6 +43,7 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (expression->initrd
+ %base-initrd-modules
raw-initrd
file-system-packages
base-initrd))
@@ -277,14 +278,31 @@ FILE-SYSTEMS."
(append-map (compose file-system-type-modules file-system-type)
file-systems))
+(define* (default-initrd-modules #:optional (system (%current-system)))
+ "Return the list of modules included in the initrd by default."
+ `("ahci" ;for SATA controllers
+ "usb-storage" "uas" ;for the installation image etc.
+ "usbhid" "hid-generic" "hid-apple" ;keyboards during early boot
+ "dm-crypt" "xts" "serpent_generic" "wp512" ;for encrypted root partitions
+ "nls_iso8859-1" ;for `mkfs.fat`, et.al
+ ,@(if (string-match "^(x86_64|i[3-6]86)-" system)
+ '("pata_acpi" "pata_atiixp" ;for ATA controllers
+ "isci") ;for SAS controllers like Intel C602
+ '())))
+
+(define-syntax %base-initrd-modules
+ ;; This more closely matches our naming convention.
+ (identifier-syntax (default-initrd-modules)))
+
(define* (base-initrd file-systems
#:key
(linux linux-libre)
+ (linux-modules '())
(mapped-devices '())
qemu-networking?
volatile-root?
(virtio? #t)
- (extra-modules '())
+ (extra-modules '()) ;deprecated
(on-error 'debug))
"Return a monadic derivation that builds a generic initrd, with kernel
modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
@@ -307,17 +325,9 @@ loaded at boot time in the order in which they appear."
'("virtio_pci" "virtio_balloon" "virtio_blk" "virtio_net"
"virtio_console"))
- (define linux-modules
+ (define linux-modules*
;; Modules added to the initrd and loaded from the initrd.
- `("ahci" ;for SATA controllers
- "usb-storage" "uas" ;for the installation image etc.
- "usbhid" "hid-generic" "hid-apple" ;keyboards during early boot
- "dm-crypt" "xts" "serpent_generic" "wp512" ;for encrypted root partitions
- "nls_iso8859-1" ;for `mkfs.fat`, et.al
- ,@(if (string-match "^(x86_64|i[3-6]86)-" (%current-system))
- '("pata_acpi" "pata_atiixp" ;for ATA controllers
- "isci") ;for SAS controllers like Intel C602
- '())
+ `(,@linux-modules
,@(if (or virtio? qemu-networking?)
virtio-modules
'())
@@ -332,7 +342,7 @@ loaded at boot time in the order in which they appear."
(raw-initrd file-systems
#:linux linux
- #:linux-modules linux-modules
+ #:linux-modules linux-modules*
#:mapped-devices mapped-devices
#:helper-packages helper-packages
#:qemu-networking? qemu-networking?
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 3ac4a579da..e3bb1b46af 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
@@ -565,11 +565,10 @@ where /gnu lives on a separate partition.")
(bootloader grub-bootloader)
(target "/dev/vdb")))
(kernel-arguments '("console=ttyS0"))
- (initrd (lambda (file-systems . rest)
- ;; Add a kernel module for RAID-0 (aka. "stripe").
- (apply base-initrd file-systems
- #:extra-modules '("raid0")
- rest)))
+
+ ;; Add a kernel module for RAID-0 (aka. "stripe").
+ (initrd-modules (cons "raid0" %base-initrd-modules))
+
(mapped-devices (list (mapped-device
(source (list "/dev/vda2" "/dev/vda3"))
(target "/dev/md0")