EmulatorPkg: Remove Hash2DxeCrypto if NETWORK_ENABLE=FALSE

Hash2DxeCrypto produces a protocol that is only used by
TcpDxe when NETWORK_ENABLE=TRUE. Hash2DxeCrypto is the
only module in EmulatorPkg platforms that depends on
BaseCryptLib and OpensslLib.

EmulatorPkg platform build times can be reduced when
NETWORK_ENABLE=FALSE by only including Hash2DxeCrypto.inf
if NETWORK_ENABLE=TRUE.

This reduces the time to build EmulatorPkg for CI and
local developer builds.

Add !if around PcdOpensslLibAssemblySourceStyleNasm settings
and CryptoPkg includes. When both NETWORK_ENABLE and
SECURE_BOOT_ENABLE are FALSE, the CryptoPkg libraries will
no longer be used at all. This means any references to
CryptoPkg PCDs must be removed when both NETWORK_ENABLE
and SECURE_BOOT_ENABLE are FALSE. Otherwise a build error
is generated.

Also remove use of NETWORK_SUPPORT from DSC/FDF file that
is never set and update build.sh to use default of
NETWORK_ENABLE=FALSE.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Michael D Kinney 2026-01-29 11:37:36 -08:00 committed by mergify[bot]
parent c2915d24a1
commit fe436902cc
3 changed files with 24 additions and 12 deletions

View file

@ -49,10 +49,27 @@
0|DEFAULT
!include MdePkg/MdeLibs.dsc.inc
!include CryptoPkg/CryptoPkgFeatureFlagPcds.dsc.inc
!include RedfishPkg/Redfish.dsc.inc
!include NetworkPkg/Network.dsc.inc
#
# Do not reference CryptoPkg PCDs if features are not enabled that depend on the
# CryptoPkg libraries or modules. Otherwise a build error for a reference to an
# unused PCD is generated.
#
!if $(SECURE_BOOT_ENABLE) == TRUE || $(NETWORK_ENABLE) == TRUE
!include CryptoPkg/CryptoPkgFeatureFlagPcds.dsc.inc
!if $(WIN_MINGW32_BUILD)
[PcdsFeatureFlag]
#
# When WIN_MINGW32_BUILD is set, -target is set to build Windows application.
# Set PcdOpensslLibAssemblySourceStyleNasm to TRUE to use Openssl NASM
# source files that assume a Windows calling convention.
#
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslLibAssemblySourceStyleNasm|TRUE
!endif
!endif
[LibraryClasses]
#
# Entry point
@ -227,14 +244,6 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|FALSE
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables|FALSE
gEmulatorPkgTokenSpaceGuid.PcdEmulatorLazyLoadSymbols|FALSE
!if $(WIN_MINGW32_BUILD)
#
# When WIN_MINGW32_BUILD is set, -target is set to build Windows application.
# Set PcdOpensslLibAssemblySourceStyleNasm to TRUE to use Openssl NASM
# source files that assume a Windows calling convention.
#
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslLibAssemblySourceStyleNasm|TRUE
!endif
[PcdsFixedAtBuild]
gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy|0x00000000
@ -421,7 +430,9 @@
#
# Hash2 Protocol producer
#
!if $(NETWORK_ENABLE) == TRUE
SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.inf
!endif
!if $(SECURE_BOOT_ENABLE) == TRUE
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf

View file

@ -178,7 +178,6 @@ INF EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.inf
INF EmulatorPkg/EmuGopDxe/EmuGopDxe.inf
INF EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystemDxe.inf
INF EmulatorPkg/EmuBlockIoDxe/EmuBlockIoDxe.inf
INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
@ -201,7 +200,9 @@ INF SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
#
# Hash2 Protocol producer
#
!if $(NETWORK_ENABLE) == TRUE
INF SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.inf
!endif
#
# Secure Boot Key Enroll
@ -213,7 +214,7 @@ INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.in
#
# Network stack drivers
#
!if $(NETWORK_SUPPORT)
!if $(NETWORK_ENABLE)
INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
!endif
!include NetworkPkg/Network.fdf.inc

View file

@ -43,7 +43,7 @@ LAST_ARG=
RUN_EMULATOR=no
CLEAN_TYPE=none
TARGET_TOOLS=GCC48
NETWORK_SUPPORT=
NETWORK_SUPPORT=-D NETWORK_ENABLE=FALSE
BUILD_NEW_SHELL=
BUILD_FAT=
HOST_PROCESSOR=X64