From nobody Sun May 5 04:56:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41659+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41659+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1559192280; cv=none; d=zoho.com; s=zohoarc; b=U6G335Qq5djiZan788xZoor4X7gvx0iAMn3CYIRdJm2tH57U+GpxCPVcfwwuGvHqF0OPXrzkpjUWG3lKWcVbPHqqeUbrI9kv+rJw5hcNjsUfPCNgeiiKvz1FJsUwS0+y5V7DjMqgsRvI2sMADCPCWRo9nWO8Ym90Bl0d2j5ha3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559192280; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=NEpHjKT7HO/22cf3EyHiTeECuBP6aPm4L7eTlpKVUpw=; b=nYWaQ4L4bxAn8tJ01gzQiMK+tNA9cL6NDxDvCnE/t2hhMSKzn/4QtTtUrrl8r8t088Z/m4haX+SAeXRcQMa8gJErrWbMaDELUINFcM8YgPPLYmgYe0Nt72/Fdin/QMAUqYG+DW3LnFNXHyuyPszkh/A1e6vJ3Jw+gDQmqhgYTHk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41659+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1559192280805616.9950738321652; Wed, 29 May 2019 21:58:00 -0700 (PDT) Return-Path: X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Wed, 29 May 2019 21:58:00 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2019 21:57:59 -0700 X-ExtLoop1: 1 X-Received: from cchiu4-mobl1.gar.corp.intel.com ([10.5.240.72]) by orsmga006.jf.intel.com with ESMTP; 29 May 2019 21:57:57 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Maurice Ma , Nate DeSimone , Star Zeng Subject: [edk2-devel] [PATCH v2] IntelFsp2Pkg/SplitFspBin.py: Support rebasing 1.x binary. Date: Thu, 30 May 2019 12:57:50 +0800 Message-Id: <20190530045750.5600-1-chasel.chiu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1559192280; bh=TJ5yreXUEI/InsozI+CqeobZXzA/I2TSjUEEGhYKkH0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=vvMHGoxB+NV2o1UWT2debh7Y8d3UNCRBmN/FmIQQLUBwZq94FuuDlJQfFxSCeuRNNCc ffDCVAueG5X5E2GTDlrRoaWHEL9F2+0hYw17pdaS6tf5EQfMJPpgbMmjrgEqQoGe3/+mU P/+vbKm/cvWKPJHqsWUtTt2zvNK7EK+TuQ0= X-ZohoMail-DKIM: pass (identity @groups.io) REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1308 Support rebasing FSP 1.x binary. FSP 1.x has single component in binary so not supported by split command and rebase can be done with the same command for rebasing FSP-T component in FSP 2.x image. Test: both FSP 2.x (Kabylake) and FSP 1.x (BroadwellDE) binary can be rebased successfully. Cc: Maurice Ma Cc: Nate DeSimone Cc: Star Zeng Signed-off-by: Chasel Chiu Reviewed-by: Nate DeSimone Reviewed-by: Star Zeng --- IntelFsp2Pkg/Tools/SplitFspBin.py | 21 +++++++++++++= -------- IntelFsp2Pkg/Tools/UserManuals/SplitFspBinUserManual.md | 47 +++++++++++++= ++++++++++++---------------------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/IntelFsp2Pkg/Tools/SplitFspBin.py b/IntelFsp2Pkg/Tools/SplitFs= pBin.py index 2458231d09..15c8bebee2 100644 --- a/IntelFsp2Pkg/Tools/SplitFspBin.py +++ b/IntelFsp2Pkg/Tools/SplitFspBin.py @@ -1,6 +1,6 @@ ## @ FspTool.py # -# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -14,12 +14,12 @@ import argparse from ctypes import * =20 """ -This utility supports some operations for Intel FSP 2.0 image. +This utility supports some operations for Intel FSP 1.x/2.x image. It supports: - - Display FSP 2.0 information header - - Split FSP 2.0 image into individual FSP-T/M/S/O component - - Rebase FSP 2.0 components to a different base address - - Generate FSP mapping C header file + - Display FSP 1.x/2.x information header + - Split FSP 2.x image into individual FSP-T/M/S/O component + - Rebase FSP 1.x/2.x components to a different base address + - Generate FSP 1.x/2.x mapping C header file """ =20 CopyRightHeaderFile =3D """/* @@ -500,8 +500,6 @@ class FirmwareDevice: =20 fih =3D None for fsp in self.FspList: - if fsp.Fih.HeaderRevision < 3: - raise Exception("ERROR: FSP 1.x is not supported by this t= ool !") if not fih: fih =3D fsp.Fih else: @@ -713,6 +711,8 @@ def SplitFspBin (fspfile, outdir, nametemplate): fd.ParseFsp () =20 for fsp in fd.FspList: + if fsp.Fih.HeaderRevision < 3: + raise Exception("ERROR: FSP 1.x is not supported by the split = command !") ftype =3D fsp.Type if not nametemplate: nametemplate =3D fspfile @@ -742,6 +742,11 @@ def RebaseFspBin (FspBinary, FspComponent, FspBase, Ou= tputDir, OutputFile): =20 found =3D False for fsp in fd.FspList: + # Is this FSP 1.x single binary? + if fsp.Fih.HeaderRevision < 3: + found =3D True + ftype =3D 'X' + break ftype =3D fsp.Type.lower() if ftype =3D=3D fspcomp: found =3D True diff --git a/IntelFsp2Pkg/Tools/UserManuals/SplitFspBinUserManual.md b/Inte= lFsp2Pkg/Tools/UserManuals/SplitFspBinUserManual.md index 064e0ac845..06d87bbb2e 100644 --- a/IntelFsp2Pkg/Tools/UserManuals/SplitFspBinUserManual.md +++ b/IntelFsp2Pkg/Tools/UserManuals/SplitFspBinUserManual.md @@ -1,68 +1,71 @@ -# SplitFspBin.py is a python script to support some operations on Intel FS= P 2.0 image. +# SplitFspBin.py is a python script to support some operations on Intel FS= P 1.x/2.x image. =20 It supports: =20 -- Split Intel FSP 2.0 image into individual FSP-T/M/S/O component +- Split Intel FSP 2.x image into individual FSP-T/M/S/O component =20 -- Rebase Intel FSP 2.0 components to different base addresses +- Rebase Intel FSP 1.x/2.x components to different base addresses =20 -- Generate Intel FSP 2.0 C header file +- Generate Intel FSP 1.x/2.x C header file =20 -- Display Intel FSP 2.0 information header for each FSP component +- Display Intel FSP 1.x/2.x information header for each FSP component =20 -## Split Intel FSP 2.0 image +## Split Intel FSP 2.x image =20 -To split individual FSP component in Intel FSP 2.0 image, the following +FSP 1.x image is not supported by split command. +To split individual FSP component in Intel FSP 2.x image, the following command can be used: =20 **python SplitFspBin.py split [-h] -f FSPBINARY [-o OUTPUTDIR] [-n NAME= TEMPLATE]** =20 -For example: =20 +For example: =20 `python SplitFspBin.py split -f FSP.bin` =20 It will create FSP_T.bin, FSP_M.bin and FSP_S.bin in current directory. =20 -## Rebase Intel FSP 2.0 components +## Rebase Intel FSP 1.x/2.x components =20 -To rebase one or multiple FSP components in Intel FSP 2.0 image, the follo= wing +To rebase one or multiple FSP components in Intel FSP 1.x/2.x image, the f= ollowing command can be used: =20 **python SplitFspBin.py rebase [-h] -f FSPBINARY -c {t,m,s,o} [{t,m,s,o= } ...] -b FSPBASE [FSPBASE ...] [-o OUTPUTDIR] [-n OUTPUTFILE]** =20 -For example: =20 +For example: =20 - `python SplitFspBin.py rebase -f FSP.bin =E2=80=93c t =E2=80=93b 0xFFF0= 0000 =E2=80=93n FSP_new.bin` + `python SplitFspBin.py rebase -f FSP.bin -c t -b 0xFFF00000 -n FSP_new.= bin` =20 It will rebase FSP-T component inside FSP.bin to new base 0xFFF00000 an= d save the - rebased Intel FSP 2.0 image into file FSP_new.bin. + rebased Intel FSP 2.x image into file FSP_new.bin. + For FSP 1.x image there is only one component in binary so above comman= d also + works for FSP 1.x image. =20 - `python SplitFspBin.py rebase -f FSP.bin =E2=80=93c t m =E2=80=93b 0xFF= F00000 0xFEF80000 =E2=80=93n FSP_new.bin` + `python SplitFspBin.py rebase -f FSP.bin -c t m -b 0xFFF00000 0xFEF8000= 0 -n FSP_new.bin` =20 It will rebase FSP-T and FSP-M components inside FSP.bin to new base 0x= FFF00000 - and 0xFEF80000 respectively, and save the rebased Intel FSP 2.0 image i= nto file=20 + and 0xFEF80000 respectively, and save the rebased Intel FSP 2.x image i= nto file FSP_new.bin file. =20 -## Generate Intel FSP 2.0 C header file +## Generate Intel FSP 1.x/2.x C header file =20 -To generate Intel FSP 2.0 C header file, the following command can be used: +To generate Intel FSP 1.x/2.x C header file, the following command can be = used: =20 **Python SplitFspBin.py genhdr [-h] -f FSPBINARY [-o OUTPUTDIR] [-n HFI= LENAME]** =20 -For example: =20 +For example: =20 - `python SplitFspBin.py genhdr -f FSP.bin =E2=80=93n FSP.h` + `python SplitFspBin.py genhdr -f FSP.bin -n FSP.h` =20 It will create the C header file FSP.h containing the image ID, revisio= n, offset and size for each individual FSP component. =20 -## Display Intel FSP 2.0 information header +## Display Intel FSP 1.x/2.x information header =20 -To display Intel FSP 2.0 information headers, the following command can be= used: +To display Intel FSP 1.x/2.x information headers, the following command ca= n be used: =20 **Python SplitFspBin.py info [-h] -f FSPBINARY** =20 -For example: =20 +For example: =20 `python SplitFspBin.py info -f FSP.bin` =20 --=20 2.13.3.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41659): https://edk2.groups.io/g/devel/message/41659 Mute This Topic: https://groups.io/mt/31860753/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-