summaryrefslogtreecommitdiff
path: root/gnu/bootloader/grub.scm
diff options
context:
space:
mode:
authorStefan <stefan-guix@vodafonemail.de>2020-06-09 14:16:59 +0200
committerMathieu Othacehe <othacehe@gnu.org>2020-06-09 17:18:21 +0200
commit536c53d347291dcc75e1073af6e6c5c614e0fff4 (patch)
tree3149c2fac55ada53e091f3c2df009c051d14a548 /gnu/bootloader/grub.scm
parent141b5c162048f5cb52e8c90ff7c16a2e98babcfb (diff)
gnu: grub: Support graphical gfxterm on all systems.
* gnu/bootloaders/grub.scm (eye-candy): Use gfxterm depending only on (bootloader-configuration (terminal-outputs …)), which defaults to '(gfxterm). This makes the system argument obsolete. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'gnu/bootloader/grub.scm')
-rw-r--r--gnu/bootloader/grub.scm47
1 files changed, 14 insertions, 33 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index d4dbb571315..fa391fd6b44 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -5,6 +5,7 @@
5;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com> 5;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
6;;; Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> 6;;; Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
7;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> 7;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
8;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de>
8;;; 9;;;
9;;; This file is part of GNU Guix. 10;;; This file is part of GNU Guix.
10;;; 11;;;
@@ -135,41 +136,25 @@ file with the resolution provided in CONFIG."
135 (_ #f))))) 136 (_ #f)))))
136 137
137(define* (eye-candy config store-device store-mount-point 138(define* (eye-candy config store-device store-mount-point
138 #:key store-directory-prefix system port) 139 #:key store-directory-prefix port)
139 "Return a gexp that writes to PORT (a port-valued gexp) the 'grub.cfg' part 140 "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. 141concerned with graphics mode, background images, colors, and all that.
141STORE-DEVICE designates the device holding the store, and STORE-MOUNT-POINT is 142STORE-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 143its 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., 144fonts must be searched for. STORE-DIRECTORY-PREFIX is a directory prefix to
144\"x86_64-linux\". STORE-DIRECTORY-PREFIX is a directory prefix to prepend to 145prepend to any store file name."
145any store file name."
146 (define setup-gfxterm-body
147 (let ((gfxmode
148 (or (and-let* ((theme (bootloader-configuration-theme config))
149 (gfxmode (grub-theme-gfxmode theme)))
150 (string-join gfxmode ";"))
151 "auto")))
152
153 ;; Intel and EFI systems need to be switched into graphics mode, whereas
154 ;; most other modern architectures have no other mode and therefore
155 ;; don't need to be switched.
156
157 ;; XXX: Do we really need to restrict to x86 systems? We could imitate
158 ;; what the GRUB default configuration does and decide based on whether
159 ;; a user provided 'gfxterm' in the terminal-outputs field of their
160 ;; bootloader-configuration record.
161 (if (string-match "^(x86_64|i[3-6]86)-" system)
162 (format #f "
163 set gfxmode=~a
164 insmod all_video
165 insmod gfxterm~%" gfxmode)
166 "")))
167
168 (define (setup-gfxterm config font-file) 146 (define (setup-gfxterm config font-file)
169 (if (memq 'gfxterm (bootloader-configuration-terminal-outputs config)) 147 (if (memq 'gfxterm (bootloader-configuration-terminal-outputs config))
170 #~(format #f "if loadfont ~a; then 148 #~(format #f "
171 setup_gfxterm 149if loadfont ~a; then
172fi~%" #+font-file) 150 set gfxmode=~a
151 insmod all_video
152 insmod gfxterm
153fi~%"
154 #$font-file
155 #$(string-join
156 (grub-theme-gfxmode (bootloader-theme config))
157 ";"))
173 "")) 158 ""))
174 159
175 (define (theme-colors type) 160 (define (theme-colors type)
@@ -190,8 +175,6 @@ fi~%" #+font-file)
190 175
191 (and image 176 (and image
192 #~(format #$port " 177 #~(format #$port "
193function setup_gfxterm {~a}
194
195# Set 'root' to the partition that contains /gnu/store. 178# Set 'root' to the partition that contains /gnu/store.
196~a 179~a
197 180
@@ -206,7 +189,6 @@ else
206 set menu_color_normal=cyan/blue 189 set menu_color_normal=cyan/blue
207 set menu_color_highlight=white/blue 190 set menu_color_highlight=white/blue
208fi~%" 191fi~%"
209 #$setup-gfxterm-body
210 #$(grub-root-search store-device font-file) 192 #$(grub-root-search store-device font-file)
211 #$(setup-gfxterm config font-file) 193 #$(setup-gfxterm config font-file)
212 #$(grub-setup-io config) 194 #$(grub-setup-io config)
@@ -380,7 +362,6 @@ menuentry ~s {
380 device 362 device
381 mount-point 363 mount-point
382 #:store-directory-prefix store-directory-prefix 364 #:store-directory-prefix store-directory-prefix
383 #:system system
384 #:port #~port))) 365 #:port #~port)))
385 366
386 (define keyboard-layout-config 367 (define keyboard-layout-config