From 763e8edf610b2ccf422986c81ee36b4733560cdb Mon Sep 17 00:00:00 2001 From: Yonghong Zhu Date: Thu, 25 Feb 2016 16:13:31 +0800 Subject: BaseTools: add new command line option to support override PCD value this patch add new feature to support override PCD value on the command line. The value from the command line is the highest priority. 1.Add option(--pcd) to support both PcdName and TokenSpaceGuild.PcdName 2.For void* type PCD, use following format: cstring PCD: --pcd PcdName="string" unicodestring PCD: --pcd PcdName=L"string" CArray PCD: --pcd PcdName=B"{0x1, 0x2}" 3.Build Report, use *B to show the PCD value was overridden in the command line. 4.Error Condition: Report error if the PCD is not found Report error if the PcdName is found under multiple different TokenSpaceGuid Report error if PCD value syntax is incorrect Report error if void* type PCD value exceed its max size Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- BaseTools/Source/Python/AutoGen/GenC.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'BaseTools/Source/Python/AutoGen/GenC.py') diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index 3f0dfd90d9..842d8bd666 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -766,6 +766,13 @@ def GetPcdSize(Pcd): def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): TokenSpaceGuidValue = Pcd.TokenSpaceGuidValue #Info.GuidList[Pcd.TokenSpaceGuidCName] PcdTokenNumber = Info.PlatformInfo.PcdTokenNumber + + if GlobalData.BuildOptionPcd: + for PcdItem in GlobalData.BuildOptionPcd: + if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) == (PcdItem[0], PcdItem[1]): + Pcd.DefaultValue = PcdItem[2] + break + # # Write PCDs # @@ -1054,7 +1061,13 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd): FixPcdSizeTokenName = '_PCD_SIZE_' + Pcd.TokenCName PatchPcdSizeTokenName = '_PCD_PATCHABLE_' + Pcd.TokenCName +'_SIZE' PatchPcdSizeVariableName = '_gPcd_BinaryPatch_Size_' + Pcd.TokenCName - + + if GlobalData.BuildOptionPcd: + for PcdItem in GlobalData.BuildOptionPcd: + if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) == (PcdItem[0], PcdItem[1]): + Pcd.DefaultValue = PcdItem[2] + break + # # Write PCDs # -- cgit v1.2.3