From: Lennart Poettering Date: Tue, 25 Feb 2025 11:16:10 +0000 (+0100) Subject: boot: only do boot counting management for some menu entries X-Git-Tag: v258-rc1~1261^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=729f3c21c51cd4e5b91b52d26d8ddb34c5732729;p=thirdparty%2Fsystemd.git boot: only do boot counting management for some menu entries Let's do boot counting only for some menu entry types, and carefully list which types those are. --- diff --git a/src/boot/boot.c b/src/boot/boot.c index 1308c83648a..410021ebeee 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -70,6 +70,9 @@ typedef enum LoaderType { /* Which loader types shall be considered for automatic selection */ #define LOADER_TYPE_MAY_AUTO_SELECT(t) IN_SET(t, LOADER_EFI, LOADER_LINUX, LOADER_UKI, LOADER_UKI_URL, LOADER_TYPE2_UKI) +/* Whether to do boot attempt counting logic (only works if userspace can actually find the selected option later) */ +#define LOADER_TYPE_BUMP_COUNTERS(t) IN_SET(t, LOADER_LINUX, LOADER_UKI, LOADER_TYPE2_UKI) + typedef struct BootEntry { char16_t *id; /* The unique identifier for this entry (typically the filename of the file defining the entry, possibly suffixed with a profile id) */ char16_t *id_without_profile; /* same, but without any profile id suffixed */ @@ -1152,6 +1155,9 @@ static EFI_STATUS boot_entry_bump_counters(BootEntry *entry) { assert(entry); + if (!LOADER_TYPE_BUMP_COUNTERS(entry->type)) + return EFI_SUCCESS; + if (entry->tries_left < 0) return EFI_SUCCESS;