UINTN CmdLineSize;\r
UINTN InitrdSize;\r
EFI_DEVICE_PATH* Initrd;\r
+ UINT16 LoadOptionIndexSize;\r
\r
if (IS_ARM_BDS_BOOTENTRY (BootOption)) {\r
Status = EFI_UNSUPPORTED;\r
FreePool (FdtDevicePath);\r
}\r
} else {\r
+ // Set BootCurrent variable\r
+ LoadOptionIndexSize = sizeof(UINT16);\r
+ gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+ LoadOptionIndexSize, &(BootOption->LoadOptionIndex));\r
+\r
Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);\r
+\r
+ // Clear BootCurrent variable\r
+ LoadOptionIndexSize = sizeof(UINT16);\r
+ gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+ 0, NULL);\r
}\r
\r
return Status;\r