summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-05-04 00:30:39 +0200
committerLudovic Courtès <ludo@gnu.org>2014-05-04 00:30:39 +0200
commit3c05b4bc2528ea64b259477bf58dbcc6a7739f78 (patch)
tree61c374472fd7926f09734b41d216a6a08b405122 /gnu
parentad896f23a5fac38294e7515587c0c5bda02e9a59 (diff)
downloadguix-3c05b4bc2528ea64b259477bf58dbcc6a7739f78.tar.gz
linux-initrd: Check the root and other early file systems.
* gnu/system.scm (operating-system-derivation)[boot-file-systems]: Keep "/".
* gnu/system/linux-initrd.scm (file-system->spec): Keep the 'check?'
  flag.
  (qemu-initrd)[helper-packages]: New variable.  Pass it as #:to-copy.
  <gexp>: Add 'set-path-environment-variable' call.  Remove #:unionfs
  argument for 'boot-system'.
* gnu/system/vm.scm (%linux-vm-file-systems): Add 'check?' field/
  (virtualized-operating-system): Likewise for the "9p" file system.
* guix/build/linux-initrd.scm (mount-root-file-system): Change #:unionfs
  default.  Call 'check-file-system' before mounting ROOT, when
  VOLATILE-ROOT? is false.
  (check-file-system): New procedure.
  (mount-file-system): Honor 'check?' element in list; add
  'check-file-system' call.
  (boot-system): Remove #:root-fs-type and #:unionfs parameters.
  [root-mount-point?, root-fs-type]: New variables.
  Call 'mount-file-system' on all MOUNTS but "/".
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system.scm6
-rw-r--r--gnu/system/linux-initrd.scm27
-rw-r--r--gnu/system/vm.scm9
3 files changed, 30 insertions, 12 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 7624b10ae4..65d1ca3418 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -349,8 +349,10 @@ we're running in the final root."
   "Return a derivation that builds OS."
   (define boot-file-systems
     (filter (match-lambda
-             (($ <file-system> device mount-point type _ _ boot?)
-              (and boot? (not (string=? mount-point "/")))))
+             (($ <file-system> device "/")
+              #t)
+             (($ <file-system> device mount-point type flags options boot?)
+              boot?))
             (operating-system-file-systems os)))
 
   (mlet* %store-monad
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 8b4ab9c4eb..749dfa313f 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -198,8 +198,8 @@ a list of Guile module names to be embedded in the initrd."
   "Return a list corresponding to file-system FS that can be passed to the
 initrd code."
   (match fs
-    (($ <file-system> device mount-point type flags options)
-     (list device mount-point type flags options))))
+    (($ <file-system> device mount-point type flags options _ check?)
+     (list device mount-point type flags options check?))))
 
 (define* (qemu-initrd file-systems
                       #:key
@@ -243,24 +243,37 @@ exception and backtrace!)."
             '("fuse.ko")
             '())))
 
+  (define helper-packages
+    ;; Packages to be copied on the initrd.
+    `(,@(if (find (lambda (fs)
+                    (string-prefix? "ext" (file-system-type fs)))
+                  file-systems)
+            (list e2fsck/static)
+            '())
+      ,@(if volatile-root?
+            (list unionfs-fuse/static)
+            '())))
+
   (expression->initrd
    #~(begin
        (use-modules (guix build linux-initrd)
+                    (guix build utils)
                     (srfi srfi-26))
 
+       (with-output-to-port (%make-void-port "w")
+         (lambda ()
+           (set-path-environment-variable "PATH" '("bin" "sbin")
+                                          '#$helper-packages)))
+
        (boot-system #:mounts '#$(map file-system->spec file-systems)
                     #:linux-modules '#$linux-modules
                     #:qemu-guest-networking? #t
                     #:guile-modules-in-chroot? '#$guile-modules-in-chroot?
-                    #:unionfs (and=> #$(and volatile-root? unionfs-fuse/static)
-                                     (cut string-append <> "/bin/unionfs"))
                     #:volatile-root? '#$volatile-root?))
    #:name "qemu-initrd"
    #:modules '((guix build utils)
                (guix build linux-initrd))
-   #:to-copy (if volatile-root?
-                 (list unionfs-fuse/static)
-                 '())
+   #:to-copy helper-packages
    #:linux linux-libre
    #:linux-modules linux-modules))
 
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 786e564031..b20831f44d 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -90,13 +90,15 @@ input tuple.  The output file name is when building for SYSTEM."
           (device "store")
           (type "9p")
           (needed-for-boot? #t)
-          (options "trans=virtio"))
+          (options "trans=virtio")
+          (check? #f))
         (file-system
           (mount-point "/xchg")
           (device "xchg")
           (type "9p")
           (needed-for-boot? #t)
-          (options "trans=virtio"))))
+          (options "trans=virtio")
+          (check? #f))))
 
 (define* (expression->derivation-in-linux-vm name exp
                                              #:key
@@ -333,7 +335,8 @@ environment with the store shared with the host."
                           (device "store")
                           (type "9p")
                           (needed-for-boot? #t)
-                          (options "trans=virtio"))))))
+                          (options "trans=virtio")
+                          (check? #f))))))
 
 (define* (system-qemu-image/shared-store
           os