From 8f3a541a3d096e5b8cd70112632bd8a6af283010 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 13 May 2018 16:59:51 -0400 Subject: nixos/grub: Updates `splashImage` description to match reality. Fixes #4911 --- nixos/modules/system/boot/loader/grub/grub.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index e2cff1c1bd94..67daaa333e5e 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -308,10 +308,22 @@ in type = types.nullOr types.path; example = literalExample "./my-background.png"; description = '' - Background image used for GRUB. It must be a 640x480, + Background image used for GRUB. + Set to null to run GRUB in text mode. + + + For grub 1: + It must be a 640x480, 14-colour image in XPM format, optionally compressed with - gzip or bzip2. Set to - null to run GRUB in text mode. + gzip or bzip2. + + + + For grub 2: + File must be one of .png, .tga, .jpg, or .jpeg. JPEG images must + not be progressive. + The image will be scaled if necessary to fit the screen. + ''; }; -- cgit 1.4.1 From 0ccfe14e25771d83460305ee09d99cb449eea15a Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 13 May 2018 19:51:50 -0400 Subject: nixos/grub: Implements use of file format for splashImage. GRUB 2.0 supports png, jpeg and tga. This will use the image's suffix to load the right module. As jpeg module is named jpeg, jpg is renamed jpeg. If the user uses wrong image suffix for an image, it wouldn't work anyway. This will leave up to two additional left-over files in /boot/ if user switches through all the supported file formats. The module already left the png image if the user disabled the splash image. --- nixos/modules/system/boot/loader/grub/install-grub.pl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl index 8bd203106f55..1aa14729a75c 100644 --- a/nixos/modules/system/boot/loader/grub/install-grub.pl +++ b/nixos/modules/system/boot/loader/grub/install-grub.pl @@ -299,12 +299,16 @@ else { copy $font, "$bootPath/converted-font.pf2" or die "cannot copy $font to $bootPath\n"; } if ($splashImage) { - # FIXME: GRUB 1.97 doesn't resize the background image if it - # doesn't match the video resolution. - copy $splashImage, "$bootPath/background.png" or die "cannot copy $splashImage to $bootPath\n"; + # Keeps the image's extension. + my ($filename, $dirs, $suffix) = fileparse($splashImage, qr"\..[^.]*$"); + # The module for jpg is jpeg. + if ($suffix eq ".jpg") { + $suffix = ".jpeg"; + } + copy $splashImage, "$bootPath/background$suffix" or die "cannot copy $splashImage to $bootPath\n"; $conf .= " - insmod png - if background_image " . $grubBoot->path . "/background.png; then + insmod " . substr($suffix, 1) . " + if background_image " . $grubBoot->path . "/background$suffix; then set color_normal=white/black set color_highlight=black/white else -- cgit 1.4.1