diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index ecd44e7f3c..048b9ff8fd 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -378,22 +378,25 @@ (define (menu-entry->gexp entry) (device-mount-point (menu-entry-device-mount-point entry)) (multiboot-kernel (menu-entry-multiboot-kernel entry)) (chain-loader (menu-entry-chain-loader entry))) + ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. + ;; Use the right file names for LINUX and INITRD in case + ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a + ;; separate partition. Then we don't use STORE-DIRECTORY-PREFIX. + ;; When STORE-DIRECTORY-PREFIX is defined, prepend it the linux and + ;; initrd paths, to allow booting from a Btrfs subvolume. + (define (normalize-or-grub path) + "Normalize PATH if and only if DEVICE-MOUNT-POINT is \"/\"." + (if (and (string? device-mount-point) + (string= "/" device-mount-point)) + (normalize-file path + device-mount-point + store-directory-prefix) + path)) (cond (linux (let ((arguments (menu-entry-linux-arguments entry)) - (linux (normalize-file linux - device-mount-point - store-directory-prefix)) - (initrd (normalize-file (menu-entry-initrd entry) - device-mount-point - store-directory-prefix))) - ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. - ;; Use the right file names for LINUX and INITRD in case - ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a - ;; separate partition. - - ;; When STORE-DIRECTORY-PREFIX is defined, prepend it the linux and - ;; initrd paths, to allow booting from a Btrfs subvolume. + (linux (normalize-or-grub linux)) + (initrd (normalize-or-grub (menu-entry-initrd entry)))) #~(format port "menuentry ~s { ~a linux ~a ~a