diff --git a/Library/OcBootManagementLib/DefaultEntryChoice.c b/Library/OcBootManagementLib/DefaultEntryChoice.c index c0d2e692..80d56693 100644 --- a/Library/OcBootManagementLib/DefaultEntryChoice.c +++ b/Library/OcBootManagementLib/DefaultEntryChoice.c @@ -1053,7 +1053,12 @@ InternalRegisterBootstrapBootOption ( // Find the lowest unused Boot#### index. In the absolutely unrealistic case // that all entries are occupied, always overwrite BootFFFF. // - for (BootOptionIndex = 0; BootOptionIndex < 0xFFFF; ++BootOptionIndex) { + // Boot0000 is reserved on ASUS boards and is treated like a deleted entry. + // Setting Boot0000 will essentially cause entries to duplicate and eventual + // BIOS brick as ASUS boards simply zero removed boot entries instead of + // shrinking BootOrder size. Reproduced on ASUS ROG STRIX Z370-F GAMING. + // + for (BootOptionIndex = 1; BootOptionIndex < 0xFFFF; ++BootOptionIndex) { for (OrderIndex = 0; OrderIndex < BootOrderSize / sizeof (*BootOrder); ++OrderIndex) { if (BootOrder[OrderIndex + 1] == BootOptionIndex) { break; diff --git a/Library/OcBootManagementLib/VariableManagement.c b/Library/OcBootManagementLib/VariableManagement.c index 02e1df70..0b8e2730 100644 --- a/Library/OcBootManagementLib/VariableManagement.c +++ b/Library/OcBootManagementLib/VariableManagement.c @@ -374,9 +374,9 @@ OcDeleteVariables ( DeleteVariables (); if ((BootProtect & OC_BOOT_PROTECT_VARIABLE_BOOTSTRAP) != 0) { - BootOptionIndex = 0; + BootOptionIndex = 1; Status = gRT->SetVariable ( - L"Boot0000", + L"Boot0001", &gEfiGlobalVariableGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, BootOptionSize,