Stop grub.efi from always printing "dynamic_load_symbols %p\n" during boot

Resolves: #2316279
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
This commit is contained in:
Nicolas Frayer 2024-10-03 15:10:19 +02:00
parent d0e3049f97
commit e42444fde3
3 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,80 @@
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 */

View File

@ -274,3 +274,4 @@ Patch0273: 0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch
Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch
Patch0275: 0275-load-EFI-commands-inside-test-expressions.patch Patch0275: 0275-load-EFI-commands-inside-test-expressions.patch
Patch0276: 0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch Patch0276: 0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch
Patch0277: 0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch

View File

@ -17,7 +17,7 @@
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.12 Version: 2.12
Release: 8%{?dist} Release: 9%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more Summary: Bootloader with support for Linux, Multiboot and more
License: GPL-3.0-or-later License: GPL-3.0-or-later
URL: http://www.gnu.org/software/grub/ URL: http://www.gnu.org/software/grub/
@ -560,6 +560,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
%endif %endif
%changelog %changelog
* Thu Oct 3 2024 Nicolas Frayer <nfrayer@redhat.com> 2.12-9
- Stop grub.efi from always printing "dynamic_load_symbols %p\n" during boot
- Resolves: #2316279
* Wed Sep 25 2024 Nicolas Frayer <nfrayer@redhat.com> 2.12-8 * Wed Sep 25 2024 Nicolas Frayer <nfrayer@redhat.com> 2.12-8
- NX: efi/loader, add a call to grub_efi_check_nx_required() - NX: efi/loader, add a call to grub_efi_check_nx_required()