REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1446
FeatureFlagExpression Support in Source section of INF file. The Pcd
value in the expression is from INF or DEC.
When a FeatureFlagExpression is present,if the expression evaluates
to TRUE,then the entry is valid. If the expression evaluates to FALSE,
then the EDK II build tools must ignore the entry.
This patch is going to add this feature.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Heng Luo <heng.luo@intel.com>
Signed-off-by: yi1 li <yi1.li@intel.com>
---
.../Source/Python/Workspace/InfBuildData.py | 16 +++++++++++-----
.../Source/Python/Workspace/MetaFileParser.py | 4 ++++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 9643bf17ac63..da5d3f0dc93c 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -529,11 +529,17 @@ class InfBuildData(ModuleBuildClassObject):
for Record in RecordList:
LineNo = Record[-1]
ToolChainFamily = Record[1]
- TagName = Record[2]
- ToolCode = Record[3]
-
+ # OptionsList := [TagName, ToolCode, FeatureFlag]
+ OptionsList = ['','','']
+ TokenList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT)
+ for Index in range(len(TokenList)):
+ OptionsList[Index] = TokenList[Index]
+ if OptionsList[2]:
+ FeaturePcdExpression = self.CheckFeatureFlagPcd(OptionsList[2])
+ if not FeaturePcdExpression:
+ continue
File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '',
- '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
+ '', False, self._Arch, ToolChainFamily, '', OptionsList[0], OptionsList[1])
# check the file validation
ErrorCode, ErrorInfo = File.Validate()
if ErrorCode != 0:
@@ -1067,7 +1073,7 @@ class InfBuildData(ModuleBuildClassObject):
return True
return False
def CheckFeatureFlagPcd(self,Instance):
- Pcds = GlobalData.gPlatformFinalPcds[self.Arch].copy()
+ Pcds = self._GetPcd(MODEL_PCD_FIXED_AT_BUILD)
if PcdPattern.search(Instance):
PcdTuple = tuple(Instance.split('.')[::-1])
if PcdTuple in self.Pcds:
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index a3b6edbd15ee..3508591b281e 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -736,6 +736,10 @@ class InfParser(MetaFileParser):
@ParseMacro
def _SourceFileParser(self):
TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ # Let TokenList[2] be TagName|ToolCode|FeatureFlag
+ if len(TokenList) > 3:
+ for extraToken in range(3, len(TokenList)):
+ TokenList[2] = TokenList[2] + '|' + TokenList[extraToken]
self._ValueList[0:len(TokenList)] = TokenList
Macros = self._Macros
# For Acpi tables, remove macro like ' TABLE_NAME=Sata1'
--
2.33.0.windows.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87347): https://edk2.groups.io/g/devel/message/87347
Mute This Topic: https://groups.io/mt/89632331/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.