From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.4055.1664677586666770584 for ; Sat, 01 Oct 2022 19:26:27 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=LjD3/Qgh; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: bob.c.feng@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664677586; x=1696213586; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=TeH/gaQF1M9tbMq4cAR5UIRN3I2YZfaTbZd2+ceJU30=; b=LjD3/Qgho6PpB52q1GLLzi73zKYsCRkcUZK5pYXEXs6Y49lpiUD0BdRL EL5UOs00KbKUSTQqr5BtVd9EtSjLKMj5a7wMFyss/vbu226kKumjP6ytz FRbeojWZvqggcJWSsiIqhFpxDdfxZ3rRojG3/bwg4Cb3l6oNLX567DxhV q4oNLDTGVDO4uKf3XR6Dc+0QkgzO27pWW1nFS8kB8xjTheEFYVowTSv6k 2anKuWb6PzPgHq2B6bpVlZdKkH35U4yCOFKJro1d1F7NDUvnP+0lEKIrA xt7EQU8bjP9Igc3b87XuNeBH3I5aURyXKo3L6fQzlJREpFqTSQXa54S/F Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10487"; a="301156110" X-IronPort-AV: E=Sophos;i="5.93,361,1654585200"; d="scan'208";a="301156110" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2022 19:26:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10487"; a="653978219" X-IronPort-AV: E=Sophos;i="5.93,361,1654585200"; d="scan'208";a="653978219" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga008.jf.intel.com with ESMTP; 01 Oct 2022 19:26:25 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 1 Oct 2022 19:26:25 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 1 Oct 2022 19:26:24 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Sat, 1 Oct 2022 19:26:24 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Sat, 1 Oct 2022 19:26:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GlAQmTvLWzA8WWI/Gxn3DuSBr9/2qCLKhbwHcWAoQNhbtIr2sIgLDO84MOZMuzwsTqOqqybLzB1Mi+d4rbaGvTIrurjtmYtjVW+Jg3SMBt9v93acNKqsG7AR+WSOv1n6YRkOkElhig3gzbVsr56PII35e5zIpM/oYfmz4Apx6XHTywf67jwo9XsNikYIp0y2dO4HKwJpKV+2UkgOGln/4KsSJ/3fXXPhqHlUtBy/nEze360zU0+q84AZaOkds9fYoEGVrodfWTo/WL7/c29I7ldmAJJeQDPuk3nCuxR+3AbZnAAUfGEYM5gKWGIZgzounDztaiLkrjlihW5ESU/fzw== 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=AiFcJIfJU6RujoQIb8IHi6UxAueFCL5XF1ZxU6UKcKU=; b=jWIqQ7hEtBdQChUm6vUxD9BtkCBttK7lOUId3c0uUnFJdM+KP7icRLPcj3Q1zizKJR6kPp8pNQ1qlSjuU5uia4Uufsr3K0WOjto48R/oKCOmuLn0wLkMTb5IEOVQ+HyAu2b57Mc5RSnNxoX1R6Vsf4/a/w6UgkWzvipx5wGfLRMb/pK/NXSg01cl42bk4D+tece0FDYPf8efUKg6wTBENOTquU76DYF3Q8fyO9VbAVrKK9spZvH2zKw83fcJpzj7NZHqcdsPdnyMLOVlHpDsdkE9b6Setxd3cDCCRvwAIMq4PJL4I1p/g9KigSt1WjbvwLjlr7LJVzsaGfCJ1SiNbQ== 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 PH7PR11MB5863.namprd11.prod.outlook.com (2603:10b6:510:135::11) by DM6PR11MB4659.namprd11.prod.outlook.com (2603:10b6:5:2a5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.24; Sun, 2 Oct 2022 02:26:21 +0000 Received: from PH7PR11MB5863.namprd11.prod.outlook.com ([fe80::b6b:85ec:5ee0:d1]) by PH7PR11MB5863.namprd11.prod.outlook.com ([fe80::b6b:85ec:5ee0:d1%9]) with mapi id 15.20.5676.017; Sun, 2 Oct 2022 02:26:21 +0000 From: "Bob Feng" To: "Chen, Christine" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH 1/2] BaseTools/FMMT: Add Extract FV function Thread-Topic: [PATCH 1/2] BaseTools/FMMT: Add Extract FV function Thread-Index: AQHYyW7NDPkcLhf9z0uQtPtBu2li/a36ecjg Date: Sun, 2 Oct 2022 02:26:21 +0000 Message-ID: References: <20220916015056.626-1-yuwei.chen@intel.com> In-Reply-To: <20220916015056.626-1-yuwei.chen@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.500.17 dlp-product: dlpe-windows dlp-reaction: no-action 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: PH7PR11MB5863:EE_|DM6PR11MB4659:EE_ x-ms-office365-filtering-correlation-id: 2d24bd72-cc28-40d7-d2a9-08daa41d7f0b 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: pIA/dI0dz7+ALyieW6MZdhl/DFsdVnEAJsEKGQ9fuuN4FFwwI+ncwbyguo7J9FSe/ouMjITbXgj3DkwU7zREHWbbQwJfjiN9FSL2CLDjX8/GLrAM9wTiL/xln8c6m6eSzs3Hn3N+hCPYLAHqSNKZT4vaBOVztc+DRCdN/cQMrVhQF3YX73zaD1buJTvYZe9N2UR5jt5cVsZbwGG/ZcAwL29v9EohAjtd+IvHtgueyD0nXwRXOdbBdgEgzAwDdh5gveLgwilzDCQANAt/z45/YKho2e/OoCxPDyShfCq7UYiAHfZXNZrVVmSdhFlTV0Kfaz17IEJlNQxFmGzRtP+F6XxaOoQhxXHICwS7hLVx5AfQ0tmSfI6CZ65z5tYO9IpPLk8mUUJpuj63WIQyinjLlmyQa0vKpuFFX1WsfD1LR20tatylyuz7WfqKWJ/s4masvvMheCI9NEwt80NYltrQbqRl/KhSPlQw3EyEA67uxFeSTxoW4LvzYy+oEVAtcl4VEL5JOgsF2nTG1UJC4VUoig8ljrejz1CLtf3tmojd1BIgrIA4hicDUOLV0QIZipDrGwHCmsAaUSnEV4k5xc/MAqkeN2pt0P7WRtmvZPfbvyZbm+sZE9/ZGIrP4xYf6BearTzBO+MGNn6TByoBxH06RfaPQmrwIhOrDo0x/6jVGKhjxOT5HvEKZS3tdqUdAdGR8tK8n2g6M0MgxoM1wXvTI3SOqWZl5C4nvV0560/+j5hPIOdNxCeFPviglbg7U+DDQA9DejuDZM9Ji4r//fUMKHRO1M6STuics+M/h6Slz1o= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR11MB5863.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(346002)(366004)(396003)(136003)(376002)(451199015)(55016003)(38070700005)(33656002)(86362001)(82960400001)(122000001)(38100700002)(66946007)(66476007)(66556008)(66446008)(64756008)(4326008)(76116006)(8676002)(110136005)(316002)(2906002)(52536014)(41300700001)(8936002)(5660300002)(83380400001)(478600001)(186003)(966005)(53546011)(71200400001)(9686003)(26005)(6506007)(7696005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?e7Zwvo2f/5NwJ+dTu+YNSNOoblm0b0njsevd+eBSK3ApHWEbnQvxHiroJYPR?= =?us-ascii?Q?b9E/n0VYjmhk70rs8dLW1hLYbcQrY8e6Z5+2EZoby56egNvxAHbHCCql2bfL?= =?us-ascii?Q?ShdUciR3DquXYgKGcxhoLfr2jIyMMZ7yyZts0blMR+w2ARBI1wKgAocqaSxJ?= =?us-ascii?Q?pC4Dr4Q/Igf4KGqDQuJToKGiUqGPexv6UjvplQx8FLoAa8YnrnX3bcfFcLOw?= =?us-ascii?Q?J9OAFG7xVpyby7o2nRFCn1rnQZGp9KKoegGCioTJmLHmqQ2E+CFhettfKnpK?= =?us-ascii?Q?gkwb3MviqAGmIa0YwVtvcnX/2zTQgp/DunPcABeWY6BRcZX/JmxBW/JJGpbh?= =?us-ascii?Q?ivUtX0BrG85OSsrF9CETYOozcBvS95ClGWbXHqy61oefRs2nDyexHkw+WR1j?= =?us-ascii?Q?7nJNBFgH07YY/XpxjMp/FxHkS8cK402yK8lgBfQXC+WxUfkkP02zc2F67GQT?= =?us-ascii?Q?yJUXAmlv9CtTaMHKFetyZ7EKe5Yt8fLfR5J8qCJZRGjx5/OPwAH/AM9Svp8B?= =?us-ascii?Q?X7m+A9jAhBU1CJ3MQUW9IhZmFL4b0+50P+N872pfV31d9QDn5Na4FrLNGx0Q?= =?us-ascii?Q?84FjsLHzRB4BFw/SPOIMZ6aEOT6t9v9VMuK9AC3lyUaahkHfUSQlgSLLo5EF?= =?us-ascii?Q?CXS8UCtTxMo26/PiOY5rHV7spT0EWNiElIqvhblFrRsdxk7aMInXKbIdLLzl?= =?us-ascii?Q?fjPPf/KK0rfHiBGGhIjOWgWIkm568vqMUjX0ry1XdEZh5RWg0hGGCWMgCOWK?= =?us-ascii?Q?F1Ov6QdiVW8q7S8gwoMGrRYNwn1PfHFmeJu/E0my/9FGFUJ12rEvlLJKcJf5?= =?us-ascii?Q?L44mOzmGYPcwWK8McT4VbTvm1impRFC7uyngdjPQK5D7Ozdt727qGJb+vjH5?= =?us-ascii?Q?O5YKL2ZMJlI6a5bets4G4wiYJi7Ws9WlNwjoVCRkh1ETEuWsRc4POUpEGvii?= =?us-ascii?Q?DJe59uWW9uzdt7sKqEPz2KS/3HyKKBhYccisqtFRFVi+acNyNIvNa4AWHRCI?= =?us-ascii?Q?CzycHOKeQqmbmqXB0AreQapxcViA04j4H7IOYcqvhovKdaCWCujx06eRcN7G?= =?us-ascii?Q?CzatQ2zJCn4CvwG3SkGNPy/DnHODVEg4cxNymA8DR9VgGYwZE462zEQ3EKhX?= =?us-ascii?Q?QbIIAKvQLd/BrNZNPGzsTW/QsUeIPNtKGnxGF8fCVWY8hzz8HYR80dCnwvVY?= =?us-ascii?Q?rwIY6lcTpvq6RAG2cKhhbQrezAt62SZ8vLYiRYGX6Y1Ux+BZfTvTXjB+dm/4?= =?us-ascii?Q?iKfeXcKCXQIjzjPcQtQZaF9kWHCGa14ftmeM/vkc/NUIbmwGL92b1dEMe4jN?= =?us-ascii?Q?heDnbD7qJT1BtMmOjY/AMeMUFUtw7KQ8gSIgq7l56ppDGdRmN1qHyizT0nm4?= =?us-ascii?Q?U4HIOZ6UMyncgEjrsuEhYY9OLZU9DMiYCMLuv8aQs8AR3q/4b49Jjm65V0eC?= =?us-ascii?Q?TNxEYZJxk2qZgMUG0GKR4tfWSE1ScX58KHb2tCTMA968R6q28BU49ZJOx1Tz?= =?us-ascii?Q?H1Wce/OU353sc15JAQcmif+uk/Tmn01dWZZf+dLiiWYPUJWJz/UU1snP0uO8?= =?us-ascii?Q?TJe9WHF4XbceaqgkI40+L1nuRWD5ArRsttWaLt8b?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB5863.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d24bd72-cc28-40d7-d2a9-08daa41d7f0b X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Oct 2022 02:26:21.8518 (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: 8xjinE7vceD+2iryG1a88Jxd5pC5o/gDf7bwn0iJuqnyEKNykjNtpXJ00NOWq1I7RiXHdpo+vKWeTSztRnWH9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4659 Return-Path: bob.c.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng -----Original Message----- From: Chen, Christine =20 Sent: Friday, September 16, 2022 9:51 AM To: devel@edk2.groups.io Cc: Feng, Bob C ; Gao, Liming Subject: [PATCH 1/2] BaseTools/FMMT: Add Extract FV function REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3938 With this patch "-e" parameter supports extract FV function. Usage: FMMT -e Inputfile TargetFv Outputfile Cc: Bob Feng Cc: Liming Gao Signed-off-by: Yuwei Chen --- BaseTools/Source/Python/FMMT/FMMT.py | 3 +- .../Source/Python/FMMT/core/FMMTOperation.py | 45 +++++++++++-------- .../Source/Python/FMMT/core/FvHandler.py | 5 +-- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/BaseTools/Source/Python/FMMT/FMMT.py b/BaseTools/Source/Python= /FMMT/FMMT.py index 10800e776a72..3590f3340ec3 100644 --- a/BaseTools/Source/Python/FMMT/FMMT.py +++ b/BaseTools/Source/Python/FMMT/FMMT.py @@ -24,7 +24,8 @@ parser.add_argument("-d", "--Delete", dest=3D"Delete", na= rgs=3D'+', If not given TargetFvName, all the existed target = Ffs will be deleted'") parser.add_argument("-e", "--Extract", dest=3D"Extr= act", nargs=3D'+', help=3D"Extract a Ffs Info: '-e inputfile TargetFvName= (Optional) TargetFfsName outputfile\ - If not given TargetFvName, the first found target = Ffs will be extracted'") + If not given TargetFvName, the first found target = Ffs will be extracted.\ + If only given TargetFvName, not given=20 + TargetFfsName, the TargetFv will be extracted to output file'") parser.add_argument("-a", "--Add", dest=3D"Add", nargs=3D'+', help=3D"Add a Ffs into a FV:'-a inputfile TargetFvName= newffsfile outputfile'") parser.add_argument("-r", "--Replace", dest=3D"R= eplace", nargs=3D'+', diff --git a/BaseTools/Source/Python/FMMT/core/FMMTOp= eration.py b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py index c2cc2e246740..4e58c91b5c41 100644 --- a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py +++ b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py @@ -63,9 +63,10 @@ def DeleteFfs(inputfile: str, TargetFfs_name: str, outpu= tfile: str, Fv_name: str FmmtParser.WholeFvTree.FindNode(TargetFfs_name, FmmtParser.WholeFvTree= .Findlist) # Choose the Specfic DeleteFfs with Fv info if Fv_name: - for item in FmmtParser.WholeFvTree.Findlist: - if item.Parent.key !=3D Fv_name and item.Parent.Data.Name !=3D= Fv_name: - FmmtParser.WholeFvTree.Findlist.remove(item) + FindNum =3D len(FmmtParser.WholeFvTree.Findlist) + for index in range(FindNum-1, -1, -1): + if FmmtParser.WholeFvTree.Findlist[index].Parent.key !=3D Fv_n= ame and FmmtParser.WholeFvTree.Findlist[index].Parent.Data.Name !=3D Fv_nam= e: + =20 + FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist + [index]) Status =3D False if FmmtParser.WholeFvTree.Findlist !=3D []: for Delete_Ffs in FmmtParser.WholeFvTree.Findlist: @@ -149,9 +150,10 @@ def ReplaceFfs(inputfile: str, Ffs_name: str, newffsfi= le: str, outputfile: str, new_ffs.Data.PadData =3D GetPadSize(new_ffs.Data.Size, FFS_COMMON_ALIG= NMENT) * b'\xff' FmmtParser.WholeFvTree.FindNode(Ffs_name, FmmtParser.WholeFvTree.Findl= ist) if Fv_name: - for item in FmmtParser.WholeFvTree.Findlist: - if item.Parent.key !=3D Fv_name and item.Parent.Data.Name !=3D= Fv_name: - FmmtParser.WholeFvTree.Findlist.remove(item) + FindNum =3D len(FmmtParser.WholeFvTree.Findlist) + for index in range(FindNum-1, -1, -1): + if FmmtParser.WholeFvTree.Findlist[index].Parent.key !=3D Fv_n= ame and FmmtParser.WholeFvTree.Findlist[index].Parent.Data.Name !=3D Fv_nam= e: + =20 + FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist + [index]) if FmmtParser.WholeFvTree.Findlist !=3D []: for TargetFfs in FmmtParser.WholeFvTree.Findlist: FfsMod =3D FvHandler(newFmmtParser.WholeFvTree.Child[0], Targe= tFfs) @@ -180,18 +182,25 @@ def ExtractFfs(inputfile: str, Ffs_name: str, o= utputfile: str, Fv_name: str=3DNone logger.debug('Done!') FmmtParser.WholeFvTree.FindNode(Ffs_name, FmmtParser.WholeFvTree.Findl= ist) if Fv_name: - for item in FmmtParser.WholeFvTree.Findlist: - if item.Parent.key !=3D Fv_name and item.Parent.Data.Name !=3D= Fv_name: - FmmtParser.WholeFvTree.Findlist.remove(item) + FindNum =3D len(FmmtParser.WholeFvTree.Findlist) + for index in range(FindNum-1, -1, -1): + if FmmtParser.WholeFvTree.Findlist[index].Parent.key !=3D Fv_n= ame and FmmtParser.WholeFvTree.Findlist[index].Parent.Data.Name !=3D Fv_nam= e: + =20 + FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist + [index]) if FmmtParser.WholeFvTree.Findlist !=3D []: TargetNode =3D FmmtParser.WholeFvTree.Findlist[0] - TargetFv =3D TargetNode.Parent - if TargetFv.Data.Header.Attributes & EFI_FVB2_ERASE_POLARITY: - TargetNode.Data.Header.State =3D c_uint8( - ~TargetNode.Data.Header.State) - FinalData =3D struct2stream(TargetNode.Data.Header) + TargetNode.D= ata.Data - with open(outputfile, "wb") as f: - f.write(FinalData) - logger.debug('Extract ffs data is saved in {}.'.format(outputfile)= ) + if TargetNode.type =3D=3D FV_TREE or SEC_FV_TREE or DATA_FV_TREE: + FinalData =3D struct2stream(TargetNode.Data.Header) + TargetNo= de.Data.Data + with open(outputfile, "wb") as f: + f.write(FinalData) + logger.debug('Extract fv data is saved in {}.'.format(outputfi= le)) + else: + TargetFv =3D TargetNode.Parent + if TargetFv.Data.Header.Attributes & EFI_FVB2_ERASE_POLARITY: + TargetNode.Data.Header.State =3D c_uint8( + ~TargetNode.Data.Header.State) + FinalData =3D struct2stream(TargetNode.Data.Header) + TargetNo= de.Data.Data + with open(outputfile, "wb") as f: + f.write(FinalData) + logger.debug('Extract ffs data is saved in=20 + {}.'.format(outputfile)) else: - logger.error('Target Ffs not found!!!') + logger.error('Target Ffs/Fv not found!!!') diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py b/BaseTools/Sou= rce/Python/FMMT/core/FvHandler.py index c81541ec18b1..e8b848009878 100644 --- a/BaseTools/Source/Python/FMMT/core/FvHandler.py +++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py @@ -155,7 +155,6 @@ class FvHandler: def CompressData(self, TargetTree) -> None: TreePath =3D TargetTree.GetTreePath() pos =3D len(TreePath) - self.Status =3D False while pos: if not self.Status: if TreePath[pos-1].type =3D=3D SECTION_TREE and TreePath[p= os-1].Data.Type =3D=3D 0x02: @@ -487,7 +486,6 @@ class FvHandler: ~self.NewFfs.Data.Header.State) # If TargetFv have enough free space, just move part of the fr= ee space to NewFfs, split free space to NewFfs and new free space. if TargetLen < 0: - self.Status =3D True self.TargetFfs.Data.Data =3D b'\xff' * (-TargetLen) TargetFv.Data.Free_Space =3D (-TargetLen) TargetFv.Data.ModFvExt() @@ -498,13 +496,14 @@ class FvHan= dler: ModifyFfsType(self.NewFfs) # Recompress from the Fv node to update all the related no= de data. self.CompressData(TargetFv) + self.Status =3D True elif TargetLen =3D=3D 0: - self.Status =3D True TargetFv.Child.remove(self.TargetFfs) TargetFv.insertChild(self.NewFfs) ModifyFfsType(self.NewFfs) # Recompress from the Fv node to update all the related no= de data. self.CompressData(TargetFv) + self.Status =3D True # If TargetFv do not have enough free space, need move part of= the free space of TargetFv's parent Fv to TargetFv/NewFfs. else: if TargetFv.type =3D=3D FV_TREE: -- 2.27.0.windows.1