From 2e8985113bd99ca64d7767c628860bcc8faa4043 Mon Sep 17 00:00:00 2001 From: Vivian Wang Date: Wed, 17 Dec 2025 14:03:30 +0800 Subject: [PATCH] stub: Use log_debug if addons has no applicable sections This can happen expectedly if an addon purely provides .dtbauto sections, and there's no match for this machine. Reduce the log message of this case to "debug" level. --- src/boot/stub.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/boot/stub.c b/src/boot/stub.c index d45eead2790..06ecbc7d18f 100644 --- a/src/boot/stub.c +++ b/src/boot/stub.c @@ -627,20 +627,23 @@ static EFI_STATUS load_addons( return log_error_status(err, "Failed to find protocol in %ls: %m", items[i]); err = pe_memory_locate_sections(loaded_addon->ImageBase, unified_sections, sections); - if (err != EFI_SUCCESS || - (!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_CMDLINE) && - !PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_DTB) && - !PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_DTBAUTO) && - !PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_INITRD) && - !PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_UCODE))) { - if (err == EFI_SUCCESS) - err = EFI_NOT_FOUND; + if (err != EFI_SUCCESS) { log_error_status(err, "Unable to locate embedded .cmdline/.dtb/.dtbauto/.initrd/.ucode sections in %ls, ignoring: %m", items[i]); continue; } + if (!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_CMDLINE) && + !PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_DTB) && + !PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_DTBAUTO) && + !PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_INITRD) && + !PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_UCODE)) { + log_debug("No applicable .cmdline/.dtb/.dtbauto/.initrd/.ucode sections found in %ls, ignoring.", + items[i]); + continue; + } + /* We want to enforce that addons are not UKIs, i.e.: they must not embed a kernel. */ if (PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_LINUX)) { log_error("%ls is a UKI, not an addon, ignoring.", items[i]); -- 2.47.3