summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2016-01-29 04:44:54 +0000
committeryzhu52 <yzhu52@Edk2>2016-01-29 04:44:54 +0000
commitca85291f1f020652254457cc9edbb3caf6a2ed56 (patch)
tree9b3b1832437351ac25be72c03d2260b7ecf95341 /BaseTools
parent898b5b63c389e9793b891705883fa161f6b4488e (diff)
downloadedk2-ca85291f1f020652254457cc9edbb3caf6a2ed56.tar.gz
edk2-ca85291f1f020652254457cc9edbb3caf6a2ed56.tar.bz2
edk2-ca85291f1f020652254457cc9edbb3caf6a2ed56.zip
BaseTools: Fix a bug for VpdOffset calculate
The VpdOffset value in the DSC both support integer and Hex value, so we fix the bug to support both format. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19765 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index dfb5b72b13..55a59dabc0 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1154,7 +1154,14 @@ class PlatformAutoGen(AutoGen):
Alignment = 2
else:
Alignment = 1
- if int(Sku.VpdOffset) % Alignment != 0:
+ try:
+ VpdOffset = int(Sku.VpdOffset)
+ except:
+ try:
+ VpdOffset = int(Sku.VpdOffset, 16)
+ except:
+ EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
+ if VpdOffset % Alignment != 0:
EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Alignment))
VpdFile.Add(Pcd, Sku.VpdOffset)
# if the offset of a VPD is *, then it need to be fixed up by third party tool.
@@ -1220,7 +1227,14 @@ class PlatformAutoGen(AutoGen):
Alignment = 2
else:
Alignment = 1
- if int(Sku.VpdOffset) % Alignment != 0:
+ try:
+ VpdOffset = int(Sku.VpdOffset)
+ except:
+ try:
+ VpdOffset = int(Sku.VpdOffset, 16)
+ except:
+ EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName))
+ if VpdOffset % Alignment != 0:
EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, Alignment))
VpdFile.Add(DscPcdEntry, Sku.VpdOffset)
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":