grub2/0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch
Nicolas Frayer e42444fde3 Stop grub.efi from always printing "dynamic_load_symbols %p\n" during boot
Resolves: #2316279
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2024-10-03 15:10:19 +02:00

81 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 3 Oct 2024 12:26:07 +0200
Subject: [PATCH] Stop grub.efi from always printing "dynamic_load_symbols
%p\n" during boot
Commit 972aa68d2bf5 ("Make a "gdb" dprintf that tells us load addresses.")
added some debug prints to help with running gdb against grub.
Besides adding a new grub_dl_print_gdb_info () function which uses
`grub_qdprintf ("gdb", ...);` it also adds a new grub_efi_print_gdb_info ()
call to grub_efi_init ().
grub_efi_print_gdb_info () is intended for the gdbinfo command and uses
a non debug grub_printf () call leading to grub now always printing this
message during boot breaking flicker-free boot.
Add a new "debug" parameter to grub_efi_print_gdb_info () and use
`grub_qdprintf ("gdb", ...);` when this is set to silence the printing
done from grub_efi_init () when debugging is not enabled.
Fixes: 972aa68d2bf5 ("Make a "gdb" dprintf that tells us load addresses.")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
grub-core/kern/efi/debug.c | 2 +-
grub-core/kern/efi/init.c | 2 +-
include/grub/efi/debug.h | 7 +++++--
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/efi/debug.c b/grub-core/kern/efi/debug.c
index 5d2ab1a36ff4..5ac194fc8f46 100644
--- a/grub-core/kern/efi/debug.c
+++ b/grub-core/kern/efi/debug.c
@@ -26,7 +26,7 @@ grub_cmd_gdbinfo (struct grub_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
{
- grub_efi_print_gdb_info ();
+ grub_efi_print_gdb_info (false);
return 0;
}
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
index d35d69747342..ce8a7fe7122f 100644
--- a/grub-core/kern/efi/init.c
+++ b/grub-core/kern/efi/init.c
@@ -157,7 +157,7 @@ grub_efi_init (void)
grub_efi_system_table->boot_services->set_watchdog_timer (0, 0, 0, NULL);
grub_efi_env_init ();
- grub_efi_print_gdb_info ();
+ grub_efi_print_gdb_info (true);
grub_efidisk_init ();
grub_efi_register_debug_commands ();
diff --git a/include/grub/efi/debug.h b/include/grub/efi/debug.h
index c2d2a03b06f1..961e591afa3e 100644
--- a/include/grub/efi/debug.h
+++ b/include/grub/efi/debug.h
@@ -27,7 +27,7 @@
void grub_efi_register_debug_commands (void);
static inline void
-grub_efi_print_gdb_info (void)
+grub_efi_print_gdb_info (bool debug)
{
grub_addr_t text;
@@ -35,7 +35,10 @@ grub_efi_print_gdb_info (void)
if (!text)
return;
- grub_printf ("dynamic_load_symbols %p\n", (void *)text);
+ if (debug)
+ grub_qdprintf ("gdb", "dynamic_load_symbols %p\n", (void *)text);
+ else
+ grub_printf ("dynamic_load_symbols %p\n", (void *)text);
}
#endif /* ! GRUB_EFI_DEBUG_HEADER */