summaryrefslogtreecommitdiff
path: root/gnu/system/linux-initrd.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-22 11:06:42 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-22 11:20:41 +0200
commitde1c158f32e1d4060daa600a62b68fe22b613424 (patch)
tree5b1d35a3d17a2d5bb0083ce7ee8edd45132dd2e9 /gnu/system/linux-initrd.scm
parente2b464b7f444743aed5ffc6d9191749c21a0d159 (diff)
downloadpatches-de1c158f32e1d4060daa600a62b68fe22b613424.tar
patches-de1c158f32e1d4060daa600a62b68fe22b613424.tar.gz
system: Add support for boot-time mapped devices.
* gnu/build/linux-boot.scm (boot-system): Add #:pre-mount parameter and honor it. * gnu/system/linux-initrd.scm (base-initrd): Add #:mapped-devices parameter. Add 'device-mapping-commands' variable, and use it to build the #:pre-mount argument of 'boot-system'. * gnu/system.scm (mapped-device-user, operating-system-user-mapped-devices, operating-system-boot-mapped-devices): New procedures. (device-mapping-services): Use 'operating-system-user-mapped-devices' instead of 'operating-system-mapped-devices'. (operating-system-initrd-file): Call the initrd with #:mapped-devices.
Diffstat (limited to 'gnu/system/linux-initrd.scm')
-rw-r--r--gnu/system/linux-initrd.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index cb04644053..d1b1216f9d 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -126,14 +126,16 @@ initrd code."
(define* (base-initrd file-systems
#:key
+ (mapped-devices '())
qemu-networking?
virtio?
volatile-root?
(extra-modules '()))
- ;; TODO: Support boot-time device mappings.
"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
@@ -191,6 +193,16 @@ loaded at boot time in the order in which they appear."
(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
@@ -205,6 +217,8 @@ loaded at boot time in the order in which they appear."
'#$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)