From: "Agyeman, Prince" <prince.agyeman@intel.com>
To: devel@edk2.groups.io
Cc: Michael Kubacki <michael.a.kubacki@intel.com>,
Nate DeSimone <nathaniel.l.desimone@intel.com>,
Ankit Sinha <ankit.sinha@intel.com>,
Michael D Kinney <michael.d.kinney@intel.com>
Subject: [edk2-platforms/devel-MinPlatform] [PATCH] Added an optional SplitFspBin.py path argument
Date: Tue, 30 Apr 2019 16:29:06 -0700 [thread overview]
Message-ID: <6643f9560a0dea39d6dc5f11e46b578337bb9966.1556666772.git.prince.agyeman@intel.com> (raw)
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 <michael.a.kubacki@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 0.1
Signed-off-by: Agyeman <prince.agyeman@intel.com>
---
.../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.<BR>
-# 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.<BR>
+# 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 <FlashMap file path> <FspBinPkg Folder> <Fsp.fd file name> <Dsc file path to be patched> <pad_offset for Fsp-S Base Address>"
+ print "Usage - RebaseAndPatchFspBinBaseAddress.py <FlashMap file path> <FspBinPkg Folder> <Fsp.fd file name>\
+ <Dsc file path to be patched> <pad_offset for Fsp-S Base Address> <OPTIONAL SplitFspBin.py tool path>"
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
next reply other threads:[~2019-04-30 23:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-30 23:29 Agyeman, Prince [this message]
2019-05-09 17:16 ` [edk2-devel] [edk2-platforms/devel-MinPlatform] [PATCH] Added an optional SplitFspBin.py path argument Kubacki, Michael A
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6643f9560a0dea39d6dc5f11e46b578337bb9966.1556666772.git.prince.agyeman@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox