From: "Gao, Liming" <liming.gao@intel.com>
To: "Zhu, Yonghong" <yonghong.zhu@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [Patch] BaseTools: not report error for the optional items in the FmpTokens
Date: Wed, 4 Jan 2017 05:32:31 +0000 [thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6C8CD4@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1483506897-109600-1-git-send-email-yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
>-----Original Message-----
>From: Zhu, Yonghong
>Sent: Wednesday, January 04, 2017 1:15 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] 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>
>---
> BaseTools/Source/Python/GenFds/CapsuleData.py | 8 ++++++--
> 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 d7a6d54..24c210d 100644
>--- a/BaseTools/Source/Python/GenFds/CapsuleData.py
>+++ b/BaseTools/Source/Python/GenFds/CapsuleData.py
>@@ -1,9 +1,9 @@
> ## @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
> # which accompanies this distribution. The full text of the license may be
>found at
> # http://opensource.org/licenses/bsd-license.php
>@@ -184,11 +184,15 @@ class CapsulePayload(CapsuleData):
> self.Certificate_Guid = None
> self.MonotonicCount = None
>
> 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.
> # the 32 bit is the MonotonicCount, dwLength, wRevision,
>wCertificateType and CertType
> ImageFileSize += 32
>diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
>b/BaseTools/Source/Python/GenFds/FdfParser.py
>index 2900283..e1295f2 100644
>--- a/BaseTools/Source/Python/GenFds/FdfParser.py
>+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
>@@ -1,9 +1,9 @@
> ## @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
> # are licensed and made available under the terms and conditions of the BSD
>License
> # which accompanies this distribution. The full text of the license may be
>found at
>@@ -3237,17 +3237,14 @@ class FdfParser:
> else:
> self.__UndoToken()
>
> 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:
> raise Warning("Missing image file in FMP payload section.",
>self.FileName, self.CurrentLineNumber)
> # check whether more than one Vendor code file
>--
>2.6.1.windows.1
prev parent reply other threads:[~2017-01-04 5:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-04 5:14 [Patch] BaseTools: not report error for the optional items in the FmpTokens Yonghong Zhu
2017-01-04 5:32 ` Gao, Liming [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14D6C8CD4@shsmsx102.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox