]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2Pkg/Tools/SplitFspBin.py
IntelFsp2Pkg/SplitFspBin.py: Support rebasing 1.x binary.
[mirror_edk2.git] / IntelFsp2Pkg / Tools / SplitFspBin.py
index 9b1872030720886c60db1537d811e018e6bd6af8..15c8bebee27839731b73daaaadd20d99cd12fd9b 100644 (file)
@@ -1,13 +1,7 @@
 ## @ FspTool.py\r
 #\r
-# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials are licensed and made available under\r
-# the terms and conditions of the BSD License that accompanies this distribution.\r
-# The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php.\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 ##\r
 \r
@@ -20,12 +14,12 @@ import argparse
 from   ctypes import *\r
 \r
 """\r
-This utility supports some operations for Intel FSP 2.0 image.\r
+This utility supports some operations for Intel FSP 1.x/2.x image.\r
 It supports:\r
-    - Display FSP 2.0 information header\r
-    - Split FSP 2.0 image into individual FSP-T/M/S/O component\r
-    - Rebase FSP 2.0 components to a different base address\r
-    - Generate FSP mapping C header file\r
+    - Display FSP 1.x/2.x information header\r
+    - Split FSP 2.x image into individual FSP-T/M/S/O component\r
+    - Rebase FSP 1.x/2.x components to a different base address\r
+    - Generate FSP 1.x/2.x mapping C header file\r
 """\r
 \r
 CopyRightHeaderFile = """/*\r
@@ -506,8 +500,6 @@ class FirmwareDevice:
 \r
         fih = None\r
         for fsp in self.FspList:\r
-            if fsp.Fih.HeaderRevision < 3:\r
-                raise Exception("ERROR: FSP 1.x is not supported by this tool !")\r
             if not fih:\r
                 fih = fsp.Fih\r
             else:\r
@@ -719,13 +711,15 @@ def SplitFspBin (fspfile, outdir, nametemplate):
     fd.ParseFsp ()\r
 \r
     for fsp in fd.FspList:\r
+        if fsp.Fih.HeaderRevision < 3:\r
+            raise Exception("ERROR: FSP 1.x is not supported by the split command !")\r
         ftype = fsp.Type\r
         if not nametemplate:\r
             nametemplate = fspfile\r
         fspname, ext = os.path.splitext(os.path.basename(nametemplate))\r
         filename = os.path.join(outdir, fspname + '_' + fsp.Type + ext)\r
         hfsp = open(filename, 'wb')\r
-        print ("Ceate FSP component file '%s'" % filename)\r
+        print ("Create FSP component file '%s'" % filename)\r
         for fvidx in fsp.FvIdxList:\r
             fv = fd.FvList[fvidx]\r
             hfsp.write(fv.FvData)\r
@@ -748,6 +742,11 @@ def RebaseFspBin (FspBinary, FspComponent, FspBase, OutputDir, OutputFile):
 \r
         found = False\r
         for fsp in fd.FspList:\r
+            # Is this FSP 1.x single binary?\r
+            if fsp.Fih.HeaderRevision < 3:\r
+                found = True\r
+                ftype = 'X'\r
+                break\r
             ftype = fsp.Type.lower()\r
             if ftype == fspcomp:\r
                 found = True\r