]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: not report error for the optional items in the FmpTokens
authorYonghong Zhu <yonghong.zhu@intel.com>
Wed, 4 Jan 2017 02:40:54 +0000 (10:40 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 6 Jan 2017 08:11:04 +0000 (16:11 +0800)
<FmpTokens> in the FDF spec defined some optional items, eg: IMAGE_INDEX,
HARDWARE_INSTANCE. but current tool report error if no such item is exist
in the FDF file.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=293
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/CapsuleData.py
BaseTools/Source/Python/GenFds/FdfParser.py

index d7a6d54aa87dae829e823d3b157e21dcbc52d006..24c210d964d2146d9a4fecf477bd3762473601fe 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
@@ -186,7 +186,11 @@ class CapsulePayload(CapsuleData):
 \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
index 29002837372c9f5f23b3d6bdc1e94840058ff1dd..e1295f2ee7f6475d6e5198dbb2406274080f43cc 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # parse FDF file\r
 #\r
-#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #  Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR>\r
 #\r
 #  This program and the accompanying materials\r
@@ -3239,13 +3239,10 @@ class FdfParser:
 \r
         if (FmpData.MonotonicCount and not FmpData.Certificate_Guid) or (not FmpData.MonotonicCount and FmpData.Certificate_Guid):\r
             EdkLogger.error("FdfParser", FORMAT_INVALID, "CERTIFICATE_GUID and MONOTONIC_COUNT must be work as a pair.")\r
-        # remove CERTIFICATE_GUID and MONOTONIC_COUNT from FmpKeyList, since these keys are optional\r
-        if 'CERTIFICATE_GUID' in FmpKeyList:\r
-            FmpKeyList.remove('CERTIFICATE_GUID')\r
-        if 'MONOTONIC_COUNT' in FmpKeyList:\r
-            FmpKeyList.remove('MONOTONIC_COUNT')\r
-        if FmpKeyList:\r
-            raise Warning("Missing keywords %s in FMP payload section." % ', '.join(FmpKeyList), self.FileName, self.CurrentLineNumber)\r
+\r
+        # Only the IMAGE_TYPE_ID is required item\r
+        if FmpKeyList and 'IMAGE_TYPE_ID' in FmpKeyList:\r
+            raise Warning("Missing keywords IMAGE_TYPE_ID in FMP payload section.", self.FileName, self.CurrentLineNumber)\r
         # get the Image file and Vendor code file\r
         self.__GetFMPCapsuleData(FmpData)\r
         if not FmpData.ImageFile:\r