mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
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.
This commit is contained in:
parent
7ee5db15bf
commit
cc0e575a94
3 changed files with 11 additions and 31 deletions
|
@ -5295,16 +5295,11 @@ variables.
|
|||
|
||||
@defvr {Scheme Variable} %base-file-systems
|
||||
These are essential file systems that are required on normal systems,
|
||||
such as @var{%devtmpfs-file-system} and @var{%immutable-store} (see
|
||||
such as @var{%pseudo-terminal-file-system} and @var{%immutable-store} (see
|
||||
below.) Operating system declarations should always contain at least
|
||||
these.
|
||||
@end defvr
|
||||
|
||||
@defvr {Scheme Variable} %devtmpfs-file-system
|
||||
The @code{devtmpfs} file system to be mounted on @file{/dev}. This is a
|
||||
requirement for udev (@pxref{Base Services, @code{udev-service}}).
|
||||
@end defvr
|
||||
|
||||
@defvr {Scheme Variable} %pseudo-terminal-file-system
|
||||
This is the file system to be mounted as @file{/dev/pts}. It supports
|
||||
@dfn{pseudo-terminals} created @i{via} @code{openpty} and similar
|
||||
|
|
|
@ -48,7 +48,7 @@ (define-module (gnu build linux-boot)
|
|||
;;; Code:
|
||||
|
||||
(define* (mount-essential-file-systems #:key (root "/"))
|
||||
"Mount /proc and /sys under ROOT."
|
||||
"Mount /dev, /proc, and /sys under ROOT."
|
||||
(define (scope dir)
|
||||
(string-append root
|
||||
(if (string-suffix? "/" root)
|
||||
|
@ -60,6 +60,10 @@ (define (scope dir)
|
|||
(mkdir (scope "proc")))
|
||||
(mount "none" (scope "proc") "proc")
|
||||
|
||||
(unless (file-exists? (scope "dev"))
|
||||
(mkdir (scope "dev")))
|
||||
(mount "none" (scope "dev") "devtmpfs")
|
||||
|
||||
(unless (file-exists? (scope "sys"))
|
||||
(mkdir (scope "sys")))
|
||||
(mount "none" (scope "sys") "sysfs"))
|
||||
|
@ -71,7 +75,7 @@ (define (move-essential-file-systems root)
|
|||
(unless (file-exists? target)
|
||||
(mkdir target))
|
||||
(mount dir target "" MS_MOVE)))
|
||||
'("/proc" "/sys")))
|
||||
'("/dev" "/proc" "/sys")))
|
||||
|
||||
(define (linux-command-line)
|
||||
"Return the Linux kernel command line as a list of strings."
|
||||
|
@ -100,7 +104,7 @@ (define* (make-disk-device-nodes base major #:optional (minor 0))
|
|||
|
||||
(define* (make-essential-device-nodes #:key (root "/"))
|
||||
"Make essential device nodes under ROOT/dev."
|
||||
;; The hand-made udev!
|
||||
;; The hand-made devtmpfs/udev!
|
||||
|
||||
(define (scope dir)
|
||||
(string-append root
|
||||
|
@ -255,7 +259,8 @@ (define (mark-as-not-killable pid)
|
|||
(mount "none" "/rw-root" "tmpfs")
|
||||
|
||||
;; We want read-write /dev nodes.
|
||||
(make-essential-device-nodes #:root "/rw-root")
|
||||
(mkdir-p "/rw-root/dev")
|
||||
(mount "none" "/rw-root/dev" "devtmpfs")
|
||||
|
||||
;; Make /root a union of the tmpfs and the actual root. Use
|
||||
;; 'max_files' to set a high RLIMIT_NOFILE for the unionfs process
|
||||
|
@ -385,9 +390,6 @@ (define (lookup-module name)
|
|||
(unless (configure-qemu-networking)
|
||||
(display "network interface is DOWN\n")))
|
||||
|
||||
;; Make /dev nodes.
|
||||
(make-essential-device-nodes)
|
||||
|
||||
;; Prepare the real root file system under /root.
|
||||
(unless (file-exists? "/root")
|
||||
(mkdir "/root"))
|
||||
|
@ -405,10 +407,6 @@ (define (lookup-module name)
|
|||
#:volatile-root? volatile-root?)
|
||||
(mount "none" "/root" "tmpfs"))
|
||||
|
||||
(unless (file-exists? "/root/dev")
|
||||
(mkdir "/root/dev")
|
||||
(make-essential-device-nodes #:root "/root"))
|
||||
|
||||
;; Mount the specified file systems.
|
||||
(for-each mount-file-system
|
||||
(remove root-mount-point? mounts))
|
||||
|
|
|
@ -47,7 +47,6 @@ (define-module (gnu system file-systems)
|
|||
%binary-format-file-system
|
||||
%shared-memory-file-system
|
||||
%pseudo-terminal-file-system
|
||||
%devtmpfs-file-system
|
||||
%immutable-store
|
||||
%control-groups
|
||||
%elogind-file-systems
|
||||
|
@ -186,17 +185,6 @@ (define %binary-format-file-system
|
|||
(type "binfmt_misc")
|
||||
(check? #f)))
|
||||
|
||||
(define %devtmpfs-file-system
|
||||
;; /dev as a 'devtmpfs' file system, needed for udev.
|
||||
(file-system
|
||||
(device "none")
|
||||
(mount-point "/dev")
|
||||
(type "devtmpfs")
|
||||
(check? #f)
|
||||
|
||||
;; Mount it from the initrd so /dev/pts & co. can then be mounted over it.
|
||||
(needed-for-boot? #t)))
|
||||
|
||||
(define %tty-gid
|
||||
;; ID of the 'tty' group. Allocate it statically to make it easy to refer
|
||||
;; to it from here and from the 'tty' group definitions.
|
||||
|
@ -282,8 +270,7 @@ (define %elogind-file-systems
|
|||
(define %base-file-systems
|
||||
;; List of basic file systems to be mounted. Note that /proc and /sys are
|
||||
;; currently mounted by the initrd.
|
||||
(append (list %devtmpfs-file-system
|
||||
%pseudo-terminal-file-system
|
||||
(append (list %pseudo-terminal-file-system
|
||||
%shared-memory-file-system
|
||||
%immutable-store)
|
||||
%elogind-file-systems
|
||||
|
|
Loading…
Reference in a new issue