From 726739c638ee3feaad73d871d6bf8280f3a1023f Mon Sep 17 00:00:00 2001 From: "levi.yun" Date: Thu, 26 Sep 2024 13:59:52 +0100 Subject: [PATCH] ARM/VExpressPkg: StandaloneMM instance of ExtractGuidedSectionLib The ExtractGuidedSectionLib implementation in Embedded package creates HOBs to get Uncompress handler information. Since StandaloneMM is a HOB consumer and not a HOB producer, a StandaloneMM instance of ExtractGuidedSectionLib has been introduced. Therefore, switch to using the StandaloneMM instance of the ExtractGuidedSectionLib. Also, when using Lzma compression for StandaloneMm the size of the image can be reduced. The image size reduction can be seen as below: before: FVMAIN_COMPACT [96%Full] 1048576 (0x100000) total, 1016224 (0xf81a0) used, 32352 (0x7e60) free after: FVMAIN_COMPACT [38%Full] 1048576 (0x100000) total, 402880 (0x625c0) used, 645696 (0x9da40) free Signed-off-by: Levi Yun Change-Id: I526fe1dbedaf4993f345c9d36d52787e6f38d04f --- .../ARM/VExpressPkg/PlatformStandaloneMm.dsc | 7 ++- .../ARM/VExpressPkg/PlatformStandaloneMm.fdf | 47 +++++++++++++++++-- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc b/Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc index 4e081189fce..d47cae39363 100644 --- a/Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc +++ b/Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc @@ -52,7 +52,7 @@ CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf - ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf + ExtractGuidedSectionLib|StandaloneMmPkg/Library/StandaloneMmExtractGuidedSectionLib/StandaloneMmExtractGuidedSectionLib.inf FvLib|StandaloneMmPkg/Library/FvLib/FvLib.inf HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf HobPrintLib|MdeModulePkg/Library/HobPrintLib/HobPrintLib.inf @@ -172,7 +172,10 @@ # # MM Core # - StandaloneMmPkg/Core/StandaloneMmCore.inf + StandaloneMmPkg/Core/StandaloneMmCore.inf { + + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf + } StandaloneMmPkg/Library/FvLib/FvLib.inf StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf diff --git a/Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf b/Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf index f4715433d10..44de2b9c780 100644 --- a/Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf +++ b/Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf @@ -37,8 +37,21 @@ NumBlocks = 0x300 gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize FV = FVMAIN_COMPACT -[FV.FVMAIN_COMPACT] -FvAlignment = 16 +################################################################################ +# +# FV Section +# +# [FV] section is used to define what components or modules are placed within a flash +# device file. This section also defines order the components and modules are positioned +# within the image. The [FV] section consists of define statements, set statements and +# module statements. +# +################################################################################ + +[FV.FvMain] +BlockSize = 0x40 +NumBlocks = 0 # This FV gets compressed so make it just big enough +FvAlignment = 16 # FV alignment and FV attributes setting. ERASE_POLARITY = 1 MEMORY_MAPPED = TRUE STICKY_WRITE = TRUE @@ -54,8 +67,8 @@ READ_ENABLED_CAP = TRUE READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE +FvNameGuid = 87940482-fc81-41c3-87e6-399cf85ac8a0 - INF StandaloneMmPkg/Core/StandaloneMmCore.inf INF StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf !if $(ENABLE_UEFI_SECURE_VARIABLE) == TRUE @@ -64,6 +77,34 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf !endif + + +[FV.FVMAIN_COMPACT] +FvAlignment = 16 +ERASE_POLARITY = 1 +MEMORY_MAPPED = TRUE +STICKY_WRITE = TRUE +LOCK_CAP = TRUE +LOCK_STATUS = TRUE +WRITE_DISABLED_CAP = TRUE +WRITE_ENABLED_CAP = TRUE +WRITE_STATUS = TRUE +WRITE_LOCK_CAP = TRUE +WRITE_LOCK_STATUS = TRUE +READ_DISABLED_CAP = TRUE +READ_ENABLED_CAP = TRUE +READ_STATUS = TRUE +READ_LOCK_CAP = TRUE +READ_LOCK_STATUS = TRUE + + INF StandaloneMmPkg/Core/StandaloneMmCore.inf + + FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { + SECTION FV_IMAGE = FVMAIN + } + } + ################################################################################ # # Rules are use with the [FV] section's module INF type to define