All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN
@ 2022-01-28 10:30 Hans de Goede
  2022-01-28 10:30 ` [PATCH 1/2] normal/menu: Don't show "Booting `%s'" msg when auto-booting " Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hans de Goede @ 2022-01-28 10:30 UTC (permalink / raw)
  To: grub-devel; +Cc: Robbie Harwood, Hans de Goede

Hi All,

This series in essence is a renewed attempt to get grub to really
be truly hidden when autobooting with TIMEOUT_STYLE_HIDDEN.

This is something which multiple big Linux distributions want,
this is a minimized version of my previous attempt from March 2018:
https://lists.gnu.org/archive/html/grub-devel/2018-03/msg00126.html
With some discussion about this patch in April 2018:
https://lists.gnu.org/archive/html/grub-devel/2018-04/msg00009.html

The first patch silences the notify_booting() callback from
grub-core/normal/menu.c based on the timeout_style (1), as
suggested in the original discussion.

After that there is just one message left, from grub-core/kern/main.c
which is printed before the config file loads. When timeout_style
is not set to hidden this will only show very briefly to then be
replaced by the menu / countdown; and with timeout_style=hidden
we actually want it to behave the same as any other grub messages
and have it hidden. The second patch makes this happen by just
disabling the logging of the message for EFI builds.

This also fixes the message briefly flashing by (in an ugly manner
because of the "flash" part) when timeout_style!=hidden.

Regards,

Hans


1) It is only silenced when autobooting with TIMEOUT_STYLE_HIDDEN


Hans de Goede (2):
  normal/menu: Don't show "Booting `%s'" msg when auto-booting with
    TIMEOUT_STYLE_HIDDEN
  EFI: suppress the "Welcome to GRUB!" message in EFI builds

 grub-core/kern/main.c   |  3 +++
 grub-core/normal/menu.c | 25 +++++++++++++++++--------
 2 files changed, 20 insertions(+), 8 deletions(-)

-- 
2.33.1



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

