nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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