diff options
Diffstat (limited to 'gnu/system/linux-initrd.scm')
-rw-r--r-- | gnu/system/linux-initrd.scm | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index 93f751b757..d1b1216f9d 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -126,15 +126,16 @@ initrd code." (define* (base-initrd file-systems #:key + (mapped-devices '()) qemu-networking? virtio? volatile-root? - (extra-modules '()) - guile-modules-in-chroot?) - ;; TODO: Support boot-time device mappings. + (extra-modules '())) "Return a monadic derivation that builds a generic initrd. 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'. +MAPPED-DEVICES is a list of device mappings to realize before FILE-SYSTEMS are +mounted. When QEMU-NETWORKING? is true, set up networking with the standard QEMU parameters. When VIRTIO? is true, load additional modules so the initrd can @@ -146,12 +147,7 @@ to it are lost. 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 -loaded at boot time in the order in which they appear. - -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!)." +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.ko" "virtio_ring.ko" "virtio_pci.ko" @@ -197,6 +193,16 @@ exception and backtrace!)." (list unionfs-fuse/static) '()))) + (define device-mapping-commands + ;; List of gexps to open the mapped devices. + (map (lambda (md) + (let* ((source (mapped-device-source md)) + (target (mapped-device-target md)) + (type (mapped-device-type md)) + (open (mapped-device-kind-open type))) + (open source target))) + mapped-devices)) + (mlet %store-monad ((kodir (flat-linux-module-directory linux-libre linux-modules))) (expression->initrd @@ -211,11 +217,12 @@ exception and backtrace!)." '#$helper-packages))) (boot-system #:mounts '#$(map file-system->spec file-systems) + #:pre-mount (lambda () + (and #$@device-mapping-commands)) #:linux-modules (map (lambda (file) (string-append #$kodir "/" file)) '#$linux-modules) #:qemu-guest-networking? #$qemu-networking? - #:guile-modules-in-chroot? '#$guile-modules-in-chroot? #:volatile-root? '#$volatile-root?)) #:name "base-initrd" #:modules '((guix build utils) |