summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BaseTools/Source/Python/GenFds/Capsule.py6
-rw-r--r--BaseTools/Source/Python/GenFds/CapsuleData.py4
-rw-r--r--BaseTools/Source/Python/GenFds/FdfParser.py59
3 files changed, 53 insertions, 16 deletions
diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/Source/Python/GenFds/Capsule.py
index c98c054771..d025f0c2b3 100644
--- a/BaseTools/Source/Python/GenFds/Capsule.py
+++ b/BaseTools/Source/Python/GenFds/Capsule.py
@@ -141,6 +141,12 @@ class Capsule (CapsuleClassObject) :
Content.write(File.read())
File.close()
for fmp in self.FmpPayloadList:
+ if fmp.ImageFile:
+ for Obj in fmp.ImageFile:
+ fmp.ImageFile = Obj.GenCapsuleSubItem()
+ if fmp.VendorCodeFile:
+ for Obj in fmp.VendorCodeFile:
+ fmp.VendorCodeFile = Obj.GenCapsuleSubItem()
if fmp.Certificate_Guid:
ExternalTool, ExternalOption = FindExtendTool([], GenFdsGlobalVariable.ArchList, fmp.Certificate_Guid)
CmdOption = ''
diff --git a/BaseTools/Source/Python/GenFds/CapsuleData.py b/BaseTools/Source/Python/GenFds/CapsuleData.py
index 07cc1981d6..d7a6d54aa8 100644
--- a/BaseTools/Source/Python/GenFds/CapsuleData.py
+++ b/BaseTools/Source/Python/GenFds/CapsuleData.py
@@ -179,8 +179,8 @@ class CapsulePayload(CapsuleData):
self.ImageTypeId = None
self.ImageIndex = None
self.HardwareInstance = None
- self.ImageFile = None
- self.VendorCodeFile = None
+ self.ImageFile = []
+ self.VendorCodeFile = []
self.Certificate_Guid = None
self.MonotonicCount = None
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 02ae7c9f9c..33b40c727c 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -3259,15 +3259,12 @@ class FdfParser:
FmpKeyList.remove('MONOTONIC_COUNT')
if FmpKeyList:
raise Warning("Missing keywords %s in FMP payload section." % ', '.join(FmpKeyList), self.FileName, self.CurrentLineNumber)
- ImageFile = self.__ParseRawFileStatement()
- if not ImageFile:
+ # get the Image file and Vendor code file
+ self.__GetFMPCapsuleData(FmpData)
+ if not FmpData.ImageFile:
raise Warning("Missing image file in FMP payload section.", self.FileName, self.CurrentLineNumber)
- FmpData.ImageFile = ImageFile
- VendorCodeFile = self.__ParseRawFileStatement()
- if VendorCodeFile:
- FmpData.VendorCodeFile = VendorCodeFile
- AdditionalFile = self.__ParseRawFileStatement()
- if AdditionalFile:
+ # check whether more than one Vendor code file
+ if len(FmpData.VendorCodeFile) > 1:
raise Warning("At most one Image file and one Vendor code file are allowed in FMP payload section.", self.FileName, self.CurrentLineNumber)
self.Profile.FmpPayloadDict[FmpUiName] = FmpData
return True
@@ -3400,6 +3397,22 @@ class FdfParser:
if not (IsInf or IsFile or IsFv or IsFd or IsAnyFile or IsAfile or IsFmp):
break
+ ## __GetFMPCapsuleData() method
+ #
+ # Get capsule data for FMP capsule
+ #
+ # @param self The object pointer
+ # @param Obj for whom capsule data are got
+ #
+ def __GetFMPCapsuleData(self, Obj):
+
+ while True:
+ IsFv = self.__GetFvStatement(Obj, True)
+ IsFd = self.__GetFdStatement(Obj, True)
+ IsAnyFile = self.__GetAnyFileStatement(Obj, True)
+ if not (IsFv or IsFd or IsAnyFile):
+ break
+
## __GetFvStatement() method
#
# Get FV for capsule
@@ -3409,7 +3422,7 @@ class FdfParser:
# @retval True Successfully find a FV statement
# @retval False Not able to find a FV statement
#
- def __GetFvStatement(self, CapsuleObj):
+ def __GetFvStatement(self, CapsuleObj, FMPCapsule = False):
if not self.__IsKeyword("FV"):
return False
@@ -3425,7 +3438,13 @@ class FdfParser:
CapsuleFv = CapsuleData.CapsuleFv()
CapsuleFv.FvName = self.__Token
- CapsuleObj.CapsuleDataList.append(CapsuleFv)
+ if FMPCapsule:
+ if not CapsuleObj.ImageFile:
+ CapsuleObj.ImageFile.append(CapsuleFv)
+ else:
+ CapsuleObj.VendorCodeFile.append(CapsuleFv)
+ else:
+ CapsuleObj.CapsuleDataList.append(CapsuleFv)
return True
## __GetFdStatement() method
@@ -3437,7 +3456,7 @@ class FdfParser:
# @retval True Successfully find a FD statement
# @retval False Not able to find a FD statement
#
- def __GetFdStatement(self, CapsuleObj):
+ def __GetFdStatement(self, CapsuleObj, FMPCapsule = False):
if not self.__IsKeyword("FD"):
return False
@@ -3453,7 +3472,13 @@ class FdfParser:
CapsuleFd = CapsuleData.CapsuleFd()
CapsuleFd.FdName = self.__Token
- CapsuleObj.CapsuleDataList.append(CapsuleFd)
+ if FMPCapsule:
+ if not CapsuleObj.ImageFile:
+ CapsuleObj.ImageFile.append(CapsuleFd)
+ else:
+ CapsuleObj.VendorCodeFile.append(CapsuleFd)
+ else:
+ CapsuleObj.CapsuleDataList.append(CapsuleFd)
return True
def __GetFmpStatement(self, CapsuleObj):
@@ -3504,14 +3529,20 @@ class FdfParser:
# @retval True Successfully find a Anyfile statement
# @retval False Not able to find a AnyFile statement
#
- def __GetAnyFileStatement(self, CapsuleObj):
+ def __GetAnyFileStatement(self, CapsuleObj, FMPCapsule = False):
AnyFileName = self.__ParseRawFileStatement()
if not AnyFileName:
return False
CapsuleAnyFile = CapsuleData.CapsuleAnyFile()
CapsuleAnyFile.FileName = AnyFileName
- CapsuleObj.CapsuleDataList.append(CapsuleAnyFile)
+ if FMPCapsule:
+ if not CapsuleObj.ImageFile:
+ CapsuleObj.ImageFile.append(CapsuleAnyFile)
+ else:
+ CapsuleObj.VendorCodeFile.append(CapsuleAnyFile)
+ else:
+ CapsuleObj.CapsuleDataList.append(CapsuleAnyFile)
return True
## __GetAfileStatement() method