system: Add '%devtmpfs-file-system' for udev, and '%base-file-systems'.

Suggested by Adam Pribyl <pribyl@lowlevel.cz>.

* gnu/services/base.scm (udev-service)[requirement]: Add
  'file-system-/dev'.
* gnu/system/file-systems.scm (%devtmpfs-file-system,
  %base-file-systems): New variables.
* gnu/system/install.scm (installation-services)[file-systems]: Use
  %base-file-systems.
* build-aux/hydra/demo-os.scm (file-systems): Likewise.
* doc/guix.texi (System Installation): Show %BASE-FILE-SYSTEMS in the
  example.
  (Using the Configuration System): Likewise.
  (File Systems): Document %base-file-systems, %devtmpfs-file-system,
  %binary-format-file-system, and %fuse-control-file-system.
This commit is contained in:
Ludovic Courtès 2014-07-22 16:57:57 +02:00
parent 7cb9666dd0
commit a69576ea85
5 changed files with 67 additions and 16 deletions

View File

@ -44,13 +44,13 @@
(file-systems
;; We provide a dummy file system for /, but that's OK because the VM build
;; code will automatically declare the / file system for us.
(list (file-system
(mount-point "/")
(device "dummy")
(type "dummy"))
;; %fuse-control-file-system ; needs fuse.ko
;; %binary-format-file-system ; needs binfmt.ko
))
(cons* (file-system
(mount-point "/")
(device "dummy")
(type "dummy"))
;; %fuse-control-file-system ; needs fuse.ko
;; %binary-format-file-system ; needs binfmt.ko
%base-file-systems))
(users (list (user-account
(name "guest")

View File

@ -2826,10 +2826,11 @@ only a root account would look like this:
;; Assuming /dev/sdX is the target hard disk, and /dev/sdX1 the
;; target root file system.
(bootloader (grub-configuration (device "/dev/sdX")))
(file-systems (list (file-system
(file-systems (cons (file-system
(device "/dev/sdX1")
(mount-point "/")
(type "ext4")))))
(type "ext4"))
%base-file-systems)))
@end example
@noindent
@ -2925,10 +2926,11 @@ kernel, initial RAM disk, and boot loader looks like this:
(locale "fr_FR.UTF-8")
(bootloader (grub-configuration
(device "/dev/sda")))
(file-systems (list (file-system
(file-systems (cons (file-system
(device "/dev/sda1") ; or partition label
(mount-point "/")
(type "ext3"))))
(type "ext3"))
%base-file-systems))
(users (list (user-account
(name "alice")
(password "")
@ -3055,6 +3057,32 @@ errors before being mounted.
@end table
@end deftp
The @code{(gnu system file-systems)} exports the following useful
variables.
@defvr {Scheme Variable} %base-file-systems
These are essential file systems that are required on normal systems,
such as @var{%devtmpfs-file-system} (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} %binary-format-file-system
The @code{binfmt_misc} file system, which allows handling of arbitrary
executable file types to be delegated to user space. This requires the
@code{binfmt.ko} kernel module to be loaded.
@end defvr
@defvr {Scheme Variable} %fuse-control-file-system
The @code{fusectl} file system, which allows unprivileged users to mount
and unmount user-space FUSE file systems. This requires the
@code{fuse.ko} kernel module to be loaded.
@end defvr
@node User Accounts
@subsection User Accounts
@ -3245,6 +3273,7 @@ passed to @command{guix-daemon}.
Run @var{udev}, which populates the @file{/dev} directory dynamically.
@end deffn
@node Networking Services
@subsubsection Networking Services

View File

@ -473,8 +473,13 @@ passed to @command{guix-daemon}."
(with-monad %store-monad
(return (service
(provision '(udev))
(requirement '(root-file-system))
(documentation "Populate the /dev directory.")
;; Udev needs /dev to be a 'devtmpfs' mount so that new device
;; nodes can be added: see
;; <http://www.linuxfromscratch.org/lfs/view/development/chapter07/udev.html>.
(requirement '(root-file-system file-system-/dev))
(documentation "Populate the /dev directory, dynamically.")
(start #~(lambda ()
(define udevd
(string-append #$udev "/libexec/udev/udevd"))

View File

@ -30,7 +30,10 @@
file-system-options
%fuse-control-file-system
%binary-format-file-system))
%binary-format-file-system
%devtmpfs-file-system
%base-file-systems))
;;; Commentary:
;;;
@ -72,4 +75,17 @@
(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)))
(define %base-file-systems
;; List of basic file systems to be mounted. Note that /proc and /sys are
;; currently mounted by the initrd.
(list %devtmpfs-file-system))
;;; file-systems.scm ends here

View File

@ -117,10 +117,11 @@ Use Alt-F2 for documentation.
(file-systems
;; Note: the disk image build code overrides this root file system with
;; the appropriate one.
(list (file-system
(cons (file-system
(mount-point "/")
(device "gnu-disk-image")
(type "ext4"))))
(type "ext4"))
%base-file-systems))
(users (list (user-account
(name "guest")