]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix the bug for Pcd used in command line's override
authorYonghong Zhu <yonghong.zhu@intel.com>
Wed, 24 Oct 2018 06:46:09 +0000 (14:46 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Thu, 25 Oct 2018 07:16:16 +0000 (15:16 +0800)
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>
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/Workspace/DscBuildData.py

index 15d9706e35d2bd94a16c8dbae482fd9ad48b15c4..9c3759c0f5c8d0d0ed429c0efff25094206b3073 100644 (file)
@@ -2120,6 +2120,13 @@ class PlatformAutoGen(AutoGen):
         if Module in self.Platform.Modules:\r
             PlatformModule = self.Platform.Modules[str(Module)]\r
             for Key  in PlatformModule.Pcds:\r
+                if GlobalData.BuildOptionPcd:\r
+                    for pcd in GlobalData.BuildOptionPcd:\r
+                        (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd\r
+                        if (TokenCName, TokenSpaceGuidCName) == Key and FieldName =="":\r
+                            PlatformModule.Pcds[Key].DefaultValue = pcdvalue\r
+                            PlatformModule.Pcds[Key].PcdValueFromComm = pcdvalue\r
+                            break\r
                 Flag = False\r
                 if Key in Pcds:\r
                     ToPcd = Pcds[Key]\r
index 7070de14cb82c12fc63d9ab04df76e0df7bbfa54..b78c401cee75cfe024425800170e2d2492aa792b 100644 (file)
@@ -1067,7 +1067,12 @@ class DscBuildData(PlatformBuildClassObject):
                         EdkLogger.error("build", FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))\r
                 GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, ("build command options", 1))\r
 \r
+        if GlobalData.BuildOptionPcd:\r
+            for pcd in GlobalData.BuildOptionPcd:\r
+                (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd\r
                 for BuildData in self._Bdb._CACHE_.values():\r
+                    if BuildData.Arch != self.Arch:\r
+                        continue\r
                     if BuildData.MetaFile.Ext == '.dec' or BuildData.MetaFile.Ext == '.dsc':\r
                         continue\r
                     for key in BuildData.Pcds:\r