diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-03-07 14:14:43 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-03-09 16:34:37 +0800 |
commit | 8565b5829c1f30408020a4adb37074dba5492378 (patch) | |
tree | 690c44ca41011b766edfbe50e4cba0a52de1eede /BaseTools/Source/Python/GenFds/FfsInfStatement.py | |
parent | 0f228f19fb40ffe60b13962ff639917435c562a9 (diff) | |
download | edk2-8565b5829c1f30408020a4adb37074dba5492378.tar.gz edk2-8565b5829c1f30408020a4adb37074dba5492378.tar.bz2 edk2-8565b5829c1f30408020a4adb37074dba5492378.zip |
BaseTools: Update --pcd parser to support flexible pcd format
This patch update --pcd parser to support flexible pcd format.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/FfsInfStatement.py')
-rw-r--r-- | BaseTools/Source/Python/GenFds/FfsInfStatement.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index dfff892e21..a348233911 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -1,7 +1,7 @@ ## @file
# process FFS generation from INF statement
#
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2014-2016 Hewlett-Packard Development Company, L.P.<BR>
#
# This program and the accompanying materials
@@ -274,7 +274,9 @@ class FfsInfStatement(FfsInfStatementClassObject): if GlobalData.BuildOptionPcd:
for pcd in GlobalData.BuildOptionPcd:
if PcdKey == (pcd[1], pcd[0]):
- DefaultValue = pcd[2]
+ if pcd[2]:
+ continue
+ DefaultValue = pcd[3]
BuildOptionOverride = True
break
@@ -288,15 +290,15 @@ class FfsInfStatement(FfsInfStatementClassObject): except BadExpression:
EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, DefaultValue), File=self.InfFileName)
- if Pcd.DefaultValue:
+ if Pcd.InfDefaultValue:
try:
- Pcd.DefaultValue = ValueExpressionEx(Pcd.DefaultValue, Pcd.DatumType, Platform._GuidDict)(True)
+ Pcd.InfDefaultValue = ValueExpressionEx(Pcd.InfDefaultValue, Pcd.DatumType, Platform._GuidDict)(True)
except BadExpression:
EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DefaultValue),File=self.InfFileName)
# Check value, if value are equal, no need to patch
if Pcd.DatumType == "VOID*":
- if Pcd.DefaultValue == DefaultValue or DefaultValue in [None, '']:
+ if Pcd.InfDefaultValue == DefaultValue or DefaultValue in [None, '']:
continue
# Get the string size from FDF or DSC
if DefaultValue[0] == 'L':
@@ -310,15 +312,15 @@ class FfsInfStatement(FfsInfStatementClassObject): Pcd.MaxDatumSize = PatchPcd.MaxDatumSize
# If no defined the maximum size in DSC, try to get current size from INF
if Pcd.MaxDatumSize in ['', None]:
- Pcd.MaxDatumSize = str(len(Pcd.DefaultValue.split(',')))
+ Pcd.MaxDatumSize = str(len(Pcd.InfDefaultValue.split(',')))
else:
Base1 = Base2 = 10
- if Pcd.DefaultValue.upper().startswith('0X'):
+ if Pcd.InfDefaultValue.upper().startswith('0X'):
Base1 = 16
if DefaultValue.upper().startswith('0X'):
Base2 = 16
try:
- PcdValueInImg = int(Pcd.DefaultValue, Base1)
+ PcdValueInImg = int(Pcd.InfDefaultValue, Base1)
PcdValueInDscOrFdf = int(DefaultValue, Base2)
if PcdValueInImg == PcdValueInDscOrFdf:
continue
|