grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Update 00_header to load efi video on EFI platforms
@ 2025-11-06  2:47 Andrew Hamilton
  2025-11-06  2:47 ` [PATCH 1/3] util/grub.d/00_header.in: Disable loading all_video for EFI Andrew Hamilton
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrew Hamilton @ 2025-11-06  2:47 UTC (permalink / raw)
  To: grub-devel; +Cc: daniel.kiper, safinaskar, benh, bluca, kibi, Andrew Hamilton

This is a new attempt to fix the issue with video corruption that can
occur in some cases on EFI when all_video is loaded. Previously, the
proposed change was to disable building video_bochs and video_cirrus
for EFI completely, however there was concern around this approach.

Previous thread:
https://lists.gnu.org/archive/html/grub-devel/2025-09/msg00265.html

This new approach modifies the 00_header script to default to only
load efi_gop and efi_uga for EFI platforms. A new env variable is added
to force the old behavior of loading all_video for EFI if desired.

There is likely an additional change required on distros that
bundle all_video into the signed EFI GRUB image, such as Debian:
https://sources.debian.org/src/grub2/2.14~git20250718.0e36779-2/debian/build-efi-images

There is some additional analysis from the Qemu team in this thread:
https://gitlab.com/qemu-project/qemu/-/issues/2562

This is an issue on some major distros such as Debian on EFI
when running under Qemu and potentially other scenarios.

There is some discussion on the Debian side in this thread:
https://salsa.debian.org/kernel-team/linux/-/merge_requests/1453

This relates to this discussion from grub-devel also:
https://lists.gnu.org/archive/html/grub-devel/2025-09/msg00244.html

Fixes: https://savannah.gnu.org/bugs/index.php?66200

Andrew Hamilton (3):
  util/grub.d/00_header.in: Disable loading all_video for EFI
  util/grub-mkconfig: Add new environment variable
  docs: Document new GRUB_FORCE_EFI_ALLVIDEO variable

 docs/grub.texi           |  7 +++++++
 util/grub-mkconfig.in    |  3 ++-
 util/grub.d/00_header.in | 16 +++++++++++++++-
 3 files changed, 24 insertions(+), 2 deletions(-)

-- 
2.43.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] util/grub.d/00_header.in: Disable loading all_video for EFI
  2025-11-06  2:47 [PATCH 0/3] Update 00_header to load efi video on EFI platforms Andrew Hamilton
@ 2025-11-06  2:47 ` Andrew Hamilton
  2025-11-06 13:06   ` Daniel Kiper
  2025-11-06  2:47 ` [PATCH 2/3] util/grub-mkconfig: Add new environment variable Andrew Hamilton
  2025-11-06  2:47 ` [PATCH 3/3] docs: Document new GRUB_FORCE_EFI_ALLVIDEO variable Andrew Hamilton
  2 siblings, 1 reply; 5+ messages in thread
From: Andrew Hamilton @ 2025-11-06  2:47 UTC (permalink / raw)
  To: grub-devel; +Cc: daniel.kiper, safinaskar, benh, bluca, kibi, Andrew Hamilton

Loading all_video for EFI can cause video issues in some cases
since bochs / cirrus may conflict with them. 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/index.php?66200

Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
---
 util/grub.d/00_header.in | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 9d36feda3..a4a516aec 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -124,10 +124,24 @@ if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
   insmod ${GRUB_VIDEO_BACKEND}
 EOF
 else
+# For EFI, use EFI video by default to avoid conflict between
+# bochs / cirrus and EFI video. If GRUB_FORCE_EFI_ALLVIDEO is
+# set/true then defer back to all_video even for EFI.
+if [ "${GRUB_FORCE_EFI_ALLVIDEO}" = "1" ]; then
+    cat <<EOF
+  if [ x\$feature_all_video_module = xy ]; then
+EOF
+else # GRUB_FORCE_EFI_ALLVIDEO 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_ALLVIDEO
 # 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
-- 
2.43.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] util/grub-mkconfig: Add new environment variable
  2025-11-06  2:47 [PATCH 0/3] Update 00_header to load efi video on EFI platforms Andrew Hamilton
  2025-11-06  2:47 ` [PATCH 1/3] util/grub.d/00_header.in: Disable loading all_video for EFI Andrew Hamilton
