From 0dc019e19a23fea614be5623360849ab9bc35e74 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Thu, 17 Feb 2022 23:28:07 -0500 Subject: initrd: Use non-hyphenated kernel command-line parameter names. This is to make it less surprising, given the common convention sets forth by the kernel Linux command-line parameters. * gnu/build/linux-boot.scm (boot-system): Rename '--load', '--repl', '--root' and '--system' to 'gnu.load', 'gnu.repl', 'root' and 'gnu.system', respectively. Adjust doc. (find-long-option): Adjust doc. * gnu/installer/parted.scm (installer-root-partition-path): Adjust accordingly. * gnu/system.scm (bootable-kernel-arguments): Add a VERSION argument and update doc. Use VERSION to conditionally return old style vs new style initrd arguments. (%boot-parameters-version): Increment to 1. (operating-system-boot-parameters): Adjust doc. (operating-system-boot-parameters-file): Likewise. * gnu/system/linux-initrd.scm (raw-initrd, base-initrd): Likewise. * doc/guix.texi: Adjust doc. * gnu/build/activation.scm (boot-time-system): Adjust accordingly. * gnu/build/hurd-boot.scm (boot-hurd-system): Likewise. * gnu/packages/commencement.scm (%final-inputs-riscv64): Adjust comment. --- gnu/build/activation.scm | 4 ++-- gnu/build/hurd-boot.scm | 12 ++++++------ gnu/build/linux-boot.scm | 31 ++++++++++++++++--------------- 3 files changed, 24 insertions(+), 23 deletions(-) (limited to 'gnu/build') 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/linux-boot.scm b/gnu/build/linux-boot.scm index 0ae316849e..cfa1ab2fcb 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 ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Guillaume Le Vaillant +;;; Copyright © 2020, 2022 Maxim Cournoyer ;;; ;;; 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,12 +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'. It -also honors a subset of the documented Linux kernel command-line parameters -such as 'fsck.mode', 'resume' and 'rootdelay'. +supports kernel command-line parameters 'gnu.load' and 'gnu.repl'. It also +honors a subset of the Linux kernel command-line parameters such as +'fsck.mode', 'resume', 'root' and 'rootdelay'. -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 objects. @@ -517,25 +518,25 @@ 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 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. @@ -564,7 +565,7 @@ upon error." (_ 'preen)) (file-system-repair fs)))) - (when (member "--repl" args) + (when (member "gnu.repl" args) (start-repl)) (display "loading kernel modules...\n") @@ -652,7 +653,7 @@ the root file system...\n" root-delay) (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)) -- cgit v1.2.3