diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2015-09-20 21:44:39 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2015-09-20 22:05:36 +0200 |
| commit | cc0e575a94a4e22a0bf2bf1b0c7b0514f1c1fbb5 (patch) | |
| tree | e60e25cc56f7c12b869889ec486228656f5dd696 /gnu/build/linux-boot.scm | |
| parent | 7ee5db15bfa336bb0472669b29eeb2c3b99449b8 (diff) | |
linux-boot: Mount /dev as a devtmpfs from the start.
Suggested by Petter <petter@mykolab.ch>
and Mark H Weaver <mhw@netris.org>.
Reported by Duncan Keall <duncan@duncankeall.com>.
Partly fixes <http://bugs.gnu.org/19190> by populating /dev/mapper
early enough.
* gnu/build/linux-boot.scm (mount-essential-file-systems): Mount /dev as
a devtmpfs.
(move-essential-file-systems): Add /dev.
(mount-root-file-system): Mount /rw-root/dev as a devtmpfs instead of
calling 'make-essential-device-nodes'.
(boot-system): Remove call to 'make-essential-device-nodes'.
* gnu/system/file-systems.scm (%devtmpfs-file-system): Remove.
* doc/guix.texi (File Systems): Adjust accordingly.
Diffstat (limited to 'gnu/build/linux-boot.scm')
| -rw-r--r-- | gnu/build/linux-boot.scm | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index 3081a93a975..30d6570b043 100644 --- a/gnu/build/linux-boot.scm +++ b/gnu/build/linux-boot.scm | |||
| @@ -48,7 +48,7 @@ | |||
| 48 | ;;; Code: | 48 | ;;; Code: |
| 49 | 49 | ||
| 50 | (define* (mount-essential-file-systems #:key (root "/")) | 50 | (define* (mount-essential-file-systems #:key (root "/")) |
| 51 | "Mount /proc and /sys under ROOT." | 51 | "Mount /dev, /proc, and /sys under ROOT." |
| 52 | (define (scope dir) | 52 | (define (scope dir) |
| 53 | (string-append root | 53 | (string-append root |
| 54 | (if (string-suffix? "/" root) | 54 | (if (string-suffix? "/" root) |
| @@ -60,6 +60,10 @@ | |||
| 60 | (mkdir (scope "proc"))) | 60 | (mkdir (scope "proc"))) |
| 61 | (mount "none" (scope "proc") "proc") | 61 | (mount "none" (scope "proc") "proc") |
| 62 | 62 | ||
| 63 | (unless (file-exists? (scope "dev")) | ||
| 64 | (mkdir (scope "dev"))) | ||
| 65 | (mount "none" (scope "dev") "devtmpfs") | ||
| 66 | |||
| 63 | (unless (file-exists? (scope "sys")) | 67 | (unless (file-exists? (scope "sys")) |
| 64 | (mkdir (scope "sys"))) | 68 | (mkdir (scope "sys"))) |
| 65 | (mount "none" (scope "sys") "sysfs")) | 69 | (mount "none" (scope "sys") "sysfs")) |
| @@ -71,7 +75,7 @@ | |||
| 71 | (unless (file-exists? target) | 75 | (unless (file-exists? target) |
| 72 | (mkdir target)) | 76 | (mkdir target)) |
| 73 | (mount dir target "" MS_MOVE))) | 77 | (mount dir target "" MS_MOVE))) |
| 74 | '("/proc" "/sys"))) | 78 | '("/dev" "/proc" "/sys"))) |
| 75 | 79 | ||
| 76 | (define (linux-command-line) | 80 | (define (linux-command-line) |
| 77 | "Return the Linux kernel command line as a list of strings." | 81 | "Return the Linux kernel command line as a list of strings." |
| @@ -100,7 +104,7 @@ with the given MAJOR number, starting with MINOR." | |||
| 100 | 104 | ||
| 101 | (define* (make-essential-device-nodes #:key (root "/")) | 105 | (define* (make-essential-device-nodes #:key (root "/")) |
| 102 | "Make essential device nodes under ROOT/dev." | 106 | "Make essential device nodes under ROOT/dev." |
| 103 | ;; The hand-made udev! | 107 | ;; The hand-made devtmpfs/udev! |
| 104 | 108 | ||
| 105 | (define (scope dir) | 109 | (define (scope dir) |
| 106 | (string-append root | 110 | (string-append root |
| @@ -255,7 +259,8 @@ UNIONFS." | |||
| 255 | (mount "none" "/rw-root" "tmpfs") | 259 | (mount "none" "/rw-root" "tmpfs") |
| 256 | 260 | ||
| 257 | ;; We want read-write /dev nodes. | 261 | ;; We want read-write /dev nodes. |
| 258 | (make-essential-device-nodes #:root "/rw-root") | 262 | (mkdir-p "/rw-root/dev") |
| 263 | (mount "none" "/rw-root/dev" "devtmpfs") | ||
| 259 | 264 | ||
| 260 | ;; Make /root a union of the tmpfs and the actual root. Use | 265 | ;; Make /root a union of the tmpfs and the actual root. Use |
| 261 | ;; 'max_files' to set a high RLIMIT_NOFILE for the unionfs process | 266 | ;; 'max_files' to set a high RLIMIT_NOFILE for the unionfs process |
| @@ -385,9 +390,6 @@ to it are lost." | |||
| 385 | (unless (configure-qemu-networking) | 390 | (unless (configure-qemu-networking) |
| 386 | (display "network interface is DOWN\n"))) | 391 | (display "network interface is DOWN\n"))) |
| 387 | 392 | ||
| 388 | ;; Make /dev nodes. | ||
| 389 | (make-essential-device-nodes) | ||
| 390 | |||
| 391 | ;; Prepare the real root file system under /root. | 393 | ;; Prepare the real root file system under /root. |
| 392 | (unless (file-exists? "/root") | 394 | (unless (file-exists? "/root") |
| 393 | (mkdir "/root")) | 395 | (mkdir "/root")) |
| @@ -405,10 +407,6 @@ to it are lost." | |||
| 405 | #:volatile-root? volatile-root?) | 407 | #:volatile-root? volatile-root?) |
| 406 | (mount "none" "/root" "tmpfs")) | 408 | (mount "none" "/root" "tmpfs")) |
| 407 | 409 | ||
| 408 | (unless (file-exists? "/root/dev") | ||
| 409 | (mkdir "/root/dev") | ||
| 410 | (make-essential-device-nodes #:root "/root")) | ||
| 411 | |||
| 412 | ;; Mount the specified file systems. | 410 | ;; Mount the specified file systems. |
| 413 | (for-each mount-file-system | 411 | (for-each mount-file-system |
| 414 | (remove root-mount-point? mounts)) | 412 | (remove root-mount-point? mounts)) |