@ 2025-11-06  2:47 ` Andrew Hamilton
  2025-11-06  2:47 ` [PATCH 3/3] docs: Document new GRUB_FORCE_EFI_ALLVIDEO variable Andrew Hamilton
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Hamilton @ 2025-11-06  2:47 UTC (permalink / raw)
  To: grub-devel; +Cc: daniel.kiper, safinaskar, benh, bluca, kibi, Andrew Hamilton

Add a new environment variable called GRUB_FORCE_EFI_ALLVIDEO
to allow forcing GRUB to load all_video on EFI platforms. This
is added to support cases where some EFI platform needs one of
the legacy video modules.

Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
---
 util/grub-mkconfig.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 32c480dae..ddb9f4dbf 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -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_ALLVIDEO
 
 if test "x${grub_cfg}" != "x"; then
   rm -f "${grub_cfg}.new"
-- 
2.43.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] docs: Document new GRUB_FORCE_EFI_ALLVIDEO variable
  2025-11-06  2:47 [PATCH 0/3] Update 00_header to load efi video on EFI platforms Andrew Hamilton
  2025-11-06  2:47 ` [PATCH 1/3] util/grub.d/00_header.in: Disable loading all_video for EFI Andrew Hamilton
  2025-11-06  2:47 ` [PATCH 2/3] util/grub-mkconfig: Add new environment variable Andrew Hamilton
@ 2025-11-06  2:47 ` Andrew Hamilton
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Hamilton @ 2025-11-06  2:47 UTC (permalink / raw)
  To: grub-devel; +Cc: daniel.kiper, safinaskar, benh, bluca, kibi, Andrew Hamilton

Document the new GRUB_FORCE_EFI_ALLVIDEO variable
used by control whether grub-mkconfig will default
to loading just EFI video modules on EFI platforms
or all_video on EFI platforms.

Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
---
 docs/grub.texi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/grub.texi b/docs/grub.texi
index 5b23ae47b..669bc2c23 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -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_ALLVIDEO
+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
-- 
2.43.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] util/grub.d/00_header.in: Disable loading all_video for EFI
  2025-11-06  2:47 ` [PATCH 1/3] util/grub.d/00_header.in: Disable loading all_video for EFI Andrew Hamilton
@ 2025-11-06 13:06   ` Daniel Kiper
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Kiper @ 2025-11-06 13:06 UTC (permalink / raw)
  To: Andrew Hamilton; +Cc: grub-devel, safinaskar, benh, bluca, kibi

On Wed, Nov 05, 2025 at 08:47:54PM -0600, Andrew Hamilton wrote:
> Loading all_video for EFI can cause video issues in some cases
> since bochs / cirrus may conflict with them. Change default

s#bochs / cirrus may conflict with them#GRUB Bochs/Cirrus drivers may conflict with native EFI drivers#

> 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/index.php?66200
>
> Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
> ---
>  util/grub.d/00_header.in | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
> index 9d36feda3..a4a516aec 100644
> --- a/util/grub.d/00_header.in
> +++ b/util/grub.d/00_header.in
> @@ -124,10 +124,24 @@ if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
>    insmod ${GRUB_VIDEO_BACKEND}
>  EOF
>  else
> +# For EFI, use EFI video by default to avoid conflict between

s/EFI video/EFI video drivers only/

> +# bochs / cirrus and EFI video. If GRUB_FORCE_EFI_ALLVIDEO is

s#bochs / cirrus and EFI video#GRUB Bochs/Cirrus and native EFI drivers#

... or something like that...

> +# set/true then defer back to all_video even for EFI.
> +if [ "${GRUB_FORCE_EFI_ALLVIDEO}" = "1" ]; then

s/GRUB_FORCE_EFI_ALLVIDEO/GRUB_FORCE_EFI_ALL_VIDEO/

... to make naming consistent with currently existing names...

And I would merge all three patches into one.

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-06 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-06  2:47 [PATCH 0/3] Update 00_header to load efi video on EFI platforms Andrew Hamilton
2025-11-06  2:47 ` [PATCH 1/3] util/grub.d/00_header.in: Disable loading all_video for EFI Andrew Hamilton
2025-11-06 13:06   ` Daniel Kiper
2025-11-06  2:47 ` [PATCH 2/3] util/grub-mkconfig: Add new environment variable Andrew Hamilton
2025-11-06  2:47 ` [PATCH 3/3] docs: Document new GRUB_FORCE_EFI_ALLVIDEO variable Andrew Hamilton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).