Blame SOURCES/0194-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch

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