bootloader: grub: Add gfxmode (resolution) override.
authorJan Nieuwenhuizen <janneke@gnu.org>
Mon, 30 Dec 2019 10:25:40 +0000 (11:25 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 25 Jan 2020 15:09:12 +0000 (16:09 +0100)
* gnu/bootloader/grub.scm (<grub-theme>): Add `gfxmode' entry.
(eye-candy): Use it.
* doc/guix.texi (Bootloader Configuration): Document it.

doc/guix.texi
gnu/bootloader/grub.scm

index d674b94..3141c45 100644 (file)
@@ -26101,9 +26101,22 @@ must @emph{not} be an OS device name such as @file{/dev/sda1}.
 @end table
 @end deftp
 
+@cindex HDPI
+@cindex HiDPI
+@cindex resolution
 @c FIXME: Write documentation once it's stable.
-For now only GRUB has theme support. GRUB themes are created using
-the @code{grub-theme} form, which is not documented yet.
+For now only GRUB has theme support.  GRUB themes are created using
+the @code{grub-theme} form, which is not fully documented yet.
+
+@deftp {Data Type} grub-theme
+Data type representing the configuration of the GRUB theme.
+
+@table @asis
+@item @code{gfxmode} (default: @code{'("auto")})
+The GRUB @code{gfxmode} to set (a list of screen resolution strings, see
+@pxref{gfxmode,,, grub, GNU GRUB manual}).
+@end table
+@end deftp
 
 @defvr {Scheme Variable} %default-theme
 This is the default GRUB theme used by the operating system if no
@@ -26114,6 +26127,17 @@ It comes with a fancy background image displaying the GNU and Guix
 logos.
 @end defvr
 
+For example, to override the default resolution, you may use something
+like
+
+@lisp
+(bootloader
+ (grub-configuration
+ ;; @dots{}
+ (theme (grub-theme
+         (inherit %default-theme)
+         (gfxmode '("1024x786x32" "auto"))))))
+@end lisp
 
 @node Invoking guix system
 @section Invoking @code{guix system}
index f13685a..b99f5fa 100644 (file)
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -88,7 +89,9 @@ denoting a file name."
   (color-normal    grub-theme-color-normal
                    (default '((fg . cyan) (bg . blue))))
   (color-highlight grub-theme-color-highlight
-                   (default '((fg . white) (bg . blue)))))
+                   (default '((fg . white) (bg . blue))))
+  (gfxmode         grub-gfxmode
+                   (default '("auto"))))          ;list of string
 
 (define %background-image
   (grub-image
@@ -149,8 +152,16 @@ system string---e.g., \"x86_64-linux\"."
     ;; most other modern architectures have no other mode and therefore don't
     ;; need to be switched.
     (if (string-match "^(x86_64|i[3-6]86)-" system)
-        "
-  # Leave 'gfxmode' to 'auto'.
+        (string-append
+         "
+"
+         (let ((gfxmode (and=>
+                         (and=> config bootloader-configuration-theme)
+                         grub-gfxmode)))
+           (if gfxmode
+               (string-append "set gfxmode=" (string-join gfxmode ";"))
+               "# Leave 'gfxmode' to 'auto'."))
+         "
   insmod video_bochs
   insmod video_cirrus
   insmod gfxterm
@@ -166,7 +177,7 @@ system string---e.g., \"x86_64-linux\"."
     insmod vbe
     insmod vga
   fi
-"
+")
         ""))
 
   (define (setup-gfxterm config font-file)