* [PATCH 1/2] normal/menu: Don't show "Booting `%s'" msg when auto-booting with TIMEOUT_STYLE_HIDDEN
  2022-01-28 10:30 [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN Hans de Goede
@ 2022-01-28 10:30 ` Hans de Goede
  2022-01-31 18:00   ` Robbie Harwood
  2022-01-28 10:30 ` [PATCH 2/2] EFI: suppress the "Welcome to GRUB!" message in EFI builds Hans de Goede
  2022-03-04 10:36 ` [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN Hans de Goede
  2 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2022-01-28 10:30 UTC (permalink / raw)
  To: grub-devel; +Cc: Robbie Harwood, Hans de Goede

When the user has asked the menu code to be hidden/quiet and the current
entry is being autobooted because the timeout has expired don't show
the "Booting `%s'" msg.

This is necessary to let flicker-free boots really be flicker free,
otherwise the "Booting `%s'" msg will kick the EFI fb into text mode
and show the msg, breaking the flicker-free experience.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 grub-core/normal/menu.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
index 8397886fa..fa4871a62 100644
--- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c
@@ -573,13 +573,15 @@ print_countdown (struct grub_term_coordinate *pos, int n)
    entry to be executed is a result of an automatic default selection because
    of the timeout.  */
 static int
-run_menu (grub_menu_t menu, int nested, int *auto_boot)
+run_menu (grub_menu_t menu, int nested, int *auto_boot, int *notify_boot)
 {
   grub_uint64_t saved_time;
   int default_entry, current_entry;
   int timeout;
   enum timeout_style timeout_style;
 
+  *notify_boot = 1;
+
   default_entry = get_entry_number (menu, "default");
 
   /* If DEFAULT_ENTRY is not within the menu entries, fall back to
@@ -654,6 +656,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
   if (timeout == 0)
     {
       *auto_boot = 1;
+      *notify_boot = timeout_style != TIMEOUT_STYLE_HIDDEN;
       return default_entry;
     }
 
@@ -807,12 +810,16 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
 
 /* Callback invoked immediately before a menu entry is executed.  */
 static void
-notify_booting (grub_menu_entry_t entry,
-		void *userdata __attribute__((unused)))
+notify_booting (grub_menu_entry_t entry, void *userdata)
 {
-  grub_printf ("  ");
-  grub_printf_ (N_("Booting `%s'"), entry->title);
-  grub_printf ("\n\n");
+  int *notify_boot = userdata;
+
+  if (*notify_boot)
+    {
+      grub_printf ("  ");
+      grub_printf_ (N_("Booting `%s'"), entry->title);
+      grub_printf ("\n\n");
+    }
 }
 
 /* Callback invoked when a default menu entry executed because of a timeout
@@ -860,8 +867,9 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
       int boot_entry;
       grub_menu_entry_t e;
       int auto_boot;
+      int notify_boot;
 
-      boot_entry = run_menu (menu, nested, &auto_boot);
+      boot_entry = run_menu (menu, nested, &auto_boot, &notify_boot);
       if (boot_entry < 0)
 	break;
 
@@ -873,7 +881,7 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
 
       if (auto_boot)
 	grub_menu_execute_with_fallback (menu, e, autobooted,
-					 &execution_callback, 0);
+					 &execution_callback, &notify_boot);
       else
 	grub_menu_execute_entry (e, 0);
       if (autobooted)
-- 
2.33.1



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

* [PATCH 2/2] EFI: suppress the "Welcome to GRUB!" message in EFI builds
  2022-01-28 10:30 [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN Hans de Goede
  2022-01-28 10:30 ` [PATCH 1/2] normal/menu: Don't show "Booting `%s'" msg when auto-booting " Hans de Goede
@ 2022-01-28 10:30 ` Hans de Goede
  2022-01-31 18:01   ` Robbie Harwood
  2022-03-04 10:36 ` [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN Hans de Goede
  2 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2022-01-28 10:30 UTC (permalink / raw)
  To: grub-devel; +Cc: Robbie Harwood, Hans de Goede

Grub EFI builds are now often used in combination with flicker-free
boot, but this breaks with upstream grub because the "Welcome to GRUB!"
message will kick the EFI fb into text mode and show the msg,
breaking the flicker-free experience.

EFI systems are so fast, that when the menu or the countdown are enabled
the message will be immediately overwritten, so in these cases not
printing the message does not matter.

And in case when the timeout_style is set to TIMEOUT_STYLE_HIDDEN,
the user has asked grub to be quiet (for example to allow flickfree
boot) annd thus the message should not be printed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 grub-core/kern/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index 73967e2f5..e811dc3b1 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -270,10 +270,13 @@ grub_main (void)
 
   grub_boot_time ("After machine init.");
 
+  /* This breaks flicker-free boot on EFI systems, so disable it there. */
+#ifndef GRUB_MACHINE_EFI
   /* Hello.  */
   grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
   grub_printf ("Welcome to GRUB!\n\n");
   grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
+#endif
 
   /* Init verifiers API. */
   grub_verifiers_init ();
-- 
2.33.1



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

* Re: [PATCH 1/2] normal/menu: Don't show "Booting `%s'" msg when auto-booting with TIMEOUT_STYLE_HIDDEN
  2022-01-28 10:30 ` [PATCH 1/2] normal/menu: Don't show "Booting `%s'" msg when auto-booting " Hans de Goede
@ 2022-01-31 18:00   ` Robbie Harwood
  0 siblings, 0 replies; 7+ messages in thread
From: Robbie Harwood @ 2022-01-31 18:00 UTC (permalink / raw)
  To: Hans de Goede, grub-devel; +Cc: Hans de Goede

[-- Attachment #1: Type: text/plain, Size: 658 bytes --]

Hans de Goede <hdegoede@redhat.com> writes:

> When the user has asked the menu code to be hidden/quiet and the current
> entry is being autobooted because the timeout has expired don't show
> the "Booting `%s'" msg.
>
> This is necessary to let flicker-free boots really be flicker free,
> otherwise the "Booting `%s'" msg will kick the EFI fb into text mode
> and show the msg, breaking the flicker-free experience.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  grub-core/normal/menu.c | 24 ++++++++++++++++--------
>  1 file changed, 16 insertions(+), 8 deletions(-)

Reviewed-by: Robbie Harwood <rharwood@redhat.com>

Be well,
--Robbie

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

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

* Re: [PATCH 2/2] EFI: suppress the "Welcome to GRUB!" message in EFI builds
  2022-01-28 10:30 ` [PATCH 2/2] EFI: suppress the "Welcome to GRUB!" message in EFI builds Hans de Goede
@ 2022-01-31 18:01   ` Robbie Harwood
  0 siblings, 0 replies; 7+ messages in thread
From: Robbie Harwood @ 2022-01-31 18:01 UTC (permalink / raw)
  To: Hans de Goede, grub-devel; +Cc: Hans de Goede

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

Hans de Goede <hdegoede@redhat.com> writes:

> Grub EFI builds are now often used in combination with flicker-free
> boot, but this breaks with upstream grub because the "Welcome to GRUB!"
> message will kick the EFI fb into text mode and show the msg,
> breaking the flicker-free experience.
>
> EFI systems are so fast, that when the menu or the countdown are enabled
> the message will be immediately overwritten, so in these cases not
> printing the message does not matter.
>
> And in case when the timeout_style is set to TIMEOUT_STYLE_HIDDEN,
> the user has asked grub to be quiet (for example to allow flickfree
> boot) annd thus the message should not be printed.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Robbie Harwood <rharwood@redhat.com>

Be well,
--Robbie

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

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

* Re: [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN
  2022-01-28 10:30 [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN Hans de Goede
  2022-01-28 10:30 ` [PATCH 1/2] normal/menu: Don't show "Booting `%s'" msg when auto-booting " Hans de Goede
  2022-01-28 10:30 ` [PATCH 2/2] EFI: suppress the "Welcome to GRUB!" message in EFI builds Hans de Goede
@ 2022-03-04 10:36 ` Hans de Goede
  2022-03-22 13:46   ` Daniel Kiper
  2 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2022-03-04 10:36 UTC (permalink / raw)
  To: Daniel Kiper; +Cc: Robbie Harwood, grub-devel

Hi Daniel,

On 1/28/22 11:30, Hans de Goede wrote:
> Hi All,
> 
> This series in essence is a renewed attempt to get grub to really
> be truly hidden when autobooting with TIMEOUT_STYLE_HIDDEN.
> 
> This is something which multiple big Linux distributions want,
> this is a minimized version of my previous attempt from March 2018:
> https://lists.gnu.org/archive/html/grub-devel/2018-03/msg00126.html
> With some discussion about this patch in April 2018:
> https://lists.gnu.org/archive/html/grub-devel/2018-04/msg00009.html
> 
> The first patch silences the notify_booting() callback from
> grub-core/normal/menu.c based on the timeout_style (1), as
> suggested in the original discussion.
> 
> After that there is just one message left, from grub-core/kern/main.c
> which is printed before the config file loads. When timeout_style
> is not set to hidden this will only show very briefly to then be
> replaced by the menu / countdown; and with timeout_style=hidden
> we actually want it to behave the same as any other grub messages
> and have it hidden. The second patch makes this happen by just
> disabling the logging of the message for EFI builds.
> 
> This also fixes the message briefly flashing by (in an ugly manner
> because of the "flash" part) when timeout_style!=hidden.
> 
> Regards,
> 
> Hans
> 
> 
> 1) It is only silenced when autobooting with TIMEOUT_STYLE_HIDDEN

What is the status of this series? It has been well over a month and both
patches have received a Reviewed-by and no other comments:

Reviewed-by: Robbie Harwood <rharwood@redhat.com>

Regards,

Hans






> Hans de Goede (2):
>   normal/menu: Don't show "Booting `%s'" msg when auto-booting with
>     TIMEOUT_STYLE_HIDDEN
>   EFI: suppress the "Welcome to GRUB!" message in EFI builds
> 
>  grub-core/kern/main.c   |  3 +++
>  grub-core/normal/menu.c | 25 +++++++++++++++++--------
>  2 files changed, 20 insertions(+), 8 deletions(-)
> 



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

* Re: [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN
  2022-03-04 10:36 ` [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN Hans de Goede
@ 2022-03-22 13:46   ` Daniel Kiper
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Kiper @ 2022-03-22 13:46 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Daniel Kiper, Robbie Harwood, grub-devel

On Fri, Mar 04, 2022 at 11:36:30AM +0100, Hans de Goede wrote:
> Hi Daniel,
>
> On 1/28/22 11:30, Hans de Goede wrote:
> > Hi All,
> >
> > This series in essence is a renewed attempt to get grub to really
> > be truly hidden when autobooting with TIMEOUT_STYLE_HIDDEN.
> >
> > This is something which multiple big Linux distributions want,
> > this is a minimized version of my previous attempt from March 2018:
> > https://lists.gnu.org/archive/html/grub-devel/2018-03/msg00126.html
> > With some discussion about this patch in April 2018:
> > https://lists.gnu.org/archive/html/grub-devel/2018-04/msg00009.html
> >
> > The first patch silences the notify_booting() callback from
> > grub-core/normal/menu.c based on the timeout_style (1), as
> > suggested in the original discussion.
> >
> > After that there is just one message left, from grub-core/kern/main.c
> > which is printed before the config file loads. When timeout_style
> > is not set to hidden this will only show very briefly to then be
> > replaced by the menu / countdown; and with timeout_style=hidden
> > we actually want it to behave the same as any other grub messages
> > and have it hidden. The second patch makes this happen by just
> > disabling the logging of the message for EFI builds.
> >
> > This also fixes the message briefly flashing by (in an ugly manner
> > because of the "flash" part) when timeout_style!=hidden.
> >
> > Regards,
> >
> > Hans
> >
> >
> > 1) It is only silenced when autobooting with TIMEOUT_STYLE_HIDDEN
>
> What is the status of this series? It has been well over a month and both
> patches have received a Reviewed-by and no other comments:
>
> Reviewed-by: Robbie Harwood <rharwood@redhat.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


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

end of thread, other threads:[~2022-03-22 13:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28 10:30 [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN Hans de Goede
2022-01-28 10:30 ` [PATCH 1/2] normal/menu: Don't show "Booting `%s'" msg when auto-booting " Hans de Goede
2022-01-31 18:00   ` Robbie Harwood
2022-01-28 10:30 ` [PATCH 2/2] EFI: suppress the "Welcome to GRUB!" message in EFI builds Hans de Goede
2022-01-31 18:01   ` Robbie Harwood
2022-03-04 10:36 ` [PATCH 0/2] EFI/menu: Do not print messages when autobooting with TIMEOUT_STYLE_HIDDEN Hans de Goede
2022-03-22 13:46   ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.