]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/Capsule.py
Sync EDKII BaseTools to BaseTools project r1971
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / Capsule.py
index 7f17fcda684d0ab6c6d2746c13058534974d8326..fb9213b467b383cd5719b3bcaed94422e9799b1d 100644 (file)
@@ -1,9 +1,9 @@
 ## @file\r
 # generate capsule\r
 #\r
-#  Copyright (c) 2007, Intel Corporation\r
+#  Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
 #\r
-#  All rights reserved. This program and the accompanying materials\r
+#  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
 #  http://opensource.org/licenses/bsd-license.php\r
@@ -21,6 +21,7 @@ import os
 import subprocess\r
 import StringIO\r
 from Common.Misc import SaveFileOnChange\r
+from GenFds import GenFds\r
 \r
 \r
 T_CHAR_LF = '\n'\r
@@ -39,17 +40,26 @@ class Capsule (CapsuleClassObject) :
         self.BlockSize = None\r
         # For GenFv\r
         self.BlockNum = None\r
+        self.CapsuleName = None\r
 \r
     ## Generate capsule\r
     #\r
     #   @param  self        The object pointer\r
+    #   @retval string      Generated Capsule file path\r
     #\r
     def GenCapsule(self):\r
+        if self.UiCapsuleName.upper() + 'cap' in GenFds.ImageBinDict.keys():\r
+            return GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap']\r
+\r
+        GenFdsGlobalVariable.InfLogger( "\nGenerate %s Capsule" %self.UiCapsuleName)\r
         CapInfFile = self.GenCapInf()\r
         CapInfFile.writelines("[files]" + T_CHAR_LF)\r
-\r
+        CapFileList = []\r
         for CapsuleDataObj in self.CapsuleDataList :\r
+            CapsuleDataObj.CapsuleName = self.CapsuleName\r
             FileName = CapsuleDataObj.GenCapsuleSubItem()\r
+            CapsuleDataObj.CapsuleName = None\r
+            CapFileList.append(FileName)\r
             CapInfFile.writelines("EFI_FILE_NAME = " + \\r
                                    FileName      + \\r
                                    T_CHAR_LF)\r
@@ -63,9 +73,14 @@ class Capsule (CapsuleClassObject) :
         GenFdsGlobalVariable.GenerateFirmwareVolume(\r
                                 CapOutputFile,\r
                                 [self.CapInfFileName],\r
-                                Capsule=True\r
+                                Capsule=True,\r
+                                FfsList=CapFileList\r
                                 )\r
+\r
+        GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s Capsule Successfully" %self.UiCapsuleName)\r
         GenFdsGlobalVariable.SharpCounter = 0\r
+        GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap'] = CapOutputFile\r
+        return CapOutputFile\r
 \r
     ## Generate inf file for capsule\r
     #\r