* [Patch] BaseTools: Fixed build failed issue.
@ 2018-03-01 10:22 BobCF
0 siblings, 0 replies; 3+ messages in thread
From: BobCF @ 2018-03-01 10:22 UTC (permalink / raw)
To: edk2-devel; +Cc: Bob Feng, Liming Gao
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 <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
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 06d2f2fbcd..9dcdcfcf1c 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1304,14 +1304,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:
@@ -1729,10 +1729,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:
@@ -1925,12 +1928,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)
@@ -2292,10 +2295,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]
@@ -2306,19 +2313,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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Patch] BaseTools: Fixed Build failed issue.
@ 2018-02-06 7:20 BobCF
2018-02-08 3:07 ` Gao, Liming
0 siblings, 1 reply; 3+ messages in thread
From: BobCF @ 2018-02-06 7:20 UTC (permalink / raw)
To: edk2-devel; +Cc: Bob Feng, Liming Gao
If the PCD is not used in DSC file and user set
that PCD value from Command line, build will fail.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
BaseTools/Source/Python/Workspace/DscBuildData.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1da4f03ab8..6e3cd0f3f1 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -896,11 +896,12 @@ class DscBuildData(PlatformBuildClassObject):
else:
pcdobj = self._Pcds.get((pcd[1],pcd[0]))
if pcdobj:
pcdset.append((pcd[0],pcd[1], pcdobj.DefaultValue))
else:
- pcdset.append((pcd[0],pcd[1],pcd[3]))
+ pcdvalue = pcd[3] if len(pcd) == 4 else pcd[2]
+ pcdset.append((pcd[0],pcd[1],pcdvalue))
GlobalData.BuildOptionPcd = pcdset
def GetFieldValueFromComm(self,ValueStr,TokenSpaceGuidCName, TokenCName, FieldName):
PredictedFieldType = "VOID*"
if ValueStr.startswith('L'):
if not ValueStr[1]:
@@ -2163,14 +2164,18 @@ class DscBuildData(PlatformBuildClassObject):
for pcd in Pcds.values():
SkuInfoObj = pcd.SkuInfoList.values()[0]
pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
+ pcd.DatumType = pcdDecObject.DatumType
# Only fix the value while no value provided in DSC file.
for sku in pcd.SkuInfoList.values():
if (sku.HiiDefaultValue == "" or sku.HiiDefaultValue == None):
sku.HiiDefaultValue = pcdDecObject.DefaultValue
+ for default_store in sku.DefaultStoreDict:
+ sku.DefaultStoreDict[default_store]=pcdDecObject.DefaultValue
+ pcd.DefaultValue = pcdDecObject.DefaultValue
if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():
valuefromDec = pcdDecObject.DefaultValue
SkuInfo = SkuInfoClass('DEFAULT', '0', SkuInfoObj.VariableName, SkuInfoObj.VariableGuid, SkuInfoObj.VariableOffset, valuefromDec,VariableAttribute=SkuInfoObj.VariableAttribute,DefaultStore={DefaultStore:valuefromDec})
pcd.SkuInfoList['DEFAULT'] = SkuInfo
elif 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' in pcd.SkuInfoList.keys():
--
2.14.3.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch] BaseTools: Fixed Build failed issue.
2018-02-06 7:20 [Patch] BaseTools: Fixed Build " BobCF
@ 2018-02-08 3:07 ` Gao, Liming
0 siblings, 0 replies; 3+ messages in thread
From: Gao, Liming @ 2018-02-08 3:07 UTC (permalink / raw)
To: Feng, Bob C, edk2-devel@lists.01.org
Reviewed-by: Liming Gao <liming.gao@intel.com>
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>BobCF
>Sent: Tuesday, February 06, 2018 3:21 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [edk2] [Patch] BaseTools: Fixed Build failed issue.
>
>If the PCD is not used in DSC file and user set
>that PCD value from Command line, build will fail.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>---
> BaseTools/Source/Python/Workspace/DscBuildData.py | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
>diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
>b/BaseTools/Source/Python/Workspace/DscBuildData.py
>index 1da4f03ab8..6e3cd0f3f1 100644
>--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
>+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
>@@ -896,11 +896,12 @@ class DscBuildData(PlatformBuildClassObject):
> else:
> pcdobj = self._Pcds.get((pcd[1],pcd[0]))
> if pcdobj:
> pcdset.append((pcd[0],pcd[1], pcdobj.DefaultValue))
> else:
>- pcdset.append((pcd[0],pcd[1],pcd[3]))
>+ pcdvalue = pcd[3] if len(pcd) == 4 else pcd[2]
>+ pcdset.append((pcd[0],pcd[1],pcdvalue))
> GlobalData.BuildOptionPcd = pcdset
> def GetFieldValueFromComm(self,ValueStr,TokenSpaceGuidCName,
>TokenCName, FieldName):
> PredictedFieldType = "VOID*"
> if ValueStr.startswith('L'):
> if not ValueStr[1]:
>@@ -2163,14 +2164,18 @@ class DscBuildData(PlatformBuildClassObject):
>
>
> for pcd in Pcds.values():
> SkuInfoObj = pcd.SkuInfoList.values()[0]
> pcdDecObject = self._DecPcds[pcd.TokenCName,
>pcd.TokenSpaceGuidCName]
>+ pcd.DatumType = pcdDecObject.DatumType
> # Only fix the value while no value provided in DSC file.
> for sku in pcd.SkuInfoList.values():
> if (sku.HiiDefaultValue == "" or sku.HiiDefaultValue == None):
> sku.HiiDefaultValue = pcdDecObject.DefaultValue
>+ for default_store in sku.DefaultStoreDict:
>+
>sku.DefaultStoreDict[default_store]=pcdDecObject.DefaultValue
>+ pcd.DefaultValue = pcdDecObject.DefaultValue
> if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in
>pcd.SkuInfoList.keys():
> valuefromDec = pcdDecObject.DefaultValue
> SkuInfo = SkuInfoClass('DEFAULT', '0', SkuInfoObj.VariableName,
>SkuInfoObj.VariableGuid, SkuInfoObj.VariableOffset,
>valuefromDec,VariableAttribute=SkuInfoObj.VariableAttribute,DefaultStore=
>{DefaultStore:valuefromDec})
> pcd.SkuInfoList['DEFAULT'] = SkuInfo
> elif 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' in
>pcd.SkuInfoList.keys():
>--
>2.14.3.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-01 10:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-01 10:22 [Patch] BaseTools: Fixed build failed issue BobCF
-- strict thread matches above, loose matches on Subject: below --
2018-02-06 7:20 [Patch] BaseTools: Fixed Build " BobCF
2018-02-08 3:07 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox