Skip to content

Commit

Permalink
Build: Fixed compilation after adding UE draft into AUDK master.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailKrichanov committed Jul 20, 2023
1 parent e8ddb58 commit 5afed6e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
21 changes: 13 additions & 8 deletions Library/OcBootManagementLib/ImageLoader.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,25 +284,30 @@ OcImageLoaderLoad (
ImageStatus = UefiImageInitializeContext (
&ImageContext,
SourceBuffer,
(UINT32)SourceSize
(UINT32)SourceSize,
UEFI_IMAGE_SOURCE_FV
);
if (EFI_ERROR (ImageStatus)) {
DEBUG ((DEBUG_INFO, "OCB: PeCoff init failure - %r\n", ImageStatus));
return EFI_UNSUPPORTED;
}

if (ImageContext.FormatIndex != UefiImageFormatPe) {
ASSERT (FALSE);
}

//
// Reject images that are not meant for the platform's architecture.
//
if (ImageContext.Machine != OC_IMAGE_FILE_MACHINE) {
DEBUG ((DEBUG_INFO, "OCB: PeCoff wrong machine - %x\n", ImageContext.Machine));
if (ImageContext.Ctx.Pe.Machine != OC_IMAGE_FILE_MACHINE) {
DEBUG ((DEBUG_INFO, "OCB: PeCoff wrong machine - %x\n", ImageContext.Ctx.Pe.Machine));
return EFI_UNSUPPORTED;
}

//
// Reject RT drivers for the moment.
//
if (ImageContext.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) {
if (ImageContext.Ctx.Pe.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) {
DEBUG ((DEBUG_INFO, "OCB: PeCoff no support for RT drivers\n"));
return EFI_UNSUPPORTED;
}
Expand All @@ -323,7 +328,7 @@ OcImageLoaderLoad (
//
Status = AllocateAlignedPagesEx (
AllocateAnyPages,
ImageContext.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION
ImageContext.Ctx.Pe.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION
? EfiLoaderCode : EfiBootServicesCode,
DestinationPages,
DestinationAlignment,
Expand Down Expand Up @@ -363,10 +368,10 @@ OcImageLoaderLoad (
return EFI_OUT_OF_RESOURCES;
}

OcLoadedImage->EntryPoint = (EFI_IMAGE_ENTRY_POINT)((UINTN)DestinationBuffer + ImageContext.AddressOfEntryPoint);
OcLoadedImage->EntryPoint = (EFI_IMAGE_ENTRY_POINT)((UINTN)DestinationBuffer + ImageContext.Ctx.Pe.AddressOfEntryPoint);
OcLoadedImage->ImageArea = DestinationArea;
OcLoadedImage->PageCount = DestinationPages;
OcLoadedImage->Subsystem = ImageContext.Subsystem;
OcLoadedImage->Subsystem = ImageContext.Ctx.Pe.Subsystem;

LoadedImage = &OcLoadedImage->LoadedImage;

Expand All @@ -378,7 +383,7 @@ OcImageLoaderLoad (
//
// FIXME: Support RT drivers.
//
if (ImageContext.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
if (ImageContext.Ctx.Pe.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
LoadedImage->ImageCodeType = EfiLoaderCode;
LoadedImage->ImageDataType = EfiLoaderData;
} else {
Expand Down
1 change: 0 additions & 1 deletion OpenCorePkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
UefiDriverEntryPoint|OpenCorePkg/Library/OcDriverEntryPoint/UefiDriverEntryPoint.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
UefiImageExtraActionLib|MdePkg/Library/BaseUefiImageExtraActionLibNull/BaseUefiImageExtraActionLibNull.inf
UefiImageLib|MdePkg/Library/BaseUefiImageLib/BaseUefiImageLibPeCoff.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
Expand Down
1 change: 0 additions & 1 deletion OpenDuetPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
UefiImageLib|MdePkg/Library/BaseUefiImageLib/BaseUefiImageLibPeCoff.inf
UefiImageExtraActionLib|MdePkg/Library/BaseUefiImageExtraActionLibNull/BaseUefiImageExtraActionLibNull.inf
PeCoffLib2|MdePkg/Library/BasePeCoffLib2/BasePeCoffLib2.inf
#
Expand Down

0 comments on commit 5afed6e

Please sign in to comment.