]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix the bug use same FMP_PAYLOAD in different capsule file
authorYonghong Zhu <yonghong.zhu@intel.com>
Tue, 6 Jun 2017 05:28:07 +0000 (13:28 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Wed, 7 Jun 2017 08:12:44 +0000 (16:12 +0800)
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>
BaseTools/Source/Python/GenFds/Capsule.py
BaseTools/Source/Python/GenFds/CapsuleData.py

index d025f0c2b35f113efb0893234a4a061415a97667..e03d78995737eab2ab05fbc66acd9501496755c0 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # generate capsule\r
 #\r
-#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -141,6 +141,11 @@ class Capsule (CapsuleClassObject) :
             Content.write(File.read())\r
             File.close()\r
         for fmp in self.FmpPayloadList:\r
+            if fmp.Existed:\r
+                FwMgrHdr.write(pack('=Q', PreSize))\r
+                PreSize += len(fmp.Buffer)\r
+                Content.write(fmp.Buffer)\r
+                continue\r
             if fmp.ImageFile:\r
                 for Obj in fmp.ImageFile:\r
                     fmp.ImageFile = Obj.GenCapsuleSubItem()\r
@@ -169,12 +174,12 @@ class Capsule (CapsuleClassObject) :
                     dwLength = 4 + 2 + 2 + 16 + 16 + 256 + 256\r
                 fmp.ImageFile = CapOutputTmp\r
                 AuthData = [fmp.MonotonicCount, dwLength, WIN_CERT_REVISION, WIN_CERT_TYPE_EFI_GUID, fmp.Certificate_Guid]\r
-                Buffer = fmp.GenCapsuleSubItem(AuthData)\r
+                fmp.Buffer = fmp.GenCapsuleSubItem(AuthData)\r
             else:\r
-                Buffer = fmp.GenCapsuleSubItem()\r
+                fmp.Buffer = fmp.GenCapsuleSubItem()\r
             FwMgrHdr.write(pack('=Q', PreSize))\r
-            PreSize += len(Buffer)\r
-            Content.write(Buffer)\r
+            PreSize += len(fmp.Buffer)\r
+            Content.write(fmp.Buffer)\r
         BodySize = len(FwMgrHdr.getvalue()) + len(Content.getvalue())\r
         Header.write(pack('=I', HdrSize + BodySize))\r
         #\r
index 24c210d964d2146d9a4fecf477bd3762473601fe..5b806d9e44825a6a1a4d20cd05cbc365f9e73004 100644 (file)
@@ -183,6 +183,8 @@ class CapsulePayload(CapsuleData):
         self.VendorCodeFile = []\r
         self.Certificate_Guid = None\r
         self.MonotonicCount = None\r
+        self.Existed = False\r
+        self.Buffer = None\r
 \r
     def GenCapsuleSubItem(self, AuthData=[]):\r
         if not self.Version:\r
@@ -239,4 +241,5 @@ class CapsulePayload(CapsuleData):
             VendorFile = open(self.VendorCodeFile, 'rb')\r
             Buffer += VendorFile.read()\r
             VendorFile.close()\r
+        self.Existed = True\r
         return Buffer\r