summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2018-10-24 14:46:09 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-10-25 15:16:16 +0800
commit5d54ab94db0308e90a86aee543cb3a07a9c4d2bc (patch)
tree9d8ef5869f475077b30044d5adb52f6b42ae4ec8
parent8411c9d5c4400f9d1d12a6593f5e6b99eb681357 (diff)
downloadedk2-5d54ab94db0308e90a86aee543cb3a07a9c4d2bc.tar.gz
edk2-5d54ab94db0308e90a86aee543cb3a07a9c4d2bc.tar.xz
edk2-5d54ab94db0308e90a86aee543cb3a07a9c4d2bc.zip
BaseTools: Fix the bug for Pcd used in command line's override
V2: remove the not used parameter i Fix the bug for Pcd used in command line not override the Pcd used in the [component] driver's sub-section. Case: DSC file: [PcdsFixedAtBuild] TokenSpaceGuid.PcdTest [Components] TestPkg/TestDriver.inf { <PcdsFixedAtBuild> TokenSpaceGuid.PcdTest|"b" } build command with --pcd TokenSpaceGuid.PcdTest="AAAABB" Then we found the Pcd value in the AutoGen.c file is incorrect, because of the incorrect logic that use the pcd in the [component] section to re-override it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py7
-rw-r--r--BaseTools/Source/Python/Workspace/DscBuildData.py5
2 files changed, 12 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 15d9706e35..9c3759c0f5 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2120,6 +2120,13 @@ class PlatformAutoGen(AutoGen):
if Module in self.Platform.Modules:
PlatformModule = self.Platform.Modules[str(Module)]
for Key in PlatformModule.Pcds:
+ if GlobalData.BuildOptionPcd:
+ for pcd in GlobalData.BuildOptionPcd:
+ (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd
+ if (TokenCName, TokenSpaceGuidCName) == Key and FieldName =="":
+ PlatformModule.Pcds[Key].DefaultValue = pcdvalue
+ PlatformModule.Pcds[Key].PcdValueFromComm = pcdvalue
+ break
Flag = False
if Key in Pcds:
ToPcd = Pcds[Key]
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 7070de14cb..b78c401cee 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1067,7 +1067,12 @@ class DscBuildData(PlatformBuildClassObject):
EdkLogger.error("build", FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))
GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, ("build command options", 1))
+ if GlobalData.BuildOptionPcd:
+ for pcd in GlobalData.BuildOptionPcd:
+ (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd
for BuildData in self._Bdb._CACHE_.values():
+ if BuildData.Arch != self.Arch:
+ continue
if BuildData.MetaFile.Ext == '.dec' or BuildData.MetaFile.Ext == '.dsc':
continue
for key in BuildData.Pcds: