BaseTools: Fixed Pcd from command line issue.

Save the pcd command line value in Pcd object

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
BobCF
2018-03-08 13:56:21 +08:00
committed by Yonghong Zhu
parent 6d2d2e6e5b
commit 0f228f19fb
4 changed files with 31 additions and 47 deletions

View File

@@ -916,11 +916,8 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
PatchPcdSizeVariableName = '_gPcd_BinaryPatch_Size_' + TokenCName
FixPcdSizeTokenName = '_PCD_SIZE_' + TokenCName
if GlobalData.BuildOptionPcd:
for PcdItem in GlobalData.BuildOptionPcd:
if (Pcd.TokenSpaceGuidCName, TokenCName) == (PcdItem[0], PcdItem[1]):
Pcd.DefaultValue = PcdItem[2]
break
if Pcd.PcdValueFromComm:
Pcd.DefaultValue = Pcd.PcdValueFromComm
if Pcd.Type in gDynamicExPcd:
TokenNumber = int(Pcd.TokenValue, 0)
@@ -1215,12 +1212,8 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
PatchPcdSizeTokenName = '_PCD_PATCHABLE_' + TokenCName +'_SIZE'
PatchPcdSizeVariableName = '_gPcd_BinaryPatch_Size_' + TokenCName
if GlobalData.BuildOptionPcd:
for PcdItem in GlobalData.BuildOptionPcd:
if (Pcd.TokenSpaceGuidCName, TokenCName) == (PcdItem[0], PcdItem[1]):
Pcd.DefaultValue = PcdItem[2]
break
if Pcd.PcdValueFromComm:
Pcd.DefaultValue = Pcd.PcdValueFromComm
#
# Write PCDs
#

View File

@@ -1551,25 +1551,15 @@ class TopLevelMakefile(BuildFile):
if GlobalData.gIgnoreSource:
ExtraOption += " --ignore-sources"
for index, option in enumerate(GlobalData.gCommand):
if "--pcd" == option and GlobalData.gCommand[index+1]:
pcdName, pcdValue = GlobalData.gCommand[index+1].split('=')
for Item in GlobalData.BuildOptionPcd:
if '.'.join(Item[0:2]) == pcdName:
pcdValue = Item[2]
if pcdValue.startswith('L') or pcdValue.startswith('"'):
pcdValue, Size = ParseFieldValue(pcdValue)
NewVal = '{'
for S in range(Size):
NewVal = NewVal + '0x%02X' % ((pcdValue >> S * 8) & 0xff)
NewVal += ','
pcdValue = NewVal[:-1] + '}'
break
if pcdValue.startswith('{'):
pcdValue = 'H' + '"' + pcdValue + '"'
ExtraOption += " --pcd " + pcdName + '=' + pcdValue
else:
ExtraOption += " --pcd " + GlobalData.gCommand[index+1]
for pcd in GlobalData.BuildOptionPcd:
if pcd[2]:
pcdname = '.'.join(pcd[0:3])
else:
pcdname = '.'.join(pcd[0:2])
if pcd[3].startswith('{'):
ExtraOption += " --pcd " + pcdname + '=' + 'H' + '"' + pcd[3] + '"'
else:
ExtraOption += " --pcd " + pcdname + '=' + pcd[3]
MakefileName = self._FILE_NAME_[self._FileType]
SubBuildCommandList = []