From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.10334.1587345487946035527 for ; Sun, 19 Apr 2020 18:18:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=NMZ1bgP4; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: liming.gao@intel.com) IronPort-SDR: bxCnnqshW0XoU8EV2BBQQEgy0raFynLWbfCbHoABlSUIHLGJZR9WUjcv1Ra7S9BgF6qZTWDk1i ab0Cb08VoMYg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2020 18:18:07 -0700 IronPort-SDR: YKul05f9TCIIb2vCf8D/D+wL5EGnbdCeGww0Co1rhuUsBCOGn1szoo1F6xZihL/4ts5F4B729j OWH5i4mEhCAA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,405,1580803200"; d="scan'208";a="287625115" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga008.jf.intel.com with ESMTP; 19 Apr 2020 18:18:06 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 19 Apr 2020 18:18:06 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 19 Apr 2020 18:18:06 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 19 Apr 2020 18:18:06 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.49) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 19 Apr 2020 18:18:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mjoWHlLVpLPU6SRrkz8Hwo2nGKG5rXTwEyOBfU6rFjGP+mSph1Hgb9eHDGXh8uLyMBgyeb+b/LtH5y7odcx1kUIYl5dlWVYPIL33aQVzD35puVoeS8/19jj48G5Jb+ipKzPP81BItjWQgDqmS6DBDBVOJDsZVcpTiJ9fabGlzp892fpxfFcVLu5mMTX2COi5yabtyJTTjOShnzAx9A0JotCT9/34xadtLN1Ggqvxgw7nfRkeZkSV6NDoeLmWWPwdTovMcMiA9VcTX6y+4YhubWjIGRK8u5UVI+H5P8VvvPj3vahYo2FB6I/aoXP3AoTObIriYX5IIJaIOKAjhC+I0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9wBj9Ky8lTtYm4g0wE8GkbSjh4NN+mgXUHgrFFSfUyA=; b=YHF9ncg2DU3aqb361fbhwNPVhhx6/e3hfey/q6qyi/R8OQeSDXwmbgYfZH+rQ7FU5pgyF5WqEZ6nhkWZx6i4bhi6pr7iQOgSzVFnRjXHRQlxBZA8XtOr5V9zts+Ff6LLyKPEuM9wSPIbijgMEVLBL7fmMYGlLtUTuAkhgkZbWmLT308i/BNAuTnn3Jk2M1XAtvLPruuDNEN596yWYnoWAYXMPOX4ylrPxMzDLg05OMgc6V54qI3oxKwWA+hREqnF+B9AXO6DyYp5q+EzlgM/4gbyD1O1tMvAMm4wpCp8PNsa+BY0jdLkIgMXfpz4vF2WsJ6jwMqlYLzk79l3llEaJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9wBj9Ky8lTtYm4g0wE8GkbSjh4NN+mgXUHgrFFSfUyA=; b=NMZ1bgP4pgcGHQ/Hb47ZwVBOiXmwbUXbtF+8R5m2iPwTrmTtX5pzoX+B2uirWRsxjEs+r+3vWBRrIBaOirY/jKPKSS4NSUtRPXytKHV8/F/Y+drWN+AygBGfU8xQGAivzfvFZVz8F+t6v5jWeDk/SQtLfHX5osKvCOfJUyTWqmQ= Received: from BN6PR11MB3972.namprd11.prod.outlook.com (2603:10b6:405:7f::11) by BN6PR11MB1443.namprd11.prod.outlook.com (2603:10b6:405:8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Mon, 20 Apr 2020 01:18:03 +0000 Received: from BN6PR11MB3972.namprd11.prod.outlook.com ([fe80::4dcc:bc5c:def:9ae9]) by BN6PR11MB3972.namprd11.prod.outlook.com ([fe80::4dcc:bc5c:def:9ae9%5]) with mapi id 15.20.2921.027; Mon, 20 Apr 2020 01:18:03 +0000 From: "Liming Gao" To: "Fan, ZhijuX" , "devel@edk2.groups.io" CC: "Feng, Bob C" Subject: Re: [PATCH V6] BaseTools:Add the spare space FV image size checker Thread-Topic: [PATCH V6] BaseTools:Add the spare space FV image size checker Thread-Index: AdYTG+StwkWvx/K8QluZzoxQvzOdKwAC2/dAAOJo0PAAAB/Y8A== Date: Mon, 20 Apr 2020 01:18:02 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: spf=none (sender IP is ) smtp.mailfrom=liming.gao@intel.com; x-originating-ip: [192.55.52.197] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f95d0d03-b92a-4375-23c3-08d7e4c8ac46 x-ms-traffictypediagnostic: BN6PR11MB1443: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2089; x-forefront-prvs: 03793408BA x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR11MB3972.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10019020)(346002)(366004)(39860400002)(376002)(396003)(136003)(110136005)(316002)(52536014)(186003)(8936002)(55016002)(9686003)(81156014)(6506007)(53546011)(7696005)(26005)(8676002)(2906002)(5660300002)(71200400001)(33656002)(4326008)(66946007)(66556008)(86362001)(107886003)(66446008)(64756008)(66476007)(76116006)(478600001);DIR:OUT;SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wFG4nZRJPYicGEb95wq1tREfcvIEbUnQqGcEIvi3z5nWhoHdE54UoCpekYdIHEoGpJyVhMrR5TGkleT+ePzwvG7mekTWY5R9mCG6yVeZCloXKwOm7t1hk/t5BgQ4ymxxytRGmWLTU/X1QJoHmHwS8qfP6RYspdxB3Xg4QPb8J1aKxwhrS1AhAwzDO4qWoNpjtMmTVcEjNaoqwzre+Mn6N2nTo4/b6dZ4nZMChxMWICxRv2fGXSmkCQ0cyCtfoNsuE4ed0AQXq4ifhD0+2Y1TvAhaz3bNUCrcfBQr/txB6q8Bn4/4NusBA4s3TnY/Vr4tMWKi1FxMrIxmi3ZiZgH5mFWqV+YOcxVMTLCushy7tmYCx0ZnOGNffBZdoQ7oYuab1bhhk1GEk39EJnggkZ+tgtDiSei+WHnT1QFuv8LqwyKguLaXq1D9mfwf6zAT/JLEoOpFNGH9gPTXuJcVeNbAeaEVluEBjlcAr3Pzt8YlpbqkVr9Vbweql7fBLw1OvpKl2XNLsFw56rdEwCMOUcAPAA== x-ms-exchange-antispam-messagedata: xD01bUrbwIv7kfIUOBqF9z4iaM5j8PVWwhC0Sptk4iQyNOQKTX8axF89kiYR5EOhzOozIy8WR42Zkq1hznoXe4i2WLYwJMPjPFqYBZGWlDkB4Td+V4LAKVhnPR3TVvQ1N5D8mu0JWyIANzqAt0SiIA== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: f95d0d03-b92a-4375-23c3-08d7e4c8ac46 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2020 01:18:03.0214 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lpk97VuwJ4PWx3BVBRqZHaSvR7XcGQYHbxsuZRHV+AfDtcfXRnN2E9oYEl8qredLT+rflrgXZmWmNKRIpLH91w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1443 Return-Path: liming.gao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Zhiju: With this improvement, Reviewed-by: Liming Gao > -----Original Message----- > From: Fan, ZhijuX > Sent: Monday, April 20, 2020 9:17 AM > To: Gao, Liming ; devel@edk2.groups.io > Cc: Feng, Bob C > Subject: RE: [PATCH V6] BaseTools:Add the spare space FV image size check= er >=20 > Hi LiMing, >=20 > I agree with this change and will improve it >=20 >=20 >=20 > Any question, please let me know. Thanks. >=20 > Best Regards > Fan Zhiju >=20 >=20 >=20 > > -----Original Message----- > > From: Gao, Liming > > Sent: Wednesday, April 15, 2020 9:21 PM > > To: Fan, ZhijuX ; devel@edk2.groups.io > > Cc: Feng, Bob C > > Subject: RE: [PATCH V6] BaseTools:Add the spare space FV image size che= cker > > > > Zhiju: > > Thanks for your update. The change is good to me. For the report erro= r > > message, I suggest as below > > > > xx FV free space xxxx is not enough to meet with the required spare spa= ce xxxx > > set by -D FV_SPARE_SPACE_THRESHOLD option. > > > > Thanks > > Liming > > > -----Original Message----- > > > From: Fan, ZhijuX > > > Sent: Wednesday, April 15, 2020 7:49 PM > > > To: devel@edk2.groups.io > > > Cc: Gao, Liming ; Feng, Bob C > > > > > > Subject: [PATCH V6] BaseTools:Add the spare space FV image size > > > checker > > > > > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2654 > > > > > > If FV is placed in FD region, its FV image size is fixed. > > > When FV image size exceeds it, it will trig the build break. > > > To alert the developer to adjust FV image size earlier, I request to > > > add new checker for the the spare FV space. > > > When the spare FV space is less than the specified threshold, build > > > tool will report the error. > > > > > > This checker is the optional. > > > It can be enabled by -D FV_SPARE_SPACE_THRESHOLD=3D10000. > > > Macro is the value of the spare space threshold size. > > > It can be decimal or hex format. If it is enabled, BaseTools will > > > check every FV with the fixed size. > > > If FV doesn't meet with the size requirement, Build tool will report > > > error message to say there is no enough spare space. > > > > > > Cc: Liming Gao > > > Cc: Bob Feng > > > Signed-off-by: Zhiju.Fan > > > --- > > > changed the error message > > > > > > BaseTools/Source/Python/Common/BuildToolError.py | 2 + > > > BaseTools/Source/Python/build/build.py | 47 ++++++++++ > > > 2 files changed, 49 insertions(+) > > > > > > diff --git a/BaseTools/Source/Python/Common/BuildToolError.py > > > b/BaseTools/Source/Python/Common/BuildToolError.py > > > index ecc83d0f48bd..21549683cd19 100644 > > > --- a/BaseTools/Source/Python/Common/BuildToolError.py > > > +++ b/BaseTools/Source/Python/Common/BuildToolError.py > > > @@ -64,6 +64,8 @@ COMMAND_FAILURE =3D 0x7000 > > > > > > PERMISSION_FAILURE =3D 0x8000 > > > > > > +FV_FREESIZE_ERROR =3D 0x9000 > > > + > > > CODE_ERROR =3D 0xC0DE > > > > > > AUTOGEN_ERROR =3D 0xF000 > > > diff --git a/BaseTools/Source/Python/build/build.py > > > b/BaseTools/Source/Python/build/build.py > > > index bec848a7b2e3..68f5b8cabea3 100755 > > > --- a/BaseTools/Source/Python/build/build.py > > > +++ b/BaseTools/Source/Python/build/build.py > > > @@ -25,6 +25,7 @@ import traceback > > > import multiprocessing > > > from threading import Thread,Event,BoundedSemaphore import threadin= g > > > +from linecache import getlines > > > from subprocess import Popen,PIPE, STDOUT from collections import > > > OrderedDict, defaultdict > > > > > > @@ -1413,6 +1414,9 @@ class Build(): > > > if Target =3D=3D 'fds': > > > if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db): > > > EdkLogger.error("build", COMMAND_FAILURE) > > > + Threshold =3D self.GetFreeSizeThreshold() > > > + if Threshold: > > > + self.CheckFreeSizeThreshold(Threshold, > > > + AutoGenObject.FvDir) > > > return True > > > > > > # run > > > @@ -2311,6 +2315,9 @@ class Build(): > > > GenFdsStart =3D time.time() > > > if GenFdsApi(Wa.GenFdsCommandDict, self.Db): > > > EdkLogger.error("build", COMMAND_FAILURE= ) > > > + Threshold =3D self.GetFreeSizeThreshold() > > > + if Threshold: > > > + self.CheckFreeSizeThreshold(Threshold, > > > + Wa.FvDir) > > > > > > # > > > # Create MAP file for all platform FVs after= GenFds. > > > @@ -2322,6 +2329,46 @@ class Build(): > > > # > > > self._SaveMapFile(MapBuffer, Wa) > > > self.CreateGuidedSectionToolsFile(Wa) > > > + > > > + ## GetFreeSizeThreshold() > > > + # > > > + # @retval int Threshold value > > > + # > > > + def GetFreeSizeThreshold(self): > > > + Threshold =3D None > > > + Threshold_Str =3D > > GlobalData.gCommandLineDefines.get('FV_SPARE_SPACE_THRESHOLD') > > > + if Threshold_Str: > > > + try: > > > + if Threshold_Str.lower().startswith('0x'): > > > + Threshold =3D int(Threshold_Str, 16) > > > + else: > > > + Threshold =3D int(Threshold_Str) > > > + except: > > > + EdkLogger.warn("build", 'incorrect value for > > > + FV_SPARE_SPACE_THRESHOLD %s.Only decimal or hex format is allowed.' > > > + % > > > Threshold_Str) > > > + return Threshold > > > + > > > + def CheckFreeSizeThreshold(self, Threshold=3DNone, FvDir=3DNone)= : > > > + if not isinstance(Threshold, int): > > > + return > > > + if not isinstance(FvDir, str) or not FvDir: > > > + return > > > + FdfParserObject =3D GlobalData.gFdfParser > > > + FvRegionNameList =3D [FvName for FvName in > > > + FdfParserObject.Profile.FvDict if > > > FdfParserObject.Profile.FvDict[FvName].FvRegionInFD] > > > + for FvName in FdfParserObject.Profile.FvDict: > > > + if FvName in FvRegionNameList: > > > + FvSpaceInfoFileName =3D os.path.join(FvDir, FvName.u= pper() + > > '.Fv.map') > > > + if os.path.exists(FvSpaceInfoFileName): > > > + FileLinesList =3D getlines(FvSpaceInfoFileName) > > > + for Line in FileLinesList: > > > + NameValue =3D Line.split('=3D') > > > + if len(NameValue) =3D=3D 2 and NameValue[0].= strip() =3D=3D > > 'EFI_FV_SPACE_SIZE': > > > + FreeSizeValue =3D int(NameValue[1].strip= (), 0) > > > + if FreeSizeValue < Threshold: > > > + EdkLogger.error("build", FV_FREESIZE= _ERROR, > > > + 'the required spare > > > + space in fv image size %d of %s FV exceeds the set spare space in f= v > > > + image size %d' % > > > ( > > > + FreeSizeValue, F= vName, Threshold)) > > > + break > > > + > > > ## Generate GuidedSectionTools.txt in the FV directories. > > > # > > > def CreateGuidedSectionToolsFile(self,Wa): > > > -- > > > 2.14.1.windows.1