summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-04-14 23:59:08 +0200
committerLudovic Courtès <ludo@gnu.org>2014-04-14 23:59:08 +0200
commit1c96c1bbabb9646aba2a3860cac02157f56c4dd1 (patch)
tree7dfcfaaa6580404a1fe774b6c4c28edc9c984ec8 /guix
parent0b7a0c2030fe85fc54f428e1d874017d4072eead (diff)
downloadgnu-guix-1c96c1bbabb9646aba2a3860cac02157f56c4dd1.tar
gnu-guix-1c96c1bbabb9646aba2a3860cac02157f56c4dd1.tar.gz
linux-initrd: Mount / as a unionfs when asking for a volatile root.
* guix/build/linux-initrd.scm (make-essential-device-nodes): Make /dev/fuse. (boot-system): Add #:unionfs parameter. Invoke UNIONFS instead of copying files over when VOLATILE-ROOT? is true. * gnu/system/linux-initrd.scm (expression->initrd): Add #:inputs parameter. [files-to-copy]: New procedure. [builder]: Add 'to-copy' parameter; honor it. (qemu-initrd)[linux-modules]: Add 'fuse.ko' when VOLATILE-ROOT?. Pass UNIONFS-FUSE/STATIC as #:inputs; change builder to pass #:unionfs to 'boot-system'.
Diffstat (limited to 'guix')
-rw-r--r--guix/build/linux-initrd.scm38
1 files changed, 17 insertions, 21 deletions
diff --git a/guix/build/linux-initrd.scm b/guix/build/linux-initrd.scm
index 61d4304b65..5d4446e720 100644
--- a/guix/build/linux-initrd.scm
+++ b/guix/build/linux-initrd.scm
@@ -143,7 +143,10 @@
(symlink "/proc/self/fd" (scope "dev/fd"))
(symlink "/proc/self/fd/0" (scope "dev/stdin"))
(symlink "/proc/self/fd/1" (scope "dev/stdout"))
- (symlink "/proc/self/fd/2" (scope "dev/stderr")))
+ (symlink "/proc/self/fd/2" (scope "dev/stderr"))
+
+ ;; File systems in user space (FUSE).
+ (mknod (scope "dev/fuse") 'char-special #o666 (device-number 10 229)))
(define %host-qemu-ipv4-address
(inet-pton AF_INET "10.0.2.10"))
@@ -212,7 +215,7 @@ the last argument of `mknod'."
(linux-modules '())
qemu-guest-networking?
guile-modules-in-chroot?
- volatile-root?
+ volatile-root? unionfs
(mounts '()))
"This procedure is meant to be called from an initrd. Boot a system by
first loading LINUX-MODULES, then setting up QEMU guest networking if
@@ -277,27 +280,20 @@ to it are lost."
(lambda ()
(if volatile-root?
(begin
- ;; XXX: For lack of a union file system...
(mkdir-p "/real-root")
(mount root "/real-root" "ext3" MS_RDONLY)
- (mount "none" "/root" "tmpfs")
-
- ;; XXX: 'copy-recursively' cannot deal with device nodes, so
- ;; explicitly avoid /dev.
- (for-each (lambda (file)
- (unless (string=? "dev" file)
- (copy-recursively (string-append "/real-root/"
- file)
- (string-append "/root/"
- file)
- #:log (%make-void-port
- "w"))))
- (scandir "/real-root"
- (lambda (file)
- (not (member file '("." ".."))))))
-
- ;; TODO: Unmount /real-root.
- )
+ (mkdir-p "/rw-root")
+ (mount "none" "/rw-root" "tmpfs")
+
+ ;; We want read-write /dev nodes.
+ (make-essential-device-nodes #:root "/rw-root")
+
+ ;; Make /root a union of the tmpfs and the actual root.
+ (unless (zero? (system* unionfs "-o"
+ "cow,allow_other,use_ino,dev"
+ "/rw-root=RW:/real-root=RO"
+ "/root"))
+ (error "unionfs failed")))
(mount root "/root" "ext3")))
(lambda args
(format (current-error-port) "exception while mounting '~a': ~s~%"