diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2017-01-04 10:40:54 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2017-01-06 16:11:04 +0800 |
commit | 9ce9bf5339f8a5a9acfd77d9fbc70bb92a55dd6a (patch) | |
tree | 6a9ab3cea0316457042d277132ac1fa8c5b0a962 /BaseTools/Source/Python | |
parent | 9fba84ac6ef01a0debf0cb823dd9eedb491bf1de (diff) | |
download | edk2-platforms-9ce9bf5339f8a5a9acfd77d9fbc70bb92a55dd6a.tar.xz |
BaseTools: not report error for the optional items in the FmpTokens
<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>
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r-- | BaseTools/Source/Python/GenFds/CapsuleData.py | 8 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/FdfParser.py | 13 |
2 files changed, 11 insertions, 10 deletions
diff --git a/BaseTools/Source/Python/GenFds/CapsuleData.py b/BaseTools/Source/Python/GenFds/CapsuleData.py index d7a6d54aa8..24c210d964 100644 --- a/BaseTools/Source/Python/GenFds/CapsuleData.py +++ b/BaseTools/Source/Python/GenFds/CapsuleData.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
@@ -186,7 +186,11 @@ class CapsulePayload(CapsuleData): def GenCapsuleSubItem(self, AuthData=[]):
if not self.Version:
- self.Version = 0x00000002
+ self.Version = '0x00000002'
+ if not self.ImageIndex:
+ self.ImageIndex = '0x1'
+ if not self.HardwareInstance:
+ self.HardwareInstance = '0x0'
ImageFileSize = os.path.getsize(self.ImageFile)
if AuthData:
# the ImageFileSize need include the full authenticated info size. From first bytes of MonotonicCount to last bytes of certificate.
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 2900283737..e1295f2ee7 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1,7 +1,7 @@ ## @file
# parse FDF file
#
-# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR>
#
# This program and the accompanying materials
@@ -3239,13 +3239,10 @@ class FdfParser: if (FmpData.MonotonicCount and not FmpData.Certificate_Guid) or (not FmpData.MonotonicCount and FmpData.Certificate_Guid):
EdkLogger.error("FdfParser", FORMAT_INVALID, "CERTIFICATE_GUID and MONOTONIC_COUNT must be work as a pair.")
- # remove CERTIFICATE_GUID and MONOTONIC_COUNT from FmpKeyList, since these keys are optional
- if 'CERTIFICATE_GUID' in FmpKeyList:
- FmpKeyList.remove('CERTIFICATE_GUID')
- if 'MONOTONIC_COUNT' in FmpKeyList:
- FmpKeyList.remove('MONOTONIC_COUNT')
- if FmpKeyList:
- raise Warning("Missing keywords %s in FMP payload section." % ', '.join(FmpKeyList), self.FileName, self.CurrentLineNumber)
+
+ # Only the IMAGE_TYPE_ID is required item
+ if FmpKeyList and 'IMAGE_TYPE_ID' in FmpKeyList:
+ raise Warning("Missing keywords IMAGE_TYPE_ID in FMP payload section.", self.FileName, self.CurrentLineNumber)
# get the Image file and Vendor code file
self.__GetFMPCapsuleData(FmpData)
if not FmpData.ImageFile:
|