summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/GenMake.py
diff options
context:
space:
mode:
authorFeng, YunhuaX </o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Feng, YunhuaX4e1>2018-02-26 16:42:30 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-02-28 08:47:11 +0800
commitea927d2f3f2e34f4b26c10829f5887830cb0720e (patch)
treec7c28de62b6414ad06a61952dcd7f904407995fb /BaseTools/Source/Python/AutoGen/GenMake.py
parentf0c69b614cf56df1e7908574111d92864ca3ee9c (diff)
downloadedk2-ea927d2f3f2e34f4b26c10829f5887830cb0720e.tar.gz
edk2-ea927d2f3f2e34f4b26c10829f5887830cb0720e.tar.bz2
edk2-ea927d2f3f2e34f4b26c10829f5887830cb0720e.zip
BaseTools: Fix flexible PCD single quote and double quote bugs
1.The " and ' inside the string, must use escape character format (\", \') 2.'string' and L'string' format in --pcd, it must be double quoted first. Some examples that to match --pcd format and DSC format --pcd DSC format L"ABC" L"ABC" "AB\\\"C" "AB\"C" "AB\\\'C" "AB\'C" L"\'AB\\\"C\'" L'AB\"C' "\'AB\\\'C\'" 'AB\'C' H"{0, L\"AB\\\"B\", \'ab\\\"c\'}" {0, L"AB\"B", 'ab\"c'} Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenMake.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenMake.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index afe6f2f99c..4b924d21e0 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1555,13 +1555,19 @@ class TopLevelMakefile(BuildFile):
for index, option in enumerate(GlobalData.gCommand):
if "--pcd" == option and GlobalData.gCommand[index+1]:
pcdName, pcdValue = GlobalData.gCommand[index+1].split('=')
- if pcdValue.startswith('H'):
- pcdValue = 'H' + '"' + pcdValue[1:] + '"'
- ExtraOption += " --pcd " + pcdName + '=' + pcdValue
- elif pcdValue.startswith("L'"):
- ExtraOption += "--pcd " + pcdName + '=' + pcdValue
- elif pcdValue.startswith('L'):
- pcdValue = 'L' + '"' + pcdValue[1:] + '"'
+ 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]