From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CB79121C8EFB5 for ; Wed, 24 Oct 2018 17:29:23 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2018 17:29:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,422,1534834800"; d="scan'208";a="102246729" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga001.fm.intel.com with ESMTP; 24 Oct 2018 17:29:23 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 17:29:22 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 17:29:22 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.161]) with mapi id 14.03.0415.000; Thu, 25 Oct 2018 08:29:20 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch V2] BaseTools: Fix the bug for Pcd used in command line's override Thread-Index: AQHUa6K4H0pyW6kmPEyy2zOmLs/E0KUvHDgQ Date: Thu, 25 Oct 2018 00:29:20 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E35CB0C@SHSMSX104.ccr.corp.intel.com> References: <1540389950-18188-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1540389950-18188-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch V2] BaseTools: Fix the bug for Pcd used in command line's override X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2018 00:29:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >Yonghong Zhu >Sent: Wednesday, October 24, 2018 10:06 PM >To: edk2-devel@lists.01.org >Subject: [edk2] [Patch V2] 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 { > > TokenSpaceGuid.PcdTest|"b" > } > >build command with --pcd TokenSpaceGuid.PcdTest=3D"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 >--- > BaseTools/Source/Python/AutoGen/AutoGen.py | 7 +++++++ > BaseTools/Source/Python/Workspace/DscBuildData.py | 5 +++++ > 2 files changed, 12 insertions(+) > >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py >b/BaseTools/Source/Python/AutoGen/AutoGen.py >index 804f579..84645e3 100644 >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py >@@ -2118,10 +2118,17 @@ class PlatformAutoGen(AutoGen): > > # override PCD settings with module specific setting > if Module in self.Platform.Modules: > PlatformModule =3D self.Platform.Modules[str(Module)] > for Key in PlatformModule.Pcds: >+ if GlobalData.BuildOptionPcd: >+ for pcd in GlobalData.BuildOptionPcd: >+ (TokenSpaceGuidCName, TokenCName, FieldName, pcdv= alue, _) >=3D pcd >+ if (TokenCName, TokenSpaceGuidCName) =3D=3D Key a= nd >FieldName =3D=3D"": >+ PlatformModule.Pcds[Key].DefaultValue =3D pcd= value >+ PlatformModule.Pcds[Key].PcdValueFromComm =3D= pcdvalue >+ break > Flag =3D False > if Key in Pcds: > ToPcd =3D Pcds[Key] > Flag =3D True > elif Key in GlobalData.MixedPcd: >diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py >b/BaseTools/Source/Python/Workspace/DscBuildData.py >index b0e88a9..162360c 100644 >--- a/BaseTools/Source/Python/Workspace/DscBuildData.py >+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py >@@ -1058,11 +1058,16 @@ class DscBuildData(PlatformBuildClassObject): > IsValid, Cause =3D CheckPcdDatum(PcdDatumType, pcdval= ue) > if not IsValid: > EdkLogger.error("build", FORMAT_INVALID, Cause, >ExtraData=3D"%s.%s" % (TokenSpaceGuidCName, TokenCName)) > GlobalData.BuildOptionPcd[i] =3D (TokenSpaceGuidCName, >TokenCName, FieldName, pcdvalue, ("build command options", 1)) > >+ if GlobalData.BuildOptionPcd: >+ for pcd in GlobalData.BuildOptionPcd: >+ (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _)= =3D >pcd > for BuildData in self._Bdb._CACHE_.values(): >+ if BuildData.Arch !=3D self.Arch: >+ continue > if BuildData.MetaFile.Ext =3D=3D '.dec' or BuildData.= MetaFile.Ext =3D=3D >'.dsc': > continue > for key in BuildData.Pcds: > PcdItem =3D BuildData.Pcds[key] > if (TokenSpaceGuidCName, TokenCName) =3D=3D >(PcdItem.TokenSpaceGuidCName, PcdItem.TokenCName) and FieldName >=3D=3D"": >-- >2.6.1.windows.1 > >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel