]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
util/grub.d/00_header.in: Disable loading all_video for EFI
authorAndrew Hamilton <adhamilt@gmail.com>
Fri, 7 Nov 2025 00:24:33 +0000 (18:24 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 18 Nov 2025 11:49:31 +0000 (12:49 +0100)
Loading all_video for EFI can cause video issues in some cases
since GRUB Bochs/Cirrus drivers may conflict with native EFI drivers.
Change default behavior for EFI to only load EFI specific video
modules. Also include a new environment variable to restore the old
behavior if needed.

Fixes: https://savannah.gnu.org/bugs/?66200
Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
docs/grub.texi
util/grub-mkconfig.in
util/grub.d/00_header.in

index cd4631aa3277bdf82d14b92ae63d48034ee05c29..d4287181c8dc888861a7ce2968bbbfa0d3fd4676 100644 (file)
@@ -1642,6 +1642,13 @@ This option is unset by default, and is deprecated in favour of the less
 confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
 @samp{GRUB_TIMEOUT_STYLE=hidden}.
 
+@item GRUB_FORCE_EFI_ALL_VIDEO
+When set to true, this will allow grub-mkconfig to generate a GRUB config
+that supports loading the all_video module on the EFI platform instead of
+just the efi_gop and efi_uga modules.
+
+This option is unset by default.
+
 @end table
 
 For more detailed customisation of @command{grub-mkconfig}'s output, you may
index 32c480daeb2e88c779e1b82e240c8186150a52d7..45787a1d1f564e19eabee8aa15ea2ad95ac28c5d 100644 (file)
@@ -255,7 +255,8 @@ export GRUB_DEFAULT \
   GRUB_ENABLE_CRYPTODISK \
   GRUB_BADRAM \
   GRUB_OS_PROBER_SKIP_LIST \
-  GRUB_DISABLE_SUBMENU
+  GRUB_DISABLE_SUBMENU \
+  GRUB_FORCE_EFI_ALL_VIDEO
 
 if test "x${grub_cfg}" != "x"; then
   rm -f "${grub_cfg}.new"
index 9d36feda3be30b912ce01c86730568f10527c228..77834cfaff562cc234e41a1784e80da3742d811e 100644 (file)
@@ -124,10 +124,24 @@ if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
   insmod ${GRUB_VIDEO_BACKEND}
 EOF
 else
+# For EFI, use EFI video drivers only by default to avoid conflict between
+# GRUB Bochs/Cirrus and native EFI drivers. If GRUB_FORCE_EFI_ALL_VIDEO is
+# set/true then defer back to all_video even for EFI.
+if [ "${GRUB_FORCE_EFI_ALL_VIDEO}" = "1" ]; then
+    cat <<EOF
+  if [ x\$feature_all_video_module = xy ]; then
+EOF
+else # GRUB_FORCE_EFI_ALL_VIDEO is not set true
+    cat <<EOF
+  if [ x\$grub_platform = xefi ]; then
+    insmod efi_gop
+    insmod efi_uga
+  elif [ x\$feature_all_video_module = xy ]; then
+EOF
+fi # end GRUB_FORCE_EFI_ALL_VIDEO
 # If all_video.mod isn't available load all modules available
 # with versions prior to introduction of all_video.mod
 cat <<EOF
-  if [ x\$feature_all_video_module = xy ]; then
     insmod all_video
   else
     insmod efi_gop