diff options
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r-- | BaseTools/Source/Python/GenFds/FfsInfStatement.py | 15 | ||||
-rw-r--r-- | BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py | 3 |
2 files changed, 17 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index b0b242be8d..dfff892e21 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -46,6 +46,7 @@ from Common.LongFilePathSupport import OpenLongFilePath as open import Common.GlobalData as GlobalData
from DepexSection import DepexSection
from Common.Misc import SaveFileOnChange
+from Common.Expression import *
## generate FFS from INF
#
@@ -279,6 +280,20 @@ class FfsInfStatement(FfsInfStatementClassObject): if not DscOverride and not FdfOverride and not BuildOptionOverride:
continue
+
+ # Support Flexible PCD format
+ if DefaultValue:
+ try:
+ DefaultValue = ValueExpressionEx(DefaultValue, Pcd.DatumType, Platform._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, DefaultValue), File=self.InfFileName)
+
+ if Pcd.DefaultValue:
+ try:
+ Pcd.DefaultValue = ValueExpressionEx(Pcd.DefaultValue, 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, '']:
diff --git a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py index 882da81930..942ba88d20 100644 --- a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py +++ b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py @@ -161,10 +161,11 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0): #
# Patch {0x1, 0x2, ...} byte by byte
#
- ValueList = ValueString[1 : len(ValueString) - 1].split(', ')
+ ValueList = ValueString[1 : len(ValueString) - 1].split(',')
Index = 0
try:
for ByteString in ValueList:
+ ByteString = ByteString.strip()
if ByteString.upper().startswith('0X'):
ByteValue = int(ByteString, 16)
else:
|