summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/Capsule.py
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2016-08-22 15:08:24 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2016-08-23 07:57:10 +0800
commita07901418affc8d357ad319c6dec993cc00d6915 (patch)
treee7d1cb3a0e6dceaa1c60c108f6f88812eba7ba21 /BaseTools/Source/Python/GenFds/Capsule.py
parent4977810b0f49a88d0d9719cc3b4d16f96e71ab8f (diff)
downloadedk2-a07901418affc8d357ad319c6dec993cc00d6915.tar.gz
edk2-a07901418affc8d357ad319c6dec993cc00d6915.tar.bz2
edk2-a07901418affc8d357ad319c6dec993cc00d6915.zip
BaseTools: add capsule image header for auth FMP capsule file
in last commit 91ae29, it missed to add the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER for the auth FMP capsule. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/Capsule.py')
-rw-r--r--BaseTools/Source/Python/GenFds/Capsule.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/Source/Python/GenFds/Capsule.py
index f8af12a7c2..93ecee10c6 100644
--- a/BaseTools/Source/Python/GenFds/Capsule.py
+++ b/BaseTools/Source/Python/GenFds/Capsule.py
@@ -141,6 +141,7 @@ class Capsule (CapsuleClassObject) :
Content.write(File.read())
File.close()
for fmp in self.FmpPayloadList:
+ Buffer = fmp.GenCapsuleSubItem()
if fmp.Certificate_Guid:
ExternalTool, ExternalOption = FindExtendTool([], GenFdsGlobalVariable.ArchList, fmp.Certificate_Guid)
CmdOption = ''
@@ -161,7 +162,7 @@ class Capsule (CapsuleClassObject) :
dwLength = 4 + 2 + 2 + 16 + os.path.getsize(CapOutputTmp) - os.path.getsize(CapInputFile)
else:
dwLength = 4 + 2 + 2 + 16 + 16 + 256 + 256
- Buffer = pack('Q', fmp.MonotonicCount)
+ Buffer += pack('Q', fmp.MonotonicCount)
Buffer += pack('I', dwLength)
Buffer += pack('H', WIN_CERT_REVISION)
Buffer += pack('H', WIN_CERT_TYPE_EFI_GUID)
@@ -178,10 +179,16 @@ class Capsule (CapsuleClassObject) :
PreSize += len(Buffer)
Content.write(Buffer)
else:
- payload = fmp.GenCapsuleSubItem()
+ ImageFile = open(fmp.ImageFile, 'rb')
+ Buffer += ImageFile.read()
+ ImageFile.close()
+ if fmp.VendorCodeFile:
+ VendorFile = open(fmp.VendorCodeFile, 'rb')
+ Buffer += VendorFile.read()
+ VendorFile.close()
FwMgrHdr.write(pack('=Q', PreSize))
- PreSize += len(payload)
- Content.write(payload)
+ PreSize += len(Buffer)
+ Content.write(Buffer)
BodySize = len(FwMgrHdr.getvalue()) + len(Content.getvalue())
Header.write(pack('=I', HdrSize + BodySize))
#