From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.4603.1681811915300001827 for ; Tue, 18 Apr 2023 02:58:35 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ZWRnMnGx; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: yuwei.chen@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681811915; x=1713347915; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=En08aqVT/elqL6rVFcwlgrQ6RUd9eSCekE8iNsmOt8k=; b=ZWRnMnGx+i41iTL0e5pxTf5UyIq99n9xx0q2Ljn0HOmwWwQUv9CO5oUC C09IlR1qnEQ9Q/HZu9cLlrey1SaIGz31PKmAtIKnmSYl8hIIJS4vxm+g2 LAl7BGBFJsBvyH6X3IH6Kf26YvyGEzjSudY3ZTF5ni/a04r928ZVqiA3F Zw7jR1LeAL3QNrq40qgD40vZHycLWVIlxHpfEEZP/vgET783b2olB7Jgn evlav7yKXN02g8tWYgm2Pn4QCO7bMUS7yVXcb7voWPwbOuxs8DSwAJVMj 1OF1+FO0E9BMlABvRjZ2hAPUFjUxtgiOUXoRPOPUXnUEgp+VMAm8hI2Zg A==; X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="410346419" X-IronPort-AV: E=Sophos;i="5.99,206,1677571200"; d="scan'208";a="410346419" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2023 02:58:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="691032168" X-IronPort-AV: E=Sophos;i="5.99,206,1677571200"; d="scan'208";a="691032168" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga002.jf.intel.com with ESMTP; 18 Apr 2023 02:58:27 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 18 Apr 2023 02:58:27 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 18 Apr 2023 02:58:26 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Tue, 18 Apr 2023 02:58:26 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.41) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Tue, 18 Apr 2023 02:58:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HBlss2wyi+9enfLlincUwD+IYvveko03bnjBeiSDVSDkndJbJAde/1X4WoLnoVA/rrkQ2+I1pVvwxecfm3jjgSTyJoaPN2T9LoznnS6dM66yos4a3Dre8VUj0jv6JqT+IvVbKPppyNtrn0qIiIYx5yYDcqGQ7tLfHrzhhjw567RbJT6zKpRB5UlPlyNWqjw9RhGNthQVxSWjROSBOT3blId2iS6cDDyUkcGdiWg4uwnt0D060cRCmBs/3JUORKn3RJ//tEgeR35T4hlJFEDxELr1ckHEdGP7fy60TtrQoWMlqNuHweo6pZB8aB1pGNU4DZLUZbuE6RKQ/VU7bGc08w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WfizxhMreSOBmqVKuFKjvjUvEeEfmbTA8o5n4l1zB78=; b=lm9lPEPa1/9GtIhMkkyuv7Bp5hs+w7FVtdzFAWWObS8MNMBWHNnpY6vsAyGqNjAw5XYRpZw85LmIO2jV1kFR+wV+nR47k8dKfeQnsJ8p5vgrP9UXEeoG3m/Z/64xx6GXIphuvxia0hR5bbfalU5/342kKVsYoInltI0g3SR2Fhv5Oit/I1Xpymz5fMfV6BI1EQFy/EjZ76fEfbADcOVPEdZ7Y/Kx6upE99bEhNQJFgNFKkSoDV+I0BodmoC3KtLWIJKR6VV3tHWUMZ/P8aZ2X0H5RkeGWdsYa7Jlv6pw0GypLe/ajxZHTvaREG/vVsDqf24s0R62SCppxZa477E6+A== 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 Received: from MW5PR11MB5906.namprd11.prod.outlook.com (2603:10b6:303:1a0::21) by CH3PR11MB7675.namprd11.prod.outlook.com (2603:10b6:610:122::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Tue, 18 Apr 2023 09:58:24 +0000 Received: from MW5PR11MB5906.namprd11.prod.outlook.com ([fe80::6fb0:d88f:75b6:dd03]) by MW5PR11MB5906.namprd11.prod.outlook.com ([fe80::6fb0:d88f:75b6:dd03%4]) with mapi id 15.20.6298.045; Tue, 18 Apr 2023 09:58:23 +0000 From: "Yuwei Chen" To: "devel@edk2.groups.io" , "Chen, Christine" CC: Rebecca Cran , "Gao, Liming" , "Feng, Bob C" Subject: Re: [edk2-devel] [Patch V1 1/3] BaseTools: fixing FMMT ShrinkFv issue Thread-Topic: [edk2-devel] [Patch V1 1/3] BaseTools: fixing FMMT ShrinkFv issue Thread-Index: AQHZcduVy+wt6fk5zUS+qjJFt1yog68w1Lag Date: Tue, 18 Apr 2023 09:58:23 +0000 Message-ID: References: <1756FEB6C590F6CA.26280@groups.io> In-Reply-To: <1756FEB6C590F6CA.26280@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW5PR11MB5906:EE_|CH3PR11MB7675:EE_ x-ms-office365-filtering-correlation-id: dde69b07-5a90-46b5-814a-08db3ff3725c x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wRy+KWhhy8BmSrmf6lC8RY7MUoV3aFRi2zSP4npSyOl1lwJ4SNRSKTiVf+IPVeZM8L/IYhCWI7qobNWR4QSEZLwZthgGJmEOAcXQn4C/czx71v7Caj1rpQiTbIpPCW5lX1pWUoLCO3Yz796gM7oVy0yNuVJbsCTpqBpk6LURCbzTa1+jTQEyMoBezGR6GX1bmzvFkXVdJuBdGxr7T582NbGInpfwC+1v0wzLS5+vb8MKYuLk46XwlNVx+oMW237z4v8r0vP4qF/uTiJYaE7m/56JmWRdJ7/IFc/YhyWpJ0vd5Yw7kJL3GhmCH/FGfNzraIMUtjarbxQj7CiqH1QM2egPj8jDPwMhrG0nWNYCt4mlrFhHDpCisP1wzaUBrHGueOYfsl1RVYcIKDWw31vDMkkLaiDSMlQlYM8Lz3sBKxfAAh9viRqNfOXSI9nXgjMdJZkAbU0yxwbwmoIZNBq0m4m4eZmHSI349MwMV0Oq4RDnLfAlZJN88N1uV+WnX+4I1eI5pjGP7+6cvDhC8ZtkxsmF9euRo1NBKES4RUQ5Bok+lzFw3ueYYT9Vst+PMUDftFGnzkZd/IKcNpdcVmjqENy1O88r2kfyaV0CGoA9ixgfjncmxDwOJL7PwDI7hSK05fH0PvF6m3PxCWjybN0I2Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW5PR11MB5906.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(39860400002)(366004)(376002)(346002)(136003)(451199021)(122000001)(2906002)(82960400001)(38070700005)(33656002)(66899021)(55016003)(966005)(107886003)(478600001)(71200400001)(7696005)(38100700002)(83380400001)(26005)(53546011)(6506007)(9686003)(86362001)(186003)(41300700001)(316002)(5660300002)(8676002)(52536014)(8936002)(54906003)(110136005)(66556008)(66446008)(64756008)(66476007)(4326008)(66946007)(76116006);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+tCKk6V5Yg7LwDVOQ2iNICzfYe1VCteOrERddEt2beuzF5rZZOQ4/x4FGXka?= =?us-ascii?Q?ZHuJz4LGydx6+b1UY3+etKvd43q0B1XNotH88V6QwOnppEthBLpaZAxEfube?= =?us-ascii?Q?kPyL4jScevQmnU/6ouy8QNZ6JJsw/b0AD8cd6fNcmdNR5Fu3QNGyXLsxnIhM?= =?us-ascii?Q?7Xq+/cuenFwUPCMCb/cGteJsFOm1UB3LB16q3mR6oVzzdKt6vLxpUhXx/EzL?= =?us-ascii?Q?RHkUZCW4v7mAKalMQZ8BciRSd+E7iOb3VaQ9p+c0D08Zvtb0FeHcGicRcWC6?= =?us-ascii?Q?zkk3FiOLAIThY5vZ7dsZlx0AYI8CBxQWYkGLVbbNIOwqzbV2eIGOkvc00D8p?= =?us-ascii?Q?hPq99fuX+i2ixkKWoT7PpKGjVTzQHA+PnxyA2rlP7Wr0dQpsgF0zeme+qiNX?= =?us-ascii?Q?Rjl8vN9ZkjkZoEhm92P96e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pMtZ4Bi/4csGLcBVxPeWWEQ6DjOMNkA6ta5xUQesrl/1eVLSvcj4P6e?= =?us-ascii?Q?PqrUHfFaKtpqXV8XjDykA447Rqnb+HZls9/zjs1MTVFj0MbJRnJ4UN9tqblD?= =?us-ascii?Q?uuYDegdqms2yw7vj8wiMalTA3u1Huxpro3lLJYQAEQr1EygoJOVhtadJL9ZT?= =?us-ascii?Q?YFN4npf2/8ryEvkTlGdWJl3j1d+0IzuNVJphEuIagMvtZa3qRzkCobdoWjCq?= =?us-ascii?Q?I8ksyVgktBN0Eew5et58BSVfRm7Gvk8HOUR0oJ80?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW5PR11MB5906.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dde69b07-5a90-46b5-814a-08db3ff3725c X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2023 09:58:23.1220 (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: TGnlYZxNHhgX/M1AC8HfSuAxV7MyNHFsf61QtnN6ATxh0SyN9J6jUVQqDrHX7Gdp6zz0S+6q6+DPAeiOyjFYQA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7675 Return-Path: yuwei.chen@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable For edk2-basetools repo, have made a PR for these three patches: https://github.com/tianocore/edk2-basetools/pull/95 Thanks, Christine (Yuwei) > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Yuwei > Chen > Sent: Tuesday, April 18, 2023 5:53 PM > To: devel@edk2.groups.io > Cc: Rebecca Cran ; Gao, Liming > ; Feng, Bob C > Subject: [edk2-devel] [Patch V1 1/3] BaseTools: fixing FMMT ShrinkFv issu= e >=20 > 1. FvLength not change issue; > 2. FileSystemGuid align with File Size; >=20 > Cc: Rebecca Cran > Cc: Liming Gao > Cc: Bob Feng > Signed-off-by: Yuwei Chen > --- > BaseTools/Source/Python/FMMT/core/FMMTOperation.py | 2 +- > BaseTools/Source/Python/FMMT/core/FvHandler.py | 10 +++++++--- > 2 files changed, 8 insertions(+), 4 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py > b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py > index a86f8dda9a..d4aa339703 100644 > --- a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py > +++ b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py > @@ -188,7 +188,7 @@ def ExtractFfs(inputfile: str, Ffs_name: str, outputf= ile: > str, Fv_name: str=3DNone >=20 > FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist > [index]) > if FmmtParser.WholeFvTree.Findlist !=3D []: > TargetNode =3D FmmtParser.WholeFvTree.Findlist[0] > - if TargetNode.type =3D=3D FV_TREE or SEC_FV_TREE or DATA_FV_TREE= : > + if TargetNode.type =3D=3D FV_TREE or TargetNode.type =3D=3D SEC_= FV_TREE or > TargetNode.type =3D=3D DATA_FV_TREE: > FinalData =3D struct2stream(TargetNode.Data.Header) + > TargetNode.Data.Data > with open(outputfile, "wb") as f: > f.write(FinalData) > diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py > b/BaseTools/Source/Python/FMMT/core/FvHandler.py > index ff3d637623..b0cc1951a1 100644 > --- a/BaseTools/Source/Python/FMMT/core/FvHandler.py > +++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py > @@ -279,7 +279,7 @@ class FvHandler: > ParTree.Child.remove(ParTree.Child[-1]) > ParTree.Data.Free_Space =3D 0 > ParTree.Data.Size +=3D Needed_Space > - ParTree.Data.Header.Fvlength =3D ParTree.Data.Si= ze > + ParTree.Data.Header.FvLength =3D ParTree.Data.Si= ze > ModifyFvSystemGuid(ParTree) > for item in ParTree.Child: > if item.type =3D=3D FFS_FREE_SPACE: > @@ -650,8 +650,12 @@ class FvHandler: > Removed_Space =3D TargetFv.Data.Free_Space - New_Free_Space > TargetFv.Child[-1].Data.Data =3D b'\xff' * New_Free_Space > TargetFv.Data.Size -=3D Removed_Space > - TargetFv.Data.Header.Fvlength =3D TargetFv.Data.Size > - ModifyFvSystemGuid(TargetFv) > + TargetFv.Data.Header.FvLength =3D TargetFv.Data.Size > + if struct2stream(TargetFv.Data.Header.FileSystemGuid) =3D=3D > EFI_FIRMWARE_FILE_SYSTEM3_GUID_BYTE: > + if TargetFv.Data.Size <=3D 0xFFFFFF: > + TargetFv.Data.Header.FileSystemGuid =3D ModifyGuidFo= rmat( > + "8c8ce578-8a3d-4f1c-9935-896185c32dd3") > + > for item in TargetFv.Child: > if item.type =3D=3D FFS_FREE_SPACE: > TargetFv.Data.Data +=3D item.Data.Data + item.Data.P= adData > -- > 2.39.1.windows.1 >=20 >=20 >=20 >=20 >=20