Subject: [bug#63527] [PATCH v5 10/11] bootloader: grub: Use rumpdisk-style root when booting with "noide".

From: Janneke Nieuwenhuizen <[email-masked]>
Date: Tue, 23 May 2023 17:47:31 +0200

* gnu/bootloader/grub.scm (make-grub-configuration): When "noide" is in
arguments, use device name "wd0" rather than "hd0".
---
 gnu/bootloader/grub.scm | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index ecd44e7f3c..af46d76380 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -3,7 +3,7 @@
 ;;; Copyright © 2016 Chris Marusich <[email-masked]>
 ;;; Copyright © 2017 Leo Famulari <[email-masked]>
 ;;; Copyright © 2017, 2020 Mathieu Othacehe <[email-masked]>
-;;; Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <[email-masked]>
+;;; Copyright © 2019, 2020, 2023 Janneke Nieuwenhuizen <[email-masked]>
 ;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas <[email-masked]>
 ;;; Copyright © 2020 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2020 Stefan <[email-masked]>
@@ -404,17 +404,20 @@ (define* (make-grub-configuration grub config entries
                     #$linux (string-join (list #$@arguments))
                     #$initrd)))
        (multiboot-kernel
-        (let ((kernel (menu-entry-multiboot-kernel entry))
-              (arguments (menu-entry-multiboot-arguments entry))
-              (modules (menu-entry-multiboot-modules entry))
-              (root-index 1))            ; XXX EFI will need root-index 2
+        (let* ((kernel (menu-entry-multiboot-kernel entry))
+               (arguments (menu-entry-multiboot-arguments entry))
+               (disk (if (member "noide" arguments) "w" "h"))
+               (modules (menu-entry-multiboot-modules entry))
+               (root-index 1))          ; XXX EFI will need root-index 2
           #~(format port "
 menuentry ~s {
-  multiboot ~a root=device:hd0s~a~a~a
+  multiboot ~a root=part:~a:device:~ad0~a~a
 }~%"
                     #$label
                     #$kernel
-                    #$root-index (string-join (list #$@arguments) " " 'prefix)
+                    #$root-index
+                    #$disk
+                    (string-join (list #$@arguments) " " 'prefix)
                     (string-join (map string-join '#$modules)
                                  "\n  module " 'prefix))))
        (chain-loader
-- 
2.40.1