[edk2-devel] [PATCH v2] MinPlatformPkg/Fsp: Rebase fail when python tools path exist whitespace

IanX Kuo ianx.kuo at intel.com
Mon May 24 01:00:23 UTC 2021


From: IanX Kuo <ianx.kuo at intel.com>

(a) C:\Users\<UserName>\AppData\Local\Program\Python\Python38
(b) C:\Python38
(c) C:\Program Files\Python38
Issue only happens on (a) and (c).
(a) happen on <UserName> have whitespace. Ex: Tony Chen
(c) happen on "Program Files" have whitespace.

Cc: Chasel Chiu <chasel.chiu at intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Signed-off-by: IanX Kuo <ianx.kuo at intel.com>
---
 .../Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py            | 6 +++++-
 .../MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py     | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
index 406e5ec130..a3d5263ad0 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
@@ -70,12 +70,16 @@ for line in flashmap.split("\n"):
 file.close()
 
 #
-# Get FSP-M Size, in order to calculate the FSP-T Base. Used SplitFspBin.py script 
+# Get FSP-M Size, in order to calculate the FSP-T Base. Used SplitFspBin.py script
 # to dump the header, and get the ImageSize in FSP-M section
 #
 pythontool = 'python'
 if 'PYTHON_HOME' in os.environ:
     pythontool = os.environ['PYTHON_HOME'] + os.sep + 'python'
+else:
+    pythontool = sys.executable
+pythontool = "\"" + pythontool + "\""
+
 Process = subprocess.Popen([pythontool, splitFspBinPath, "info","-f",fspBinFilePath], stdout=subprocess.PIPE)
 Output = Process.communicate()[0]
 FsptInfo = Output.rsplit(b"FSP_M", 1);
diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
index fb4cf4f9b7..50e442a500 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
@@ -70,6 +70,8 @@ if 'PYTHON_HOME' in os.environ:
     pythontool = os.environ['PYTHON_HOME'] + os.sep + 'python'
 else:
     pythontool = sys.executable
+pythontool = "\"" + pythontool + "\""
+
 Process = subprocess.Popen([pythontool, splitFspBinPath, "info","-f",fspBinFilePath], stdout=subprocess.PIPE)
 Output = Process.communicate()[0]
 FsptInfo = Output.rsplit(b"FSP_M", 1);
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75471): https://edk2.groups.io/g/devel/message/75471
Mute This Topic: https://groups.io/mt/83041135/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list