Use python.exe from PYTHON_HOME

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <[email protected]>
Cc: Jiewen Yao <[email protected]>
---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat   |  2 +-
 .../Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py           |  7 ++++---
 .../Intel/PurleyOpenBoardPkg/BoardMtOlympus/postbuild.bat  | 14 +++++++-------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat 
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat
index 6b0918c..e0ad5ee 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/bld.bat
@@ -50,7 +50,7 @@ del /f %WORKSPACE_FSP_BIN%\KabylakeFspBinPkg\Fsp_Rebased*.fd
 cd %WORKSPACE%
 
 if exist %WORKSPACE_PLATFORM%\%PROJECT%\OpenBoardPkgPcd.dsc attrib -r 
%WORKSPACE_PLATFORM%\%PROJECT%\OpenBoardPkgPcd.dsc
-@call python 
%WORKSPACE_PLATFORM%\%PLATFORM_PACKAGE%\Tools\Fsp\RebaseAndPatchFspBinBaseAddress.py
 %WORKSPACE_PLATFORM%\%PLATFORM_BOARD_PACKAGE%\Include\Fdf\FlashMapInclude.fdf 
%WORKSPACE_FSP_BIN%\KabylakeFspBinPkg Fsp.fd 
%WORKSPACE_PLATFORM%\%PROJECT%\OpenBoardPkgPcd.dsc 0x0
+@call %PYTHON_HOME%\python.exe 
%WORKSPACE_PLATFORM%\%PLATFORM_PACKAGE%\Tools\Fsp\RebaseAndPatchFspBinBaseAddress.py
 %WORKSPACE_PLATFORM%\%PLATFORM_BOARD_PACKAGE%\Include\Fdf\FlashMapInclude.fdf 
