linux-boot: Don't ignore options when mounting root file system.

Fixes <https://bugs.gnu.org/37977>.

* gnu/build/linux-boot.scm (mount-root-file-system): Add the 'options'
  keyword argument and use it when mounting the root file system.
  (boot-system): Pass the root file system options to
  'mount-root-file-system'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Guillaume Le Vaillant 2019-11-17 14:15:21 +01:00 committed by Ludovic Courtès
parent 0d78d0f09c
commit 900ef20b1d
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -357,15 +358,16 @@ (define (pidof program)
(filter-map string->number (scandir "/proc"))))) (filter-map string->number (scandir "/proc")))))
(define* (mount-root-file-system root type (define* (mount-root-file-system root type
#:key volatile-root?) #:key volatile-root? options)
"Mount the root file system of type TYPE at device ROOT. If VOLATILE-ROOT? "Mount the root file system of type TYPE at device ROOT. If VOLATILE-ROOT?
is true, mount ROOT read-only and make it an overlay with a writable tmpfs is true, mount ROOT read-only and make it an overlay with a writable tmpfs
using the kernel built-in overlayfs." using the kernel built-in overlayfs. OPTIONS indicates the options to use
to mount ROOT."
(if volatile-root? (if volatile-root?
(begin (begin
(mkdir-p "/real-root") (mkdir-p "/real-root")
(mount root "/real-root" type MS_RDONLY) (mount root "/real-root" type MS_RDONLY options)
(mkdir-p "/rw-root") (mkdir-p "/rw-root")
(mount "none" "/rw-root" "tmpfs") (mount "none" "/rw-root" "tmpfs")
@ -382,7 +384,7 @@ (define* (mount-root-file-system root type
"lowerdir=/real-root,upperdir=/rw-root/upper,workdir=/rw-root/work")) "lowerdir=/real-root,upperdir=/rw-root/upper,workdir=/rw-root/work"))
(begin (begin
(check-file-system root type) (check-file-system root type)
(mount root "/root" type))) (mount root "/root" type 0 options)))
;; Make sure /root/etc/mtab is a symlink to /proc/self/mounts. ;; Make sure /root/etc/mtab is a symlink to /proc/self/mounts.
(false-if-exception (false-if-exception
@ -472,6 +474,12 @@ (define root-fs-type
mounts) mounts)
"ext4")) "ext4"))
(define root-fs-options
(any (lambda (fs)
(and (root-mount-point? fs)
(file-system-options fs)))
mounts))
(display "Welcome, this is GNU's early boot Guile.\n") (display "Welcome, this is GNU's early boot Guile.\n")
(display "Use '--repl' for an initrd REPL.\n\n") (display "Use '--repl' for an initrd REPL.\n\n")
@ -524,7 +532,8 @@ (define root-fs-type
(else (file-system-label root))))) (else (file-system-label root)))))
(mount-root-file-system (canonicalize-device-spec root) (mount-root-file-system (canonicalize-device-spec root)
root-fs-type root-fs-type
#:volatile-root? volatile-root?)) #:volatile-root? volatile-root?
#:options root-fs-options))
(mount "none" "/root" "tmpfs")) (mount "none" "/root" "tmpfs"))
;; Mount the specified file systems. ;; Mount the specified file systems.