Add support for LoaderFeatures EFI variable. Index: grub-2.14~rc1/grub-core/normal/menu.c =================================================================== --- grub-2.14~rc1.orig/grub-core/normal/menu.c +++ grub-2.14~rc1/grub-core/normal/menu.c @@ -46,6 +46,14 @@ { 0x4a67b082, 0x0a4c, 0x41cf, { 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f } } static grub_guid_t grub_efi_loader_guid = GRUB_EFI_LOADER_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) + #endif /* Time to delay after displaying an error message about a default/fallback @@ -805,6 +813,15 @@ run_menu (grub_menu_t menu, int nested, const char* val = grub_env_get ("enable_blscfg"); if (val && (val[0] == '1' || val[0] == 'y')) { + + static long loader_features = + 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_set_variable("LoaderFeatures", &grub_efi_loader_guid, &loader_features, sizeof(long)); + int oneshot_entry, default_entry_efi; oneshot_entry = get_entry_from_efivar(menu, "LoaderEntryOneShot"); if (oneshot_entry != -1)