[bug#65335,v2,4/5] gnu: system: bootable-kernel-arguments: Ignore the "none" root case.

Message ID 52095319ac7aefa59a081b87fd8609811a5e1cd2.1692569807.git.ngraves@ngraves.fr
State New
Headers
Series [bug#65335,v2,1/5] file-systems: canonicalize-device-name: Ignore the "none" case. |

Commit Message

Nicolas Graves Aug. 20, 2023, 10:16 p.m. UTC
---
 gnu/system.scm | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
  

Comments

Ludovic Courtès Aug. 21, 2023, 2:10 p.m. UTC | #1
Nicolas Graves <ngraves@ngraves.fr> skribis:

> +     (if (string=? root "none")
> +         '() ;; Ignore the case where the root is "none" (typically tmpfs).

Nitpick: please use a single semicolon for margin comments:

  '() ;like this

Otherwise LGTM.
  
Ludovic Courtès Aug. 21, 2023, 2:15 p.m. UTC | #2
A couple more things:

  1. Could you add a system test with / on tmpfs?  This can be done by
     calling ‘run-basic-test’ with a custom OS config where / is on
     tmpfs.

  2. Perhaps add a sentence or two under “operating-system Reference”
     stating that "/" can be on tmpfs and that its ‘device’ field must
     be “none” in that case.

Apart from these minor issues, it looks great to me!

Thanks,
Ludo’.
  

Patch

diff --git a/gnu/system.scm b/gnu/system.scm
index 279b9df5c0..0d9e9ee5cf 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -198,15 +198,18 @@  (define* (bootable-kernel-arguments system root-device version)
   ;; compatibility when producing bootloader configurations for older
   ;; generations.
   (define version>0? (> version 0))
-  (list (string-append (if version>0? "root=" "--root=")
-                       ;; Note: Always use the DCE format because that's what
-                       ;; (gnu build linux-boot) expects for the 'root'
-                       ;; kernel command-line option.
-                       (file-system-device->string root-device
-                                                   #:uuid-type 'dce))
-        #~(string-append (if #$version>0? "gnu.system=" "--system=") #$system)
-        #~(string-append (if #$version>0? "gnu.load=" "--load=")
-                         #$system "/boot")))
+  (let ((root (file-system-device->string root-device
+                                          #:uuid-type 'dce)))
+    (append
+     (if (string=? root "none")
+         '() ;; Ignore the case where the root is "none" (typically tmpfs).
+         ;; Note: Always use the DCE format because that's what
+         ;; (gnu build linux-boot) expects for the 'root'
+         ;; kernel command-line option.
+         (list (string-append (if version>0? "root=" "--root=") root)))
+     (list #~(string-append (if #$version>0? "gnu.system=" "--system=") #$system)
+           #~(string-append (if #$version>0? "gnu.load=" "--load=")
+                            #$system "/boot")))))
 
 ;; System-wide configuration.