]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/CapsuleData.py
BaseTools: Adjust the spaces around commas and colons
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / CapsuleData.py
index d7a6d54aa87dae829e823d3b157e21dcbc52d006..9dc55e5dbf7b1df4fc4df74df6a97ba56f2dfbb6 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-2018, 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
@@ -80,8 +80,8 @@ class CapsuleFv (CapsuleData):
     #\r
     def GenCapsuleSubItem(self):\r
         if self.FvName.find('.fv') == -1:\r
-            if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
-                FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())\r
+            if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:\r
+                FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[self.FvName.upper()]\r
                 FdBuffer = StringIO.StringIO('')\r
                 FvObj.CapsuleName = self.CapsuleName\r
                 FvFile = FvObj.AddToBuffer(FdBuffer)\r
@@ -112,8 +112,8 @@ class CapsuleFd (CapsuleData):
     #\r
     def GenCapsuleSubItem(self):\r
         if self.FdName.find('.fd') == -1:\r
-            if self.FdName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
-                FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())\r
+            if self.FdName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:\r
+                FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[self.FdName.upper()]\r
                 FdFile = FdObj.GenFd()\r
                 return FdFile\r
         else:\r
@@ -183,10 +183,16 @@ 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
-            self.Version = 0x00000002\r
+            self.Version = '0x00000002'\r
+        if not self.ImageIndex:\r
+            self.ImageIndex = '0x1'\r
+        if not self.HardwareInstance:\r
+            self.HardwareInstance = '0x0'\r
         ImageFileSize = os.path.getsize(self.ImageFile)\r
         if AuthData:\r
             # the ImageFileSize need include the full authenticated info size. From first bytes of MonotonicCount to last bytes of certificate.\r
@@ -201,7 +207,7 @@ class CapsulePayload(CapsuleData):
         #\r
         Guid = self.ImageTypeId.split('-')\r
         Buffer = pack('=ILHHBBBBBBBBBBBBIIQ',\r
-                       int(self.Version,16),\r
+                       int(self.Version, 16),\r
                        int(Guid[0], 16), \r
                        int(Guid[1], 16), \r
                        int(Guid[2], 16), \r
@@ -235,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