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.115, mailfrom: prince.agyeman@intel.com) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by groups.io with SMTP; Tue, 30 Apr 2019 16:29:07 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:29:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="320398257" Received: from paagyema-desk2.amr.corp.intel.com ([10.7.159.148]) by orsmga005.jf.intel.com with ESMTP; 30 Apr 2019 16:29:06 -0700 From: "Agyeman, Prince" To: devel@edk2.groups.io Cc: Michael Kubacki , Nate DeSimone , Ankit Sinha , Michael D Kinney Subject: [edk2-platforms/devel-MinPlatform] [PATCH] Added an optional SplitFspBin.py path argument Date: Tue, 30 Apr 2019 16:29:06 -0700 Message-Id: <6643f9560a0dea39d6dc5f11e46b578337bb9966.1556666772.git.prince.agyeman@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1691 What was done: - an optional 7th argument was added to RebaseAndPatchFspBinBaseAddress.py - updated lincense on RebaseAndPatchFspBinBaseAddress.py - replace \\ with os independent os.sep Cc: Michael Kubacki Cc: Nate DeSimone Cc: Ankit Sinha Cc: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 0.1 Signed-off-by: Agyeman --- .../Fsp/RebaseAndPatchFspBinBaseAddress.py | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py index 4cdbe017e9..496b977c1f 100644 --- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py +++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py @@ -1,23 +1,18 @@ ## @ RebaseAndPatchFspBinBaseAddress.py # -# Copyright (c) 2017, Intel Corporation. All rights reserved.
-# This program and the accompanying materials are licensed and made available under -# the terms and conditions of the BSD License that accompanies this distribution. -# The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. +# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent # -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## + import os import sys import re import subprocess -if len(sys.argv) != 6: +if len(sys.argv) not in [6,7]: print "RebaseAndPatchFspBinBaseAddress.py - Error in number of arguments received" - print "Usage - RebaseAndPatchFspBinBaseAddress.py " + print "Usage - RebaseAndPatchFspBinBaseAddress.py \ + " exit(1) flashMapName = sys.argv[1] @@ -26,6 +21,10 @@ fspBinFile = sys.argv[3] targetDscFile = sys.argv[4] fvOffset = long(sys.argv[5], 16) fspBinFileRebased = "Fsp_Rebased.fd" +splitFspBinPath = os.path.join("edk2","IntelFsp2Pkg","Tools","SplitFspBin.py") + +if len(sys.argv) == 7: + splitFspBinPath = sys.argv[6] # # Make sure argument passed or valid @@ -33,7 +32,7 @@ fspBinFileRebased = "Fsp_Rebased.fd" if not os.path.exists(flashMapName): print "WARNING! " + str(flashMapName) + " is not found." exit(1) -fspBinFilePath = fspBinPath + "\\" + fspBinFile +fspBinFilePath = fspBinPath + os.sep + fspBinFile if not os.path.exists(fspBinFilePath): print "WARNING! " + str(fspBinFilePath) + " is not found." exit(1) @@ -44,6 +43,9 @@ ext_file = str(os.path.splitext(targetDscFile)[-1]).lower() if ext_file != ".dsc": print "WARNING! " + str(targetDscFile) + " is not a dsc file" exit(1) +if not os.path.exists(splitFspBinPath): + print "WARNING! " + str(splitFspBinPath) + " is not found." + exit(1) # # Get the FSP-S / FSP-M-T FV Base Address from Flash Map @@ -74,7 +76,7 @@ file.close() pythontool = 'python' if 'PYTHON_HOME' in os.environ: pythontool = os.environ['PYTHON_HOME'] + os.sep + 'python' -Process = subprocess.Popen(pythontool + " edk2\IntelFsp2Pkg\Tools\SplitFspBin.py info -f" + fspBinFilePath, stdout=subprocess.PIPE) +Process = subprocess.Popen(pythontool + " " + splitFspBinPath + " info -f" + fspBinFilePath, stdout=subprocess.PIPE) Output = Process.communicate()[0] FsptInfo = Output.rsplit("FSP_M", 1); for line in FsptInfo[1].split("\n"): @@ -91,13 +93,13 @@ fspTBaseAddress = flashBase + fspTBaseOffset # Re-base FSP bin file to new address and save it as fspBinFileRebased using SplitFspBin.py # rebaseArguments = fspBinFilePath + " -c s m t -b " + str(hex(fspSBaseAddress).rstrip("L")) + " " + str(hex(fspMBaseAddress).rstrip("L")) + " " + str(hex(fspTBaseAddress).rstrip("L")) + " -o" + fspBinPath + " -n " + fspBinFileRebased -os.system(pythontool + " edk2\IntelFsp2Pkg\Tools\SplitFspBin.py rebase -f" + rebaseArguments) +os.system(pythontool + " " + splitFspBinPath + " rebase -f" + rebaseArguments) # # Split FSP bin to FSP-S/M/T segments # -splitArguments = fspBinPath +"\\" + fspBinFileRebased + " -o " + fspBinPath + " -n Fsp_Rebased.fd" -os.system(pythontool + " edk2\IntelFsp2Pkg\Tools\SplitFspBin.py split -f" + splitArguments) +splitArguments = fspBinPath + os.sep + fspBinFileRebased + " -o " + fspBinPath + " -n Fsp_Rebased.fd" +os.system(pythontool + " " + splitFspBinPath + " split -f" + splitArguments) # # Patch dsc file with the re-based FSP-S/M/T address, so internally build will use the same. -- 2.19.1.windows.1