File 0006-bli-Add-support-for-LoaderFeatures.patch of Package grub2

From 3cc7abb996dfe4f9d9fb29e6509a212d50186bbc Mon Sep 17 00:00:00 2001
From: Danilo Spinella <danilo.spinella@suse.com>
Date: Thu, 19 Mar 2026 10:25:36 +0100
Subject: [PATCH 6/7] bli: Add support for LoaderFeatures

---
 grub-core/commands/bli.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/grub-core/commands/bli.c b/grub-core/commands/bli.c
index 60d219f91..370db1953 100644
--- a/grub-core/commands/bli.c
+++ b/grub-core/commands/bli.c
@@ -37,6 +37,29 @@ GRUB_MOD_LICENSE ("GPLv3+");
 
 static const grub_guid_t bli_vendor_guid = GRUB_EFI_VENDOR_BOOT_LOADER_INTERFACE_GUID;
 
+#define GRUB_EFI_LOADER_FEATURE_CONFIG_TIMEOUT          (1 << 0)
+#define GRUB_EFI_LOADER_FEATURE_CONFIG_TIMEOUT_ONE_SHOT (1 << 1)
+#define GRUB_EFI_LOADER_FEATURE_ENTRY_DEFAULT           (1 << 2)
+#define GRUB_EFI_LOADER_FEATURE_ENTRY_ONESHOT           (1 << 3)
+#define GRUB_EFI_LOADER_FEATURE_BOOT_COUNTING           (1 << 4)
+#define GRUB_EFI_LOADER_FEATURE_XBOOTLDR                (1 << 5)
+#define GRUB_EFI_LOADER_FEATURE_MENU_DISABLE            (1 << 13)
+
+static grub_err_t
+set_loader_features (void)
+{
+  static long loader_features =
+      GRUB_EFI_LOADER_FEATURE_CONFIG_TIMEOUT |
+      GRUB_EFI_LOADER_FEATURE_CONFIG_TIMEOUT_ONE_SHOT |
+      GRUB_EFI_LOADER_FEATURE_ENTRY_DEFAULT |
+      GRUB_EFI_LOADER_FEATURE_ENTRY_ONESHOT |
+      GRUB_EFI_LOADER_FEATURE_BOOT_COUNTING |
+      GRUB_EFI_LOADER_FEATURE_XBOOTLDR |
+      GRUB_EFI_LOADER_FEATURE_MENU_DISABLE;
+
+  return grub_efi_set_variable("LoaderFeatures", &bli_vendor_guid, &loader_features, sizeof(long));
+}
+
 static grub_err_t
 get_part_uuid (const char *device_name, char **part_uuid)
 {
@@ -271,6 +294,7 @@ GRUB_MOD_INIT (bli)
   set_loader_active_pcr_banks ();
   set_loader_default_entry ();
   set_timeout_from_loader_config ();
+  set_loader_features ();
   /* No error here is critical, other than being logged */
   grub_print_error ();
 }
-- 
2.53.0

openSUSE Build Service is sponsored by