summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/Capsule.py
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2017-06-06 13:28:07 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2017-06-07 16:12:44 +0800
commitd4c558e83d8f428393d27816772efc7f4b0e8403 (patch)
treeb8e76b784a6d97a37d91e579822bd76236c2fe69 /BaseTools/Source/Python/GenFds/Capsule.py
parent4a1167dfef3deff3d96f06ccfd104e26486d7dae (diff)
downloadedk2-d4c558e83d8f428393d27816772efc7f4b0e8403.tar.gz
BaseTools: Fix the bug use same FMP_PAYLOAD in different capsule file
Fix the bug that use same FMP_PAYLOAD in different capsule file. Because in previous FMP generation, the FMP already be generated, so we don't need to regenerate again. 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, 10 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/Source/Python/GenFds/Capsule.py
index d025f0c2b3..e03d789957 100644
--- a/BaseTools/Source/Python/GenFds/Capsule.py
+++ b/BaseTools/Source/Python/GenFds/Capsule.py
@@ -1,7 +1,7 @@
## @file
# generate capsule
#
-# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -141,6 +141,11 @@ class Capsule (CapsuleClassObject) :
Content.write(File.read())
File.close()
for fmp in self.FmpPayloadList:
+ if fmp.Existed:
+ FwMgrHdr.write(pack('=Q', PreSize))
+ PreSize += len(fmp.Buffer)
+ Content.write(fmp.Buffer)
+ continue
if fmp.ImageFile:
for Obj in fmp.ImageFile:
fmp.ImageFile = Obj.GenCapsuleSubItem()
@@ -169,12 +174,12 @@ class Capsule (CapsuleClassObject) :
dwLength = 4 + 2 + 2 + 16 + 16 + 256 + 256
fmp.ImageFile = CapOutputTmp
AuthData = [fmp.MonotonicCount, dwLength, WIN_CERT_REVISION, WIN_CERT_TYPE_EFI_GUID, fmp.Certificate_Guid]
- Buffer = fmp.GenCapsuleSubItem(AuthData)
+ fmp.Buffer = fmp.GenCapsuleSubItem(AuthData)
else:
- Buffer = fmp.GenCapsuleSubItem()
+ fmp.Buffer = fmp.GenCapsuleSubItem()
FwMgrHdr.write(pack('=Q', PreSize))
- PreSize += len(Buffer)
- Content.write(Buffer)
+ PreSize += len(fmp.Buffer)
+ Content.write(fmp.Buffer)
BodySize = len(FwMgrHdr.getvalue()) + len(Content.getvalue())
Header.write(pack('=I', HdrSize + BodySize))
#