From ddc9d2a8363f7844969c95ec2922e229f2593f47 Mon Sep 17 00:00:00 2001 From: Felix Pehla <29adc1fd92@gmail.com> Date: Thu, 21 Aug 2025 19:06:07 +0200 Subject: [PATCH] systemd-boot: don't always log NX_COMPAT info Commit 70b7e03 introduced 3 calls to log_debug() about the presence or absence of NX_COMPAT support. Since sd-boot does not yet have the ability to only print messages above a certain loglevel, these will always be printed, even on top of the configured splash screen. This commit removes the log_debug() call after a success and only prints those for missing firmware support if the UEFI should support them in the first place (i.e. starting with version 2.10). --- src/boot/linux.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/boot/linux.c b/src/boot/linux.c index f18d91e9e4..92a2b0afc5 100644 --- a/src/boot/linux.c +++ b/src/boot/linux.c @@ -132,7 +132,10 @@ static EFI_STATUS kernel_set_nx(EFI_PHYSICAL_ADDRESS addr, uint64_t length) { err = BS->LocateProtocol(MAKE_GUID_PTR(EFI_MEMORY_ATTRIBUTE_PROTOCOL), NULL, (void **) &memory_proto); if (err != EFI_SUCCESS) { - log_debug("No EFI_MEMORY_ATTRIBUTE_PROTOCOL found, skipping NX_COMPAT support."); + /* only log if the UEFI should have support in the first place (version >=2.10) */ + if (ST->Hdr.Revision >= ((2U << 16) | 100U)) + log_debug("No EFI_MEMORY_ATTRIBUTE_PROTOCOL found, skipping NX_COMPAT support."); + return EFI_SUCCESS; /* ignore if firmware lacks support */ } @@ -144,8 +147,6 @@ static EFI_STATUS kernel_set_nx(EFI_PHYSICAL_ADDRESS addr, uint64_t length) { if (err != EFI_SUCCESS) return log_error_status(err, "Cannot make kernel image executable: %m"); - log_debug("Changed kernel image to read-only for NX_COMPAT support."); - return EFI_SUCCESS; } @@ -155,7 +156,10 @@ static EFI_STATUS kernel_clear_nx(EFI_PHYSICAL_ADDRESS addr, uint64_t length) { err = BS->LocateProtocol(MAKE_GUID_PTR(EFI_MEMORY_ATTRIBUTE_PROTOCOL), NULL, (void **) &memory_proto); if (err != EFI_SUCCESS) { - log_debug("No EFI_MEMORY_ATTRIBUTE_PROTOCOL found, skipping NX_COMPAT support."); + /* only log if the UEFI should have support in the first place (version >=2.10) */ + if (ST->Hdr.Revision >= ((2U << 16) | 100U)) + log_debug("No EFI_MEMORY_ATTRIBUTE_PROTOCOL found, skipping NX_COMPAT support."); + return EFI_SUCCESS; /* ignore if firmware lacks support */ }