summaryrefslogtreecommitdiff
path: root/gnu/build/linux-boot.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/build/linux-boot.scm')
-rw-r--r--gnu/build/linux-boot.scm63
1 files changed, 28 insertions, 35 deletions
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index c6f9df5f29..f08bb11514 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -498,25 +498,13 @@ upon error."
(define (root-mount-point? fs)
(string=? (file-system-mount-point fs) "/"))
- (define root-fs-type
- (or (any (lambda (fs)
- (and (root-mount-point? fs)
- (file-system-type fs)))
- mounts)
- "ext4"))
-
- (define root-fs-flags
- (mount-flags->bit-mask (or (any (lambda (fs)
- (and (root-mount-point? fs)
- (file-system-flags fs)))
- mounts)
- '())))
-
- (define root-fs-options
- (any (lambda (fs)
- (and (root-mount-point? fs)
- (file-system-options fs)))
- mounts))
+ (define (device-string->file-system-device device-string)
+ ;; The "--root=SPEC" kernel command-line option always provides a
+ ;; string, but the string can represent a device, a UUID, or a
+ ;; label. So check for all three.
+ (cond ((string-prefix? "/" device-string) device-string)
+ ((uuid device-string) => identity)
+ (else (file-system-label device-string))))
(display "Welcome, this is GNU's early boot Guile.\n")
(display "Use '--repl' for an initrd REPL.\n\n")
@@ -526,7 +514,21 @@ upon error."
(mount-essential-file-systems)
(let* ((args (linux-command-line))
(to-load (find-long-option "--load" args))
- (root (find-long-option "--root" args)))
+ (root-fs (find root-mount-point? mounts))
+ (root-fs-type (or (and=> root-fs file-system-type)
+ "ext4"))
+ (root-fs-device (and=> root-fs file-system-device))
+ (root-fs-flags (mount-flags->bit-mask
+ (or (and=> root-fs file-system-flags)
+ '())))
+ (root-options (if root-fs
+ (file-system-options root-fs)
+ #f))
+ ;; --root takes precedence over the 'device' field of the root
+ ;; <file-system> record.
+ (root-device (or (and=> (find-long-option "--root" args)
+ device-string->file-system-device)
+ root-fs-device)))
(when (member "--repl" args)
(start-repl))
@@ -561,21 +563,12 @@ upon error."
(setenv "EXT2FS_NO_MTAB_OK" "1")
- (if root
- ;; The "--root=SPEC" kernel command-line option always provides a
- ;; string, but the string can represent a device, a UUID, or a
- ;; label. So check for all three.
- (let ((device-spec (cond ((string-prefix? "/" root) root)
- ((uuid root) => identity)
- ((string-contains root ":/") #f) ; nfs
- (else (file-system-label root)))))
- (mount-root-file-system (if device-spec
- (canonicalize-device-spec device-spec)
- root)
- root-fs-type
- #:volatile-root? volatile-root?
- #:flags root-fs-flags
- #:options root-fs-options))
+ (if root-device
+ (mount-root-file-system (canonicalize-device-spec root-device)
+ root-fs-type
+ #:volatile-root? volatile-root?
+ #:flags root-fs-flags
+ #:options root-options)
(mount "none" "/root" "tmpfs"))
;; Mount the specified file systems.