From 95fac524919bc4b5ceb65966fbcf80332d0c7408 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Sun, 13 Dec 2020 01:24:04 +0300 Subject: [PATCH] Build: Fix Duet compilation with new EDK II --- Legacy/BootPlatform/SmbiosGenDxe/SmbiosGen.c | 29 ++++++++++++++------ OpenDuetPkg.dsc | 7 +++++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Legacy/BootPlatform/SmbiosGenDxe/SmbiosGen.c b/Legacy/BootPlatform/SmbiosGenDxe/SmbiosGen.c index 0d03160b..04b9007b 100644 --- a/Legacy/BootPlatform/SmbiosGenDxe/SmbiosGen.c +++ b/Legacy/BootPlatform/SmbiosGenDxe/SmbiosGen.c @@ -51,6 +51,7 @@ InstallProcessorSmbios ( CHAR8 *AString; CHAR16 *UString; EFI_STRING_ID Token; + UINTN DestMax; // // Processor info (TYPE 4) @@ -70,9 +71,10 @@ InstallProcessorSmbios ( // Set ProcessorVersion string // AString = GetSmbiosString (SmbiosTable, SmbiosTable.Type4->ProcessorVersion); - UString = AllocateZeroPool ((AsciiStrLen(AString) + 1) * sizeof(CHAR16)); + DestMax = AsciiStrLen (AString) + 1; + UString = AllocateZeroPool (DestMax * sizeof(CHAR16)); ASSERT (UString != NULL); - AsciiStrToUnicodeStr (AString, UString); + AsciiStrToUnicodeStrS (AString, UString, DestMax); Token = HiiSetString (gStringHandle, 0, UString, NULL); if (Token == 0) { @@ -123,6 +125,7 @@ InstallMiscSmbios ( CHAR8 *AString; CHAR16 *UString; EFI_STRING_ID Token; + UINTN DestMax; // // BIOS information (TYPE 0) @@ -137,10 +140,15 @@ InstallMiscSmbios ( // Record Type 2 // AString = GetSmbiosString (SmbiosTable, SmbiosTable.Type0->BiosVersion); - UString = AllocateZeroPool ((AsciiStrLen(AString) + 1) * sizeof(CHAR16) + sizeof(FIRMWARE_BIOS_VERSIONE)); + DestMax = AsciiStrLen (AString) + 1; + UString = AllocateZeroPool (DestMax * sizeof(CHAR16) + sizeof (FIRMWARE_BIOS_VERSIONE)); ASSERT (UString != NULL); - CopyMem (UString, FIRMWARE_BIOS_VERSIONE, sizeof(FIRMWARE_BIOS_VERSIONE)); - AsciiStrToUnicodeStr (AString, UString + sizeof(FIRMWARE_BIOS_VERSIONE) / sizeof(CHAR16) - 1); + CopyMem (UString, FIRMWARE_BIOS_VERSIONE, sizeof (FIRMWARE_BIOS_VERSIONE)); + AsciiStrToUnicodeStrS ( + AString, + UString + sizeof (FIRMWARE_BIOS_VERSIONE) / sizeof(CHAR16) - 1, + DestMax + ); Token = HiiSetString (gStringHandle, 0, UString, NULL); if (Token == 0) { @@ -167,10 +175,15 @@ InstallMiscSmbios ( // Record Type 3 // AString = GetSmbiosString (SmbiosTable, SmbiosTable.Type1->ProductName); - UString = AllocateZeroPool ((AsciiStrLen(AString) + 1) * sizeof(CHAR16) + sizeof(FIRMWARE_PRODUCT_NAME)); + DestMax = AsciiStrLen (AString) + 1; + UString = AllocateZeroPool (DestMax * sizeof (CHAR16) + sizeof (FIRMWARE_PRODUCT_NAME)); ASSERT (UString != NULL); - CopyMem (UString, FIRMWARE_PRODUCT_NAME, sizeof(FIRMWARE_PRODUCT_NAME)); - AsciiStrToUnicodeStr (AString, UString + sizeof(FIRMWARE_PRODUCT_NAME) / sizeof(CHAR16) - 1); + CopyMem (UString, FIRMWARE_PRODUCT_NAME, sizeof (FIRMWARE_PRODUCT_NAME)); + AsciiStrToUnicodeStrS ( + AString, + UString + sizeof (FIRMWARE_PRODUCT_NAME) / sizeof(CHAR16) - 1, + DestMax + ); Token = HiiSetString (gStringHandle, 0, UString, NULL); if (Token == 0) { diff --git a/OpenDuetPkg.dsc b/OpenDuetPkg.dsc index 7e478b8d..2682ca12 100644 --- a/OpenDuetPkg.dsc +++ b/OpenDuetPkg.dsc @@ -68,11 +68,14 @@ DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf # # Generic Modules # @@ -118,6 +121,10 @@ [LibraryClasses.common.DXE_DRIVER] MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf + [Components] OpenCorePkg/Legacy/BootPlatform/DxeIpl/DxeIpl.inf MdeModulePkg/Core/Dxe/DxeMain.inf {