From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 D138222485A71 for ; Fri, 2 Mar 2018 02:05:12 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2018 02:11:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,411,1515484800"; d="scan'208";a="24563904" Received: from shwdeopenpsi105.ccr.corp.intel.com ([10.239.9.129]) by fmsmga002.fm.intel.com with ESMTP; 02 Mar 2018 02:11:21 -0800 From: BobCF To: edk2-devel@lists.01.org Cc: Bob Feng , Liming Gao Date: Fri, 2 Mar 2018 18:11:14 +0800 Message-Id: <20180302101114.9488-2-bob.c.feng@intel.com> X-Mailer: git-send-email 2.14.3.windows.1 In-Reply-To: <20180302101114.9488-1-bob.c.feng@intel.com> References: <20180302101114.9488-1-bob.c.feng@intel.com> Subject: [Patch 2/2] BaseTools: Fixed build failed issue. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Mar 2018 10:05:13 -0000 Case 1. A Pcd has no default sku setting in DSC. Case 2. Build as Single SKU. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng Cc: Liming Gao --- BaseTools/Source/Python/Workspace/DscBuildData.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 239531cd1c..cd633e964d 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1317,14 +1317,14 @@ class DscBuildData(PlatformBuildClassObject): if str_pcd_dec: str_pcd_obj_str = StructurePcd() str_pcd_obj_str.copy(str_pcd_dec) if str_pcd_obj: str_pcd_obj_str.copy(str_pcd_obj) - if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: - str_pcd_obj_str.DefaultFromDSC = {skuname:{defaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_pcd_obj.SkuInfoList[skuname].HiiDefaultValue) for defaultstore in DefaultStores} for skuname in str_pcd_obj.SkuInfoList} - else: - str_pcd_obj_str.DefaultFromDSC = {skuname:{defaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in DefaultStores} for skuname in str_pcd_obj.SkuInfoList} + if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: + str_pcd_obj_str.DefaultFromDSC = {skuname:{defaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_pcd_obj.SkuInfoList[skuname].HiiDefaultValue) for defaultstore in DefaultStores} for skuname in str_pcd_obj.SkuInfoList} + else: + str_pcd_obj_str.DefaultFromDSC = {skuname:{defaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in DefaultStores} for skuname in str_pcd_obj.SkuInfoList} for str_pcd_data in StrPcdSet[str_pcd]: if str_pcd_data[3] in SkuIds: str_pcd_obj_str.AddOverrideValue(str_pcd_data[2], str(str_pcd_data[6]), 'DEFAULT' if str_pcd_data[3] == 'COMMON' else str_pcd_data[3],'STANDARD' if str_pcd_data[4] == 'COMMON' else str_pcd_data[4], self.MetaFile.File if self.WorkspaceDir not in self.MetaFile.File else self.MetaFile.File[len(self.WorkspaceDir) if self.WorkspaceDir.endswith(os.path.sep) else len(self.WorkspaceDir)+1:],LineNo=str_pcd_data[5]) S_pcd_set[str_pcd[1], str_pcd[0]] = str_pcd_obj_str else: @@ -1762,10 +1762,13 @@ class DscBuildData(PlatformBuildClassObject): CApp = CApp + "// SkuName: %s, DefaultStoreName: %s \n" % ('DEFAULT', 'STANDARD') inherit_OverrideValues = Pcd.SkuOverrideValues[SkuName] if (SkuName,DefaultStoreName) == ('DEFAULT','STANDARD'): pcddefaultvalue = Pcd.DefaultFromDSC.get('DEFAULT',{}).get('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue else: + if not Pcd.DscRawValue: + # handle the case that structure pcd is not appear in DSC + self.CopyDscRawValue(Pcd) pcddefaultvalue = Pcd.DscRawValue.get(SkuName,{}).get(DefaultStoreName) for FieldList in [pcddefaultvalue,inherit_OverrideValues.get(DefaultStoreName)]: if not FieldList: continue if pcddefaultvalue and FieldList == pcddefaultvalue: @@ -1958,12 +1961,12 @@ class DscBuildData(PlatformBuildClassObject): CApp = CApp + "// SkuName: %s, DefaultStoreName: %s \n" % (skuname, defaultstorenameitem) CApp = CApp + self.GenerateInitValueStatement(Pcd,skuname,defaultstorenameitem) if skuname == SkuName: break else: - CApp = CApp + "// SkuName: DEFAULT, DefaultStoreName: STANDARD \n" - CApp = CApp + self.GenerateInitValueStatement(Pcd,"DEFAULT","STANDARD") + CApp = CApp + "// SkuName: %s, DefaultStoreName: STANDARD \n" % self.SkuIdMgr.SystemSkuId + CApp = CApp + self.GenerateInitValueStatement(Pcd,self.SkuIdMgr.SystemSkuId,"STANDARD") CApp = CApp + self.GenerateCommandLineValueStatement(Pcd) # # Set new PCD value and size # CApp = CApp + ' PcdSetPtr (%s, %s, %s, %s, Size, (UINT8 *)Pcd);\n' % (SkuName, DefaultStoreName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName) @@ -2325,10 +2328,14 @@ class DscBuildData(PlatformBuildClassObject): else: return False def CopyDscRawValue(self,Pcd): if Pcd.DscRawValue is None: Pcd.DscRawValue = dict() + if Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]: + if self.SkuIdMgr.SystemSkuId not in Pcd.DscRawValue: + Pcd.DscRawValue[self.SkuIdMgr.SystemSkuId] = {} + Pcd.DscRawValue[self.SkuIdMgr.SystemSkuId]['STANDARD'] = Pcd.DefaultValue for skuname in Pcd.SkuInfoList: Pcd.DscRawValue[skuname] = {} if Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: for defaultstore in Pcd.SkuInfoList[skuname].DefaultStoreDict: Pcd.DscRawValue[skuname][defaultstore] = Pcd.SkuInfoList[skuname].DefaultStoreDict[defaultstore] @@ -2339,19 +2346,19 @@ class DscBuildData(PlatformBuildClassObject): DefaultStoreObj = DefaultStore(self._GetDefaultStores()) SkuIds = {skuname:skuid for skuname,skuid in self.SkuIdMgr.AvailableSkuIdSet.items() if skuname !='COMMON'} DefaultStores = set([storename for pcdobj in PcdSet.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict.keys()]) for PcdCName, TokenSpaceGuid in PcdSet: PcdObj = PcdSet[(PcdCName, TokenSpaceGuid)] + self.CopyDscRawValue(PcdObj) if PcdObj.Type not in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_DEFAULT], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_VPD], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_DEFAULT], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_VPD]]: Pcds[PcdCName, TokenSpaceGuid]= PcdObj continue - self.CopyDscRawValue(PcdObj) PcdType = PcdObj.Type if PcdType in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: for skuid in PcdObj.SkuInfoList: skuobj = PcdObj.SkuInfoList[skuid] mindefaultstorename = DefaultStoreObj.GetMin(set([defaultstorename for defaultstorename in skuobj.DefaultStoreDict])) -- 2.14.3.windows.1