summaryrefslogtreecommitdiff
path: root/gnu/bootloader/grub.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-05-27 22:44:28 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-05-29 21:48:59 -0400
commite7b86a0d88760275afefa0c44a3c30602f80aac0 (patch)
tree30af911732ba01c96dd2cfe5c4ededa9abbb25ea /gnu/bootloader/grub.scm
parentc08fac0f7d175b9deb182c597cecdae997efce9d (diff)
bootloader: grub: Rename the btrfs-subvolume-file-name parameter.
Following discussion in <https://issues.guix.gnu.org/37305>, it seems more appropriate to give the parameter a more generic name that better describes what it does. * gnu/bootloader/grub.scm (normalize-file): Rename the BTRFS-SUBVOLUME-FILE-NAME parameter to STORE-DIRECTORY-PREFIX, and always assume this argument to be a string. (eye-candy): Likewise. Default STORE-DIRECTORY-PREFIX to "". (grub-configuration-file): Likewise. * gnu/system.scm (operating-system-bootcfg): Adapt.
Diffstat (limited to 'gnu/bootloader/grub.scm')
-rw-r--r--gnu/bootloader/grub.scm47
1 files changed, 22 insertions, 25 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 40918ea3078..2d9a39afc3e 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -58,8 +58,8 @@
58;;; 58;;;
59;;; Code: 59;;; Code:
60 60
61(define* (normalize-file file mount-point btrfs-subvolume-file-name) 61(define* (normalize-file file mount-point store-directory-prefix)
62 "Strip MOUNT-POINT and prepend BTRFS-SUBVOLUME-FILE-NAME to FILE, a 62 "Strip MOUNT-POINT and prepend STORE-DIRECTORY-PREFIX, if any, to FILE, a
63G-expression or other lowerable object denoting a file name." 63G-expression or other lowerable object denoting a file name."
64 64
65 (define (strip-mount-point mount-point file) 65 (define (strip-mount-point mount-point file)
@@ -72,13 +72,13 @@ G-expression or other lowerable object denoting a file name."
72 file))) 72 file)))
73 file)) 73 file))
74 74
75 (define (prepend-btrfs-subvolume-file-name btrfs-subvolume-file-name file) 75 (define (prepend-store-directory-prefix store-directory-prefix file)
76 (if btrfs-subvolume-file-name 76 (if store-directory-prefix
77 #~(string-append #$btrfs-subvolume-file-name #$file) 77 #~(string-append #$store-directory-prefix #$file)
78 file)) 78 file))
79 79
80 (prepend-btrfs-subvolume-file-name btrfs-subvolume-file-name 80 (prepend-store-directory-prefix store-directory-prefix
81 (strip-mount-point mount-point file))) 81 (strip-mount-point mount-point file)))
82 82
83 83
84 84
@@ -135,14 +135,14 @@ file with the resolution provided in CONFIG."
135 (_ #f))))) 135 (_ #f)))))
136 136
137(define* (eye-candy config store-device store-mount-point 137(define* (eye-candy config store-device store-mount-point
138 #:key btrfs-store-subvolume-file-name system port) 138 #:key store-directory-prefix system port)
139 "Return a gexp that writes to PORT (a port-valued gexp) the 'grub.cfg' part 139 "Return a gexp that writes to PORT (a port-valued gexp) the 'grub.cfg' part
140concerned with graphics mode, background images, colors, and all that. 140concerned with graphics mode, background images, colors, and all that.
141STORE-DEVICE designates the device holding the store, and STORE-MOUNT-POINT is 141STORE-DEVICE designates the device holding the store, and STORE-MOUNT-POINT is
142its mount point; these are used to determine where the background image and 142its mount point; these are used to determine where the background image and
143fonts must be searched for. SYSTEM must be the target system string---e.g., 143fonts must be searched for. SYSTEM must be the target system string---e.g.,
144\"x86_64-linux\". BTRFS-STORE-SUBVOLUME-FILE-NAME is the file name of the 144\"x86_64-linux\". STORE-DIRECTORY-PREFIX is a directory prefix to prepend to
145Btrfs subvolume, to be prepended to any store path, if any." 145any store file name."
146 (define setup-gfxterm-body 146 (define setup-gfxterm-body
147 (let ((gfxmode 147 (let ((gfxmode
148 (or (and-let* ((theme (bootloader-configuration-theme config)) 148 (or (and-let* ((theme (bootloader-configuration-theme config))
@@ -181,12 +181,12 @@ fi~%" #+font-file)
181 (define font-file 181 (define font-file
182 (normalize-file (file-append grub "/share/grub/unicode.pf2") 182 (normalize-file (file-append grub "/share/grub/unicode.pf2")
183 store-mount-point 183 store-mount-point
184 btrfs-store-subvolume-file-name)) 184 store-directory-prefix))
185 185
186 (define image 186 (define image
187 (normalize-file (grub-background-image config) 187 (normalize-file (grub-background-image config)
188 store-mount-point 188 store-mount-point
189 btrfs-store-subvolume-file-name)) 189 store-directory-prefix))
190 190
191 (and image 191 (and image
192 #~(format #$port " 192 #~(format #$port "
@@ -320,13 +320,13 @@ code."
320 #:key 320 #:key
321 (system (%current-system)) 321 (system (%current-system))
322 (old-entries '()) 322 (old-entries '())
323 btrfs-subvolume-file-name) 323 store-directory-prefix)
324 "Return the GRUB configuration file corresponding to CONFIG, a 324 "Return the GRUB configuration file corresponding to CONFIG, a
325<bootloader-configuration> object, and where the store is available at 325<bootloader-configuration> object, and where the store is available at
326STORE-FS, a <file-system> object. OLD-ENTRIES is taken to be a list 326STORE-FS, a <file-system> object. OLD-ENTRIES is taken to be a list of menu
327of menu entries corresponding to old generations of the system. 327entries corresponding to old generations of the system.
328BTRFS-SUBVOLUME-FILE-NAME may be used to specify on which subvolume a 328STORE-DIRECTORY-PREFIX may be used to specify a store prefix, as is required
329Btrfs root file system resides." 329when booting a root file system on a Btrfs subvolume."
330 (define all-entries 330 (define all-entries
331 (append entries (bootloader-configuration-menu-entries config))) 331 (append entries (bootloader-configuration-menu-entries config)))
332 (define (menu-entry->gexp entry) 332 (define (menu-entry->gexp entry)
@@ -336,17 +336,14 @@ Btrfs root file system resides."
336 (arguments (menu-entry-linux-arguments entry)) 336 (arguments (menu-entry-linux-arguments entry))
337 (kernel (normalize-file (menu-entry-linux entry) 337 (kernel (normalize-file (menu-entry-linux entry)
338 device-mount-point 338 device-mount-point
339 btrfs-subvolume-file-name)) 339 store-directory-prefix))
340 (initrd (normalize-file (menu-entry-initrd entry) 340 (initrd (normalize-file (menu-entry-initrd entry)
341 device-mount-point 341 device-mount-point
342 btrfs-subvolume-file-name))) 342 store-directory-prefix)))
343 ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. 343 ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point.
344 ;; Use the right file names for KERNEL and INITRD in case 344 ;; Use the right file names for KERNEL and INITRD in case
345 ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a 345 ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a
346 ;; separate partition. 346 ;; separate partition.
347
348 ;; When BTRFS-SUBVOLUME-FILE-NAME is defined, prepend it the kernel and
349 ;; initrd paths, to allow booting from a Btrfs subvolume.
350 #~(format port "menuentry ~s { 347 #~(format port "menuentry ~s {
351 ~a 348 ~a
352 linux ~a ~a 349 linux ~a ~a
@@ -360,7 +357,7 @@ Btrfs root file system resides."
360 (eye-candy config 357 (eye-candy config
361 (menu-entry-device (first all-entries)) 358 (menu-entry-device (first all-entries))
362 (menu-entry-device-mount-point (first all-entries)) 359 (menu-entry-device-mount-point (first all-entries))
363 #:btrfs-store-subvolume-file-name btrfs-subvolume-file-name 360 #:store-directory-prefix store-directory-prefix
364 #:system system 361 #:system system
365 #:port #~port)) 362 #:port #~port))
366 363
@@ -371,8 +368,8 @@ Btrfs root file system resides."
371 (keymap* (and layout 368 (keymap* (and layout
372 (keyboard-layout-file layout #:grub grub))) 369 (keyboard-layout-file layout #:grub grub)))
373 (keymap (and keymap* 370 (keymap (and keymap*
374 (if btrfs-subvolume-file-name 371 (if store-directory-prefix
375 #~(string-append #$btrfs-subvolume-file-name 372 #~(string-append #$store-directory-prefix
376 #$keymap*) 373 #$keymap*)
377 keymap*)))) 374 keymap*))))
378 #~(when #$keymap 375 #~(when #$keymap