From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EAE9281927 for ; Tue, 3 Jan 2017 21:32:34 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 03 Jan 2017 21:32:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,458,1477983600"; d="scan'208";a="804891197" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 03 Jan 2017 21:32:34 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 3 Jan 2017 21:32:34 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Wed, 4 Jan 2017 13:32:32 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTools: not report error for the optional items in the FmpTokens Thread-Index: AQHSZkmEbZt6S0XogUujeAEWmd67rqEny0nQ Date: Wed, 4 Jan 2017 05:32:31 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6C8CD4@shsmsx102.ccr.corp.intel.com> References: <1483506897-109600-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1483506897-109600-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: not report error for the optional items in the FmpTokens X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2017 05:32:35 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Zhu, Yonghong >Sent: Wednesday, January 04, 2017 1:15 PM >To: edk2-devel@lists.01.org >Cc: Gao, Liming >Subject: [Patch] BaseTools: not report error for the optional items in the >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=3D293 >Cc: Liming Gao >Contributed-under: TianoCore Contribution Agreement 1.0 >Signed-off-by: Yonghong Zhu >--- > 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.
>+# Copyright (c) 2007-2017, Intel Corporation. All rights reserved.
> # > # 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 =3D None > self.MonotonicCount =3D None > > def GenCapsuleSubItem(self, AuthData=3D[]): > if not self.Version: >- self.Version =3D 0x00000002 >+ self.Version =3D '0x00000002' >+ if not self.ImageIndex: >+ self.ImageIndex =3D '0x1' >+ if not self.HardwareInstance: >+ self.HardwareInstance =3D '0x0' > ImageFileSize =3D 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 +=3D 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.
>+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
> # Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.
> # > # 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_GUI= D >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