public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools: Fix build option overrides Pcd Feature Flag issue
@ 2022-10-25  8:51 Yuwei Chen
  0 siblings, 0 replies; only message in thread
From: Yuwei Chen @ 2022-10-25  8:51 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Liming Gao

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4081

INF [Sources] section Feature Flag Expressions do not use
override values from build --pcd option currently.
This patch fix this issue.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
---
 edk2basetools/Workspace/InfBuildData.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/edk2basetools/Workspace/InfBuildData.py b/edk2basetools/Workspace/InfBuildData.py
index c97a70e..8631373 100644
--- a/edk2basetools/Workspace/InfBuildData.py
+++ b/edk2basetools/Workspace/InfBuildData.py
@@ -1055,6 +1055,7 @@ def IsBinaryModule(self):
         return False
     def CheckFeatureFlagPcd(self,Instance):
         Pcds = GlobalData.gPlatformFinalPcds.copy()
+        BuildOptionPcds = GlobalData.BuildOptionPcd
         if PcdPattern.search(Instance):
             PcdTuple = tuple(Instance.split('.')[::-1])
             if PcdTuple in self.Pcds:
@@ -1062,6 +1063,14 @@ def CheckFeatureFlagPcd(self,Instance):
                     EdkLogger.error('build', FORMAT_INVALID,
                                     "\nFeatureFlagPcd must be defined in a [PcdsFeatureFlag] or [PcdsFixedAtBuild] section of Dsc or Dec file",
                                     File=str(self), ExtraData=Instance)
+                for item in BuildOptionPcds:
+                    if self.Pcds[PcdTuple].TokenCName in item:
+                        if type(item) == type(()):
+                            # ('gEfiCryptoPkgTokenSpaceGuid', 'PcdOpensslEcEnabled', '', '1', ('build command options', 1)
+                            Pcds[Instance] = list(item)[3]
+                        elif type(item) == type(''):
+                            # gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled=1
+                            Pcds[Instance] = item.split('=')[1]
                 if not Instance in Pcds:
                     Pcds[Instance] = self.Pcds[PcdTuple].DefaultValue
             else: #if PcdTuple not in self.Pcds:
@@ -1085,6 +1094,14 @@ def CheckFeatureFlagPcd(self,Instance):
             for Name, Guid in self.Pcds:
                 if self.Pcds[(Name, Guid)].Type == 'FeatureFlag' or self.Pcds[(Name, Guid)].Type == 'FixedAtBuild':
                     PcdFullName = '%s.%s' % (Guid, Name);
+                    for item in BuildOptionPcds:
+                        if Name in item:
+                            if type(item) == type(()):
+                                # ('gEfiCryptoPkgTokenSpaceGuid', 'PcdOpensslEcEnabled', '', '1', ('build command options', 1)
+                                Pcds[PcdFullName] = list(item)[3]
+                            elif type(item) == type(''):
+                                # gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled=1
+                                Pcds[PcdFullName] = item.split('=')[1]
                     if not PcdFullName in Pcds:
                         Pcds[PcdFullName] = self.Pcds[(Name, Guid)].DefaultValue
             try:
-- 
2.27.0.windows.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-25  8:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-25  8:51 [PATCH] BaseTools: Fix build option overrides Pcd Feature Flag issue Yuwei Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox