From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: chasel.chiu@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Wed, 29 May 2019 07:34:41 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2019 07:34:35 -0700 X-ExtLoop1: 1 Received: from cchiu4-mobl1.gar.corp.intel.com ([10.252.190.33]) by orsmga002.jf.intel.com with ESMTP; 29 May 2019 07:34:33 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Maurice Ma , Nate DeSimone , Star Zeng Subject: [PATCH] IntelFsp2Pkg/FspSplitBin.py: Support rebasing 1.x binary. Date: Wed, 29 May 2019 22:33:24 +0800 Message-Id: <20190529143324.15956-1-chasel.chiu@intel.com> X-Mailer: git-send-email 2.13.3.windows.1 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1308 Support rebasing FSP 1.X binary. 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 --- IntelFsp2Pkg/Tools/SplitFspBin.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/IntelFsp2Pkg/Tools/SplitFspBin.py b/IntelFsp2Pkg/Tools/SplitFspBin.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 * """ -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 """ CopyRightHeaderFile = """/* @@ -500,8 +500,6 @@ class FirmwareDevice: fih = None for fsp in self.FspList: - if fsp.Fih.HeaderRevision < 3: - raise Exception("ERROR: FSP 1.x is not supported by this tool !") if not fih: fih = fsp.Fih else: @@ -713,6 +711,8 @@ def SplitFspBin (fspfile, outdir, nametemplate): fd.ParseFsp () for fsp in fd.FspList: + if fsp.Fih.HeaderRevision < 3: + raise Exception("ERROR: FSP 1.x is not supported by the split command !") ftype = fsp.Type if not nametemplate: nametemplate = fspfile @@ -742,6 +742,11 @@ def RebaseFspBin (FspBinary, FspComponent, FspBase, OutputDir, OutputFile): found = False for fsp in fd.FspList: + # Is this FSP 1.x single binary? + if fsp.Fih.HeaderRevision < 3: + found = True + ftype = 'X' + break ftype = fsp.Type.lower() if ftype == fspcomp: found = True -- 2.13.3.windows.1