summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/build/BuildReport.py
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2016-02-25 16:13:31 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2016-03-16 10:35:52 +0800
commit763e8edf610b2ccf422986c81ee36b4733560cdb (patch)
treea573ad5457838675c3ff681cdf2fdf39d458de66 /BaseTools/Source/Python/build/BuildReport.py
parentdb27e9f3d8f007bf26bcb8907ecab5b5f1fb8f24 (diff)
downloadedk2-763e8edf610b2ccf422986c81ee36b4733560cdb.tar.gz
edk2-763e8edf610b2ccf422986c81ee36b4733560cdb.tar.bz2
edk2-763e8edf610b2ccf422986c81ee36b4733560cdb.zip
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 <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/build/BuildReport.py')
-rw-r--r--BaseTools/Source/Python/build/BuildReport.py38
1 files changed, 26 insertions, 12 deletions
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 04a4d7dbd5..2dc02c2c4e 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -42,6 +42,7 @@ from Common.DataType import TAB_BRG_LIBRARY
from Common.DataType import TAB_BACK_SLASH
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.MultipleWorkspace import MultipleWorkspace as mws
+import Common.GlobalData as GlobalData
## Pattern to extract contents in EDK DXS files
gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
@@ -727,6 +728,7 @@ class PcdReport(object):
#
FileWrite(File, gSectionStart)
FileWrite(File, "Platform Configuration Database Report")
+ FileWrite(File, " *B - PCD override in the build option")
FileWrite(File, " *P - Platform scoped PCD override in DSC file")
FileWrite(File, " *F - Platform scoped PCD override in FDF file")
FileWrite(File, " *M - Module scoped PCD override")
@@ -767,6 +769,15 @@ class PcdReport(object):
InfDefault, PcdValue = ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type]
if InfDefault == "":
InfDefault = None
+
+ BuildOptionMatch = False
+ if GlobalData.BuildOptionPcd:
+ for pcd in GlobalData.BuildOptionPcd:
+ if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) == (pcd[0], pcd[1]):
+ PcdValue = pcd[2]
+ BuildOptionMatch = True
+ break
+
if First:
if ModulePcdSet == None:
FileWrite(File, "")
@@ -812,7 +823,9 @@ class PcdReport(object):
#
# Report PCD item according to their override relationship
#
- if DecMatch and InfMatch:
+ if BuildOptionMatch:
+ FileWrite(File, ' *B %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '(' + Pcd.DatumType + ')', PcdValue.strip()))
+ elif DecMatch and InfMatch:
FileWrite(File, ' %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '(' + Pcd.DatumType + ')', PcdValue.strip()))
else:
if DscMatch:
@@ -840,17 +853,18 @@ class PcdReport(object):
FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', DecDefaultValue.strip()))
if ModulePcdSet == None:
- ModuleOverride = self.ModulePcdOverride.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), {})
- for ModulePath in ModuleOverride:
- ModuleDefault = ModuleOverride[ModulePath]
- if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
- ModulePcdDefaultValueNumber = int(ModuleDefault.strip(), 0)
- Match = (ModulePcdDefaultValueNumber == PcdValueNumber)
- else:
- Match = (ModuleDefault.strip() == PcdValue.strip())
- if Match:
- continue
- FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 19, ModulePath, ModuleDefault.strip()))
+ if not BuildOptionMatch:
+ ModuleOverride = self.ModulePcdOverride.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), {})
+ for ModulePath in ModuleOverride:
+ ModuleDefault = ModuleOverride[ModulePath]
+ if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
+ ModulePcdDefaultValueNumber = int(ModuleDefault.strip(), 0)
+ Match = (ModulePcdDefaultValueNumber == PcdValueNumber)
+ else:
+ Match = (ModuleDefault.strip() == PcdValue.strip())
+ if Match:
+ continue
+ FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 19, ModulePath, ModuleDefault.strip()))
if ModulePcdSet == None:
FileWrite(File, gSectionEnd)