8a74d28
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8a74d28
From: Hans de Goede <hdegoede@redhat.com>
8a74d28
Date: Fri, 28 Jan 2022 11:30:32 +0100
8a74d28
Subject: [PATCH] normal/menu: Don't show "Booting `%s'" msg when auto-booting
8a74d28
 with TIMEOUT_STYLE_HIDDEN
8a74d28
8a74d28
When the user has asked the menu code to be hidden/quiet and the current
8a74d28
entry is being autobooted because the timeout has expired don't show
8a74d28
the "Booting `%s'" msg.
8a74d28
8a74d28
This is necessary to let flicker-free boots really be flicker free,
8a74d28
otherwise the "Booting `%s'" msg will kick the EFI fb into text mode
8a74d28
and show the msg, breaking the flicker-free experience.
8a74d28
8a74d28
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
8a74d28
---
8a74d28
 grub-core/normal/menu.c | 24 ++++++++++++++++--------
8a74d28
 1 file changed, 16 insertions(+), 8 deletions(-)
8a74d28
8a74d28
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
e622855
index ec0c92bade..c8516a5a08 100644
8a74d28
--- a/grub-core/normal/menu.c
8a74d28
+++ b/grub-core/normal/menu.c
8a74d28
@@ -606,13 +606,15 @@ print_countdown (struct grub_term_coordinate *pos, int n)
8a74d28
    entry to be executed is a result of an automatic default selection because
8a74d28
    of the timeout.  */
8a74d28
 static int
8a74d28
-run_menu (grub_menu_t menu, int nested, int *auto_boot)
8a74d28
+run_menu (grub_menu_t menu, int nested, int *auto_boot, int *notify_boot)
8a74d28
 {
8a74d28
   grub_uint64_t saved_time;
8a74d28
   int default_entry, current_entry;
8a74d28
   int timeout;
8a74d28
   enum timeout_style timeout_style;
8a74d28
 
8a74d28
+  *notify_boot = 1;
8a74d28
+
8a74d28
   default_entry = get_entry_number (menu, "default");
8a74d28
 
8a74d28
   /* If DEFAULT_ENTRY is not within the menu entries, fall back to
8a74d28
@@ -687,6 +689,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
8a74d28
   if (timeout == 0)
8a74d28
     {
8a74d28
       *auto_boot = 1;
8a74d28
+      *notify_boot = timeout_style != TIMEOUT_STYLE_HIDDEN;
8a74d28
       return default_entry;
8a74d28
     }
8a74d28
 
8a74d28
@@ -840,12 +843,16 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
8a74d28
 
8a74d28
 /* Callback invoked immediately before a menu entry is executed.  */
8a74d28
 static void
8a74d28
-notify_booting (grub_menu_entry_t entry,
8a74d28
-		void *userdata __attribute__((unused)))
8a74d28
+notify_booting (grub_menu_entry_t entry, void *userdata)
8a74d28
 {
8a74d28
-  grub_printf ("  ");
8a74d28
-  grub_printf_ (N_("Booting `%s'"), entry->title);
8a74d28
-  grub_printf ("\n\n");
8a74d28
+  int *notify_boot = userdata;
8a74d28
+
8a74d28
+  if (*notify_boot)
8a74d28
+    {
8a74d28
+      grub_printf ("  ");
8a74d28
+      grub_printf_ (N_("Booting `%s'"), entry->title);
8a74d28
+      grub_printf ("\n\n");
8a74d28
+    }
8a74d28
 }
8a74d28
 
8a74d28
 /* Callback invoked when a default menu entry executed because of a timeout
8a74d28
@@ -893,8 +900,9 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
8a74d28
       int boot_entry;
8a74d28
       grub_menu_entry_t e;
8a74d28
       int auto_boot;
8a74d28
+      int notify_boot;
8a74d28
 
8a74d28
-      boot_entry = run_menu (menu, nested, &auto_boot);
8a74d28
+      boot_entry = run_menu (menu, nested, &auto_boot, &notify_boot);
8a74d28
       if (boot_entry < 0)
8a74d28
 	break;
8a74d28
 
8a74d28
@@ -906,7 +914,7 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
8a74d28
 
8a74d28
       if (auto_boot)
8a74d28
 	grub_menu_execute_with_fallback (menu, e, autobooted,
8a74d28
-					 &execution_callback, 0);
8a74d28
+					 &execution_callback, &notify_boot);
8a74d28
       else
8a74d28
 	grub_menu_execute_entry (e, 0);
8a74d28
       if (autobooted)