OcBootManagementLib: Allow launching any app via GUID

This commit is contained in:
vit9696 2020-12-03 17:34:12 +03:00
parent 27dcb28327
commit 1f2982bf03
3 changed files with 33 additions and 20 deletions

View File

@ -61,7 +61,7 @@ UefiMain (
return Status;
}
Status = OcRunAppleBootPicker ();
Status = OcRunFirmwareApplication (&gAppleBootPickerFileGuid, TRUE);
Pixel.Raw = 0x0;
if (Status == EFI_NOT_FOUND) {

View File

@ -1210,13 +1210,17 @@ OcDeleteVariables (
);
/**
Launch Apple BootPicker.
Launch firmware application.
@param[in] ApplicationGuid Application GUID identifier in the firmware.
@param[in] SetReason Pass enter reason (specific to Apple BootPicker).
@retval error code, should not return.
**/
EFI_STATUS
OcRunAppleBootPicker (
VOID
OcRunFirmwareApplication (
IN EFI_GUID *ApplicationGuid,
IN BOOLEAN SetReason
);
/**

View File

@ -61,7 +61,7 @@ RunShowMenu (
if (!BootContext->PickerContext->ApplePickerUnsupported
&& BootContext->PickerContext->PickerMode == OcPickerModeApple) {
Status = OcRunAppleBootPicker ();
Status = OcRunFirmwareApplication (&gAppleBootPickerFileGuid, TRUE);
//
// This should not return on success.
//
@ -540,7 +540,7 @@ OcRunBootPicker (
}
if (Context->PickerCommand == OcPickerShowPicker && Context->PickerMode == OcPickerModeApple) {
Status = OcRunAppleBootPicker ();
Status = OcRunFirmwareApplication (&gAppleBootPickerFileGuid, TRUE);
DEBUG ((DEBUG_INFO, "OCB: Apple BootPicker failed - %r, fallback to builtin\n", Status));
Context->ApplePickerUnsupported = TRUE;
}
@ -707,8 +707,9 @@ OcRunBootPicker (
}
EFI_STATUS
OcRunAppleBootPicker (
VOID
OcRunFirmwareApplication (
IN EFI_GUID *ApplicationGuid,
IN BOOLEAN SetReason
)
{
EFI_STATUS Status;
@ -716,11 +717,11 @@ OcRunAppleBootPicker (
EFI_DEVICE_PATH_PROTOCOL *Dp;
APPLE_PICKER_ENTRY_REASON PickerEntryReason;
DEBUG ((DEBUG_INFO, "OCB: OcRunAppleBootPicker attempting to find...\n"));
DEBUG ((DEBUG_INFO, "OCB: run fw app attempting to find %g...\n", ApplicationGuid));
Dp = CreateFvFileDevicePath (&gAppleBootPickerFileGuid);
Dp = CreateFvFileDevicePath (ApplicationGuid);
if (Dp != NULL) {
DEBUG ((DEBUG_INFO, "OCB: OcRunAppleBootPicker attempting to load...\n"));
DEBUG ((DEBUG_INFO, "OCB: run fw app attempting to load %g...\n", ApplicationGuid));
NewHandle = NULL;
Status = gBS->LoadImage (
FALSE,
@ -738,16 +739,24 @@ OcRunAppleBootPicker (
}
if (!EFI_ERROR (Status)) {
PickerEntryReason = ApplePickerEntryReasonUnknown;
Status = gRT->SetVariable (
APPLE_PICKER_ENTRY_REASON_VARIABLE_NAME,
&gAppleVendorVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (PickerEntryReason),
&PickerEntryReason
);
if (SetReason) {
PickerEntryReason = ApplePickerEntryReasonUnknown;
Status = gRT->SetVariable (
APPLE_PICKER_ENTRY_REASON_VARIABLE_NAME,
&gAppleVendorVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (PickerEntryReason),
&PickerEntryReason
);
}
DEBUG ((DEBUG_INFO, "OCB: OcRunAppleBootPicker attempting to start with var %r...\n", Status));
DEBUG ((
DEBUG_INFO,
"OCB: run fw app attempting to start %g (%d) %r...\n",
ApplicationGuid,
SetReason,
Status
));
Status = gBS->StartImage (
NewHandle,
NULL,