OcBootManagementLib: Workaround setting Boot0000 causing ASUS FW issues

This commit is contained in:
vit9696 2020-12-03 04:19:53 +03:00
parent 1f2982bf03
commit cc6aa31ca0
2 changed files with 8 additions and 3 deletions

View File

@ -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;

View File

@ -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,