summaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/activation.scm4
-rw-r--r--gnu/build/hurd-boot.scm12
-rw-r--r--gnu/build/image.scm8
-rw-r--r--gnu/build/linux-boot.scm85
4 files changed, 65 insertions, 44 deletions
diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index 9f6126023c..10c9045740 100644
--- a/gnu/build/activation.scm
+++ b/gnu/build/activation.scm
@@ -389,8 +389,8 @@ improvement."
"/run/current-system")
(define (boot-time-system)
- "Return the '--system' argument passed on the kernel command line."
- (find-long-option "--system" (if (string-contains %host-type "linux-gnu")
+ "Return the 'gnu.system' argument passed on the kernel command line."
+ (find-long-option "gnu.system" (if (string-contains %host-type "linux-gnu")
(linux-command-line)
(command-line))))
diff --git a/gnu/build/hurd-boot.scm b/gnu/build/hurd-boot.scm
index ac36bd17d4..ad3c50d61e 100644
--- a/gnu/build/hurd-boot.scm
+++ b/gnu/build/hurd-boot.scm
@@ -254,7 +254,7 @@ set."
"This procedure is meant to be called from an early RC script.
Install the relevant passive translators on the first boot. Then, run system
-activation by using the kernel command-line options '--system' and '--load';
+activation by using the kernel command-line options 'gnu.system' and 'gnu.load';
starting the Shepherd.
XXX TODO: see linux-boot.scm:boot-system.
@@ -265,14 +265,14 @@ XXX TODO: use Linux xattr/setxattr to remove (settrans in) /libexec/RUNSYSTEM
"
(display "Welcome, this is GNU's early boot Guile.\n")
- (display "Use '--repl' for an initrd REPL.\n\n")
+ (display "Use 'gnu.repl' for an initrd REPL.\n\n")
(call-with-error-handling
(lambda ()
(let* ((args (command-line))
- (system (find-long-option "--system" args))
- (to-load (find-long-option "--load" args)))
+ (system (find-long-option "gnu.system" args))
+ (to-load (find-long-option "gnu.load" args)))
(format #t "Setting-up essential translators...\n")
(setenv "PATH" (string-append system "/profile/bin"))
@@ -286,7 +286,7 @@ XXX TODO: use Linux xattr/setxattr to remove (settrans in) /libexec/RUNSYSTEM
(unless (zero? (system* "/hurd/mach-defpager"))
(format #t "FAILED...Good luck!\n"))
- (cond ((member "--repl" args)
+ (cond ((member "gnu.repl" args)
(format #t "Starting repl...\n")
(start-repl))
(to-load
@@ -298,7 +298,7 @@ XXX TODO: use Linux xattr/setxattr to remove (settrans in) /libexec/RUNSYSTEM
(sleep 2)
(reboot))
(else
- (display "no boot file passed via '--load'\n")
+ (display "no boot file passed via 'gnu.load'\n")
(display "entering a warm and cozy REPL\n")
(start-repl)))))
#:on-error on-error))
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index bdd5ec25a9..81caa424f8 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -3,7 +3,7 @@
;;; Copyright © 2016 Christine Lemmer-Webber <cwebber@dustycloud.org>
;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
-;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2020, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of GNU Guix.
@@ -62,8 +62,10 @@
(define (estimate-partition-size root)
"Given the ROOT directory, evaluate and return its size. As this doesn't
-take the partition metadata size into account, take a 25% margin."
- (* 1.25 (file-size root)))
+take the partition metadata size into account, take a 25% margin. As this in
+turn doesn't take any constant overhead into account, force a 1-MiB minimum."
+ (max (ash 1 20)
+ (* 1.25 (file-size root))))
(define* (make-ext-image partition target root
#:key
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 8efe6e5f9c..7d41537652 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2016, 2017, 2019–2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2020, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -93,7 +94,7 @@
get-string-all)))
(define (find-long-option option arguments)
- "Find OPTION among ARGUMENTS, where OPTION is something like \"--load\".
+ "Find OPTION among ARGUMENTS, where OPTION is something like \"gnu.load\".
Return the value associated with OPTION, or #f on failure."
(let ((opt (string-append option "=")))
(and=> (find (cut string-prefix? opt <>)
@@ -499,10 +500,12 @@ LINUX-MODULE-DIRECTORY, then installing KEYMAP-FILE with 'loadkeys' (if
KEYMAP-FILE is true), then setting up QEMU guest networking if
QEMU-GUEST-NETWORKING? is true, calling PRE-MOUNT, mounting the file systems
specified in MOUNTS, and finally booting into the new root if any. The initrd
-supports kernel command-line options '--load', '--root', and '--repl'.
+supports the kernel command-line options 'gnu.load' and 'gnu.repl'. It also
+honors a subset of the Linux kernel command-line parameters such as
+'fsck.mode', 'resume', 'rootdelay', rootflags and rootfstype.
-Mount the root file system, specified by the '--root' command-line argument,
-if any.
+Mount the root file system, specified by the 'root' command-line argument, if
+any.
MOUNTS must be a list of <file-system> objects.
@@ -515,33 +518,50 @@ upon error."
(string=? (file-system-mount-point fs) "/"))
(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, an nfs-root, a UUID, or a
- ;; label. So check for all four.
+ ;; The "root=SPEC" kernel command-line option always provides a string,
+ ;; but the string can represent a device, an nfs-root, a UUID, or a label.
+ ;; So check for all four.
(cond ((string-prefix? "/" device-string) device-string)
((string-contains device-string ":/") device-string) ; nfs-root
((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")
+ (display "Use 'gnu.repl' for an initrd REPL.\n\n")
(call-with-error-handling
(lambda ()
(mount-essential-file-systems)
(let* ((args (linux-command-line))
- (to-load (find-long-option "--load" args))
- ;; If present, ‘--root’ on the kernel command line takes precedence
+ (to-load (find-long-option "gnu.load" args))
+ ;; If present, ‘root’ on the kernel command line takes precedence
;; over the ‘device’ field of the root <file-system> record.
- (root-device (and=> (find-long-option "--root" args)
+ (root-device (and=> (find-long-option "root" args)
device-string->file-system-device))
- (root-fs (or (find root-mount-point? mounts)
- ;; Fall back to fictitious defaults.
- (file-system (device (or root-device "/dev/root"))
- (mount-point "/")
- (type "ext4"))))
+ (rootfstype (find-long-option "rootfstype" args))
+ (rootflags (find-long-option "rootflags" args))
+ (root-fs* (find root-mount-point? mounts))
(fsck.mode (find-long-option "fsck.mode" args)))
+ (unless (or root-fs* (and root-device rootfstype))
+ (error "no root file system or 'root' and 'rootfstype' parameters"))
+
+ ;; If present, ‘root’ on the kernel command line takes precedence over
+ ;; the ‘device’ field of the root <file-system> record; likewise for
+ ;; the 'rootfstype' and 'rootflags' arguments.
+ (define root-fs
+ (if root-fs*
+ (file-system
+ (inherit root-fs*)
+ (device (or root-device (file-system-device root-fs*)))
+ (type (or rootfstype (file-system-type root-fs*)))
+ (options (or rootflags (file-system-options root-fs*))))
+ (file-system
+ (device root-device)
+ (mount-point "/")
+ (type rootfstype)
+ (options rootflags))))
+
(define (check? fs)
(match fsck.mode
("skip" #f)
@@ -562,7 +582,7 @@ upon error."
(_ 'preen))
(file-system-repair fs))))
- (when (member "--repl" args)
+ (when (member "gnu.repl" args)
(start-repl))
(display "loading kernel modules...\n")
@@ -596,9 +616,8 @@ upon error."
(let ((root-delay (and=> (find-long-option "rootdelay" args)
string->number)))
(when root-delay
- (format #t
- "Pausing for rootdelay=~a seconds before mounting the root file system...\n"
- root-delay)
+ (format #t "Pausing for rootdelay=~a seconds before mounting \
+the root file system...\n" root-delay)
(sleep root-delay)))
;; Prepare the real root file system under /root.
@@ -614,18 +633,18 @@ upon error."
(setenv "EXT2FS_NO_MTAB_OK" "1")
- (if root-device
- (mount-root-file-system (canonicalize-device-spec root-device)
- (file-system-type root-fs)
- #:volatile-root? volatile-root?
- #:flags (mount-flags->bit-mask
- (file-system-flags root-fs))
- #:options (file-system-options root-fs)
- #:check? (check? root-fs)
- #:skip-check-if-clean?
- (skip-check-if-clean? root-fs)
- #:repair (repair root-fs))
- (mount "none" "/root" "tmpfs"))
+ ;; Mount the root file system.
+ (mount-root-file-system (canonicalize-device-spec
+ (file-system-device root-fs))
+ (file-system-type root-fs)
+ #:volatile-root? volatile-root?
+ #:flags (mount-flags->bit-mask
+ (file-system-flags root-fs))
+ #:options (file-system-options root-fs)
+ #:check? (check? root-fs)
+ #:skip-check-if-clean?
+ (skip-check-if-clean? root-fs)
+ #:repair (repair root-fs))
;; Mount the specified non-root file systems.
(for-each (lambda (fs)
@@ -651,7 +670,7 @@ upon error."
(sleep 2)
(reboot))
(begin
- (display "no boot file passed via '--load'\n")
+ (display "no boot file passed via 'gnu.load'\n")
(display "entering a warm and cozy REPL\n")
(start-repl)))))
#:on-error on-error))