summary refs log tree commit diff
path: root/gnu/build
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/build
parente2b464b7f444743aed5ffc6d9191749c21a0d159 (diff)
downloadguix-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/build')
-rw-r--r--gnu/build/linux-boot.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 56042da8f6..a58232c815 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -340,13 +340,14 @@ bailing out.~%root contents: ~s~%" (scandir "/"))
                       (linux-modules '())
                       qemu-guest-networking?
                       volatile-root?
+                      pre-mount
                       (mounts '()))
   "This procedure is meant to be called from an initrd.  Boot a system by
 first loading LINUX-MODULES (a list of absolute file names of '.ko' files),
 then setting up QEMU guest networking if QEMU-GUEST-NETWORKING? is true,
-mounting the file systems specified in MOUNTS, and finally booting into the
-new root if any.  The initrd supports kernel command-line options '--load',
-'--root', and '--repl'.
+calling PRE-MOUNT, mounting the file systems specified in MOUNTS, and finally
+booting into the new root if any.  The initrd supports kernel command-line
+options '--load', '--root', and '--repl'.
 
 Mount the root file system, specified by the '--root' command-line argument,
 if any.
@@ -403,6 +404,11 @@ to it are lost."
          (mkdir "/root/dev")
          (make-essential-device-nodes #:root "/root"))
 
+       (when (procedure? pre-mount)
+         ;; Do whatever actions are needed before mounting--e.g., installing
+         ;; device mappings.
+         (pre-mount))
+
        ;; Mount the specified file systems.
        (for-each mount-file-system
                  (remove root-mount-point? mounts))