Subject: [PATCH 1/3] initrd: Rename the '--root' initrd option to just 'root'.

From: Maxim Cournoyer <[email-masked]>
Date: Fri, 18 Feb 2022 10:33:21 -0500

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 the '--root' option to
'root'.  Adjust doc.
* gnu/installer/parted.scm (installer-root-partition-path): Use 'root' instead
of '--root'.
* gnu/system.scm (bootable-kernel-arguments): Likewise.
(operating-system-boot-parameters): Adjust doc.
(operating-system-boot-parameters-file): Likewise.
* gnu/system/linux-initrd.scm (base-initrd): Likewise.
* doc/guix.texi: Adjust doc.
---
 doc/guix.texi               |  6 +++---
 gnu/build/linux-boot.scm    | 20 ++++++++++----------
 gnu/installer/parted.scm    |  2 +-
 gnu/system.scm              |  8 ++++----
 gnu/system/linux-initrd.scm |  4 ++--
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index a4145af7fd..ba613ea31f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -34909,7 +34909,7 @@ Guix uses this option to yield control to a boot program that runs the
 service activation programs and then spawns the GNU@tie{}Shepherd, the
 initialization system.
 
-@item --root=@var{root}
+@item root=@var{root}
 Mount @var{root} as the root file system.  @var{root} can be a device
 name like @code{/dev/sda1}, a file system label, or a file system UUID.
 When unspecified, the device name from the root file system of the
@@ -34967,7 +34967,7 @@ here is how to use it and customize it further.
        [#:helper-packages '()] [#:qemu-networking? #f] [#:volatile-root? #f]
 Return a derivation that builds a raw initrd.  @var{file-systems} is
 a list of file systems to be mounted by the initrd, possibly in addition to
-the root file system specified on the kernel command line via @option{--root}.
+the root file system specified on the kernel command line via @option{root}.
 @var{linux-modules} is a list of kernel modules to be loaded at boot time.
 @var{mapped-devices} is a list of device mappings to realize before
 @var{file-systems} are mounted (@pxref{Mapped Devices}).
@@ -34997,7 +34997,7 @@ to it are lost.
 Return as a file-like object a generic initrd, with kernel
 modules taken from @var{linux}.  @var{file-systems} is a list of file-systems to be
 mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via @option{--root}.  @var{mapped-devices} is a list of device
+on the kernel command line via @option{root}.  @var{mapped-devices} is a list of device
 mappings to realize before @var{file-systems} are mounted.
 
 When true, @var{keyboard-layout} is a @code{<keyboard-layout>} record denoting
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 0ae316849e..d36601d824 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -499,12 +499,12 @@ (define* (boot-system #:key
 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 options '--load' and '--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 <file-system> objects.
 
@@ -517,9 +517,9 @@ (define (root-mount-point? fs)
     (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)
@@ -533,9 +533,9 @@ (define (device-string->file-system-device device-string)
       (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
+             ;; 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.
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index e33ef5f8fd..94ef9b42bc 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -348,7 +348,7 @@ (define (remove-logical-devices)
 (define (installer-root-partition-path)
   "Return the root partition path, or #f if it could not be detected."
   (let* ((cmdline (linux-command-line))
-         (root (find-long-option "--root" cmdline)))
+         (root (find-long-option "root" cmdline)))
     (and root
          (or (and (access? root F_OK) root)
              (find-partition-by-label root)
diff --git a/gnu/system.scm b/gnu/system.scm
index cc925de16f..f14186a64f 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -187,9 +187,9 @@ (define-module (gnu system)
 
 (define (bootable-kernel-arguments system root-device)
   "Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE."
-  (list (string-append "--root="
+  (list (string-append "root="
                        ;; Note: Always use the DCE format because that's what
-                       ;; (gnu build linux-boot) expects for the '--root'
+                       ;; (gnu build linux-boot) expects for the 'root'
                        ;; kernel command-line option.
                        (file-system-device->string root-device
                                                    #:uuid-type 'dce))
@@ -1441,7 +1441,7 @@ (define* (operating-system-boot-parameters os root-device
                                            #:key system-kernel-arguments?)
   "Return a monadic <boot-parameters> record that describes the boot
 parameters of OS.  When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments
-such as '--root' and '--load' to <boot-parameters>."
+such as 'root' and '--load' to <boot-parameters>."
   (let* ((initrd          (and (not (operating-system-hurd os))
                                (operating-system-initrd-file os)))
          (store           (operating-system-store-file-system os))
@@ -1487,7 +1487,7 @@ (define* (operating-system-boot-parameters-file os
    "Return a file that describes the boot parameters of OS.  The primary use of
 this file is the reconstruction of GRUB menu entries for old configurations.
 
-When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments such as '--root'
+When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments such as 'root'
 and '--load' to the returned file (since the returned file is then usually
 stored into the content-addressed \"system\" directory, it's usually not a
 good idea to give it because the content hash would change by the content hash
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 329cd38cd6..4c4c78e444 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -181,7 +181,7 @@ (define* (raw-initrd file-systems
   "Return as a file-like object a raw initrd, with kernel
 modules taken from LINUX.  FILE-SYSTEMS is a list of file-systems to be
 mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via '--root'. LINUX-MODULES is a list of kernel
+on the kernel command line via 'root'.  LINUX-MODULES is a list of kernel
 modules to be loaded at boot time. MAPPED-DEVICES is a list of device
 mappings to realize before FILE-SYSTEMS are mounted.
 HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include
@@ -375,7 +375,7 @@ (define* (base-initrd file-systems
   "Return as a file-like object a generic initrd, with kernel
 modules taken from LINUX.  FILE-SYSTEMS is a list of file-systems to be
 mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via '--root'.  MAPPED-DEVICES is a list of device
+on the kernel command line via 'root'.  MAPPED-DEVICES is a list of device
 mappings to realize before FILE-SYSTEMS are mounted.
 
 When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desired
-- 
2.34.0