Skip to content

Commit

Permalink
ARM/VExpressPkg: StandaloneMM instance of ExtractGuidedSectionLib
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
LeviYeoReum committed Oct 18, 2024
1 parent 832fcc1 commit eb9df20
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
7 changes: 5 additions & 2 deletions Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -172,7 +172,10 @@
#
# MM Core
#
StandaloneMmPkg/Core/StandaloneMmCore.inf
StandaloneMmPkg/Core/StandaloneMmCore.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
}
StandaloneMmPkg/Library/FvLib/FvLib.inf
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
Expand Down
47 changes: 44 additions & 3 deletions Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit eb9df20

Please sign in to comment.