system: Avoid using device paths in <menu-entry> device field.
This fixes a regression introduced by
1ef8b72a7f
, in which we would incorrectly use a
device path in a label-based grub root search command, e.g. 'search --label
--set /dev/sda4'.
* gnu/system.scm (grub-device): New procedure.
(operating-system-grub.cfg, operating-system-parameters-file): Use it.
(read-boot-parameters): Handle device paths correctly.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
f4dc22bcd9
commit
3382bfe9ea
|
@ -60,6 +60,7 @@
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (srfi srfi-34)
|
#:use-module (srfi srfi-34)
|
||||||
#:use-module (srfi srfi-35)
|
#:use-module (srfi srfi-35)
|
||||||
|
#:use-module (rnrs bytevectors)
|
||||||
#:export (operating-system
|
#:export (operating-system
|
||||||
operating-system?
|
operating-system?
|
||||||
|
|
||||||
|
@ -738,7 +739,7 @@ listed in OS. The C library expects to find it under
|
||||||
(label label)
|
(label label)
|
||||||
|
|
||||||
;; The device where the kernel and initrd live.
|
;; The device where the kernel and initrd live.
|
||||||
(device (file-system-device store-fs))
|
(device (grub-device store-fs))
|
||||||
(device-mount-point
|
(device-mount-point
|
||||||
(file-system-mount-point store-fs))
|
(file-system-mount-point store-fs))
|
||||||
|
|
||||||
|
@ -753,6 +754,14 @@ listed in OS. The C library expects to find it under
|
||||||
(grub-configuration-file (operating-system-bootloader os) entries
|
(grub-configuration-file (operating-system-bootloader os) entries
|
||||||
#:old-entries old-entries)))
|
#:old-entries old-entries)))
|
||||||
|
|
||||||
|
(define (grub-device fs)
|
||||||
|
"Given FS, a <file-system> object, return a value suitable for use as the
|
||||||
|
device in a <menu-entry>."
|
||||||
|
(case (file-system-title fs)
|
||||||
|
((uuid) (file-system-device fs))
|
||||||
|
((label) (file-system-device fs))
|
||||||
|
(else #f)))
|
||||||
|
|
||||||
(define (operating-system-parameters-file os)
|
(define (operating-system-parameters-file os)
|
||||||
"Return a file that describes the boot parameters of OS. The primary use of
|
"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."
|
this file is the reconstruction of GRUB menu entries for old configurations."
|
||||||
|
@ -771,10 +780,7 @@ this file is the reconstruction of GRUB menu entries for old configurations."
|
||||||
#$(operating-system-kernel-arguments os))
|
#$(operating-system-kernel-arguments os))
|
||||||
(initrd #$initrd)
|
(initrd #$initrd)
|
||||||
(store
|
(store
|
||||||
(device #$(case (file-system-title store)
|
(device #$(grub-device store))
|
||||||
((uuid) (file-system-device store))
|
|
||||||
((label) (file-system-device store))
|
|
||||||
(else #f)))
|
|
||||||
(mount-point #$(file-system-mount-point store))))
|
(mount-point #$(file-system-mount-point store))))
|
||||||
#:set-load-path? #f)))
|
#:set-load-path? #f)))
|
||||||
|
|
||||||
|
@ -836,7 +842,11 @@ this file is the reconstruction of GRUB menu entries for old configurations."
|
||||||
(('store ('device device) _ ...)
|
(('store ('device device) _ ...)
|
||||||
device)
|
device)
|
||||||
(_ ;the old format
|
(_ ;the old format
|
||||||
root)))
|
;; Root might be a device path like "/dev/sda1", which is not a
|
||||||
|
;; suitable GRUB device identifier.
|
||||||
|
(if (string-prefix? "/" root)
|
||||||
|
#f
|
||||||
|
root))))
|
||||||
|
|
||||||
(store-mount-point
|
(store-mount-point
|
||||||
(match (assq 'store rest)
|
(match (assq 'store rest)
|
||||||
|
|
Loading…
Reference in New Issue