%WORKSPACE_FSP_BIN%\KabylakeFspBinPkg Fsp.fd 
%WORKSPACE_PLATFORM%\%PROJECT%\OpenBoardPkgPcd.dsc 0x0
 
 @if %ERRORLEVEL% NEQ 0 (
   @echo !!! ERROR:RebaseAndPatchFspBinBaseAddress failed!!!
diff --git 
a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py 
b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
index 7fe26df..35f3f8c 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
@@ -71,7 +71,8 @@ file.close()
 # 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
 #
-Process = subprocess.Popen("python edk2\IntelFsp2Pkg\Tools\SplitFspBin.py info 
-f" + fspBinFilePath, stdout=subprocess.PIPE)
+pythontool = os.environ['PYTHON_HOME'] + '\python.exe'
+Process = subprocess.Popen(pythontool + " 
edk2\IntelFsp2Pkg\Tools\SplitFspBin.py info -f" + fspBinFilePath, 
stdout=subprocess.PIPE)
 Output = Process.communicate()[0]
 FsptInfo = Output.rsplit("FSP_M", 1);
 for line in FsptInfo[1].split("\n"):
@@ -88,13 +89,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("python edk2\IntelFsp2Pkg\Tools\SplitFspBin.py rebase -f" + 
rebaseArguments)
+os.system(pythontool + " edk2\IntelFsp2Pkg\Tools\SplitFspBin.py rebase -f" + 
rebaseArguments)
 
 #
 # Split FSP bin to FSP-S/M/T segments
 #
 splitArguments = fspBinPath +"\\" + fspBinFileRebased + " -o " + fspBinPath + 
" -n Fsp_Rebased.fd"
-os.system("python edk2\IntelFsp2Pkg\Tools\SplitFspBin.py split -f" + 
splitArguments)
+os.system(pythontool + " edk2\IntelFsp2Pkg\Tools\SplitFspBin.py split -f" + 
splitArguments)
 
 #
 # Patch dsc file with the re-based FSP-S/M/T address, so internally build will 
use the same.
diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/postbuild.bat 
b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/postbuild.bat
index 807b942..5c787bb 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/postbuild.bat
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/postbuild.bat
@@ -18,28 +18,28 @@ set /a postbuildstep=0
 @echo BoardPostBuild.%postbuildstep% python PatchBinFv.py
 @set /a postbuildstep=%postbuildstep%+1
 echo python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvTempMemorySilicon
-call python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvTempMemorySilicon
+call %PYTHON_HOME%\python.exe 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvTempMemorySilicon
 if %ERRORLEVEL% NEQ 0 (
   set SCRIPT_ERROR=1
   echo PatchBinFv Error. Exit
   goto :EOF
 )
 echo python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPreMemorySilicon
-call python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPreMemorySilicon
+call %PYTHON_HOME%\python.exe 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPreMemorySilicon
 if %ERRORLEVEL% NEQ 0 (
   set SCRIPT_ERROR=1
   echo PatchBinFv Error. Exit
   goto :EOF
 )
 echo python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPostMemorySilicon
-call python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPostMemorySilicon
+call %PYTHON_HOME%\python.exe 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPostMemorySilicon
 if %ERRORLEVEL% NEQ 0 (
   set SCRIPT_ERROR=1
   echo PatchBinFv Error. Exit
   goto :EOF
 )
 echo python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvLateSilicon
-call python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvLateSilicon
+call %PYTHON_HOME%\python.exe 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvLateSilicon
 if %ERRORLEVEL% NEQ 0 (
   set SCRIPT_ERROR=1
   echo PatchBinFv Error. Exit
@@ -50,7 +50,7 @@ if %ERRORLEVEL% NEQ 0 (
 @echo BoardPostBuild.%postbuildstep% python RebaseBinFv.py
 @set /a postbuildstep=%postbuildstep%+1
 echo python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\RebaseBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPreMemorySilicon 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase
-call python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\RebaseBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPreMemorySilicon 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase
+call %PYTHON_HOME%\python.exe 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\RebaseBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPreMemorySilicon 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase
 if %ERRORLEVEL% NEQ 0 (
   set SCRIPT_ERROR=1
   echo RebaseBinFv Error. Exit
@@ -58,7 +58,7 @@ if %ERRORLEVEL% NEQ 0 (
 )
 
 echo python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\RebaseBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPostMemorySilicon 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase
-call python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\RebaseBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPostMemorySilicon 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase
+call %PYTHON_HOME%\python.exe 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\RebaseBinFv.py
 %TARGET% %WORKSPACE%\edk2-non-osi\Silicon\Intel\PurleySiliconBinPkg 
%WORKSPACE%\Build\BuildReport.txt FvPostMemorySilicon 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase
 if %ERRORLEVEL% NEQ 0 (
   set SCRIPT_ERROR=1
   echo RebaseBinFv Error. Exit
@@ -80,7 +80,7 @@ if %ERRORLEVEL% NEQ 0 (
 @echo BoardPostBuild.%postbuildstep% python PatchBfv.py
 @set /a postbuildstep=%postbuildstep%+1
 echo python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBfv.py
 
%WORKSPACE%\Build\%BOARD_PKG%\%BOARD_NAME%\%TARGET%_%TOOL_CHAIN_TAG%\FV\PLATFORM.fd
 %WORKSPACE%\Build\BuildReport.txt 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase
-call python 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBfv.py
 
%WORKSPACE%\Build\%BOARD_PKG%\%BOARD_NAME%\%TARGET%_%TOOL_CHAIN_TAG%\FV\PLATFORM.fd
 %WORKSPACE%\Build\BuildReport.txt 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase
+call %PYTHON_HOME%\python.exe 
%WORKSPACE%\edk2-platforms\Platform\Intel\MinPlatformPkg\Tools\PatchFv\PatchBfv.py
 
%WORKSPACE%\Build\%BOARD_PKG%\%BOARD_NAME%\%TARGET%_%TOOL_CHAIN_TAG%\FV\PLATFORM.fd
 %WORKSPACE%\Build\BuildReport.txt 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase
 if %ERRORLEVEL% NEQ 0 (
   set SCRIPT_ERROR=1
   echo PatchBfv Error. Exit
-- 
2.10.0.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to