diff options
author | Guo Mang <mang.guo@intel.com> | 2016-12-23 14:56:06 +0800 |
---|---|---|
committer | Guo Mang <mang.guo@intel.com> | 2017-05-09 13:03:06 +0800 |
commit | 822ab3c67f3b5a150b3f24f53d2642ab2e9426ac (patch) | |
tree | 32f5d5f56b945da81f45812687e7125d5c0ff0f0 /Platform/BroxtonPlatformPkg | |
parent | 1f17caf0d57ea9b44b079ede3adf595ccf885567 (diff) | |
download | edk2-platforms-822ab3c67f3b5a150b3f24f53d2642ab2e9426ac.tar.xz |
BroxtonPlatformPkg: Add Stitch
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'Platform/BroxtonPlatformPkg')
-rw-r--r-- | Platform/BroxtonPlatformPkg/Common/Tools/Stitch/IFWIStitch_Simple.bat | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/Platform/BroxtonPlatformPkg/Common/Tools/Stitch/IFWIStitch_Simple.bat b/Platform/BroxtonPlatformPkg/Common/Tools/Stitch/IFWIStitch_Simple.bat new file mode 100644 index 0000000000..1012a77421 --- /dev/null +++ b/Platform/BroxtonPlatformPkg/Common/Tools/Stitch/IFWIStitch_Simple.bat @@ -0,0 +1,166 @@ +@echo off
+SetLocal EnableDelayedExpansion EnableExtensions
+
+:: Set script defaults
+set exitCode=0
+
+copy /y nul Stitching.log >nul
+
+:: Set tool env
+set WORKSPACE=%CD%
+set CORE_TOOLS_PATH=%WORKSPACE%\..\..\..\..\..\BaseTools\Bin\Win32
+if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
+PATH=%PATH%;%WORKSPACE%\Tools;%WORKSPACE%\Tools\VLV_Merge_Tools;%WORKSPACE%\;%CORE_TOOLS_PATH%
+
+:: Set default Suffix as: YYYY_MM_DD_HHMM
+set hour=%time: =0%
+reg copy "HKCU\Control Panel\International" "HKCU\Control Panel\International_Temp" /f >nul
+reg add "HKCU\Control Panel\International" /v sShortDate /d "yyyy_MM_dd" /f >nul
+for /f "tokens=1" %%i in ("%date%") do set today=%%i
+reg copy "HKCU\Control Panel\International_Temp" "HKCU\Control Panel\International" /f >nul
+reg delete "HKCU\Control Panel\International_Temp" /f >nul
+set IFWI_Suffix=%today%_%hour:~0,2%%time:~3,2%
+
+:: **********************************************************************
+:: Process inputs
+:: **********************************************************************
+if "%~1"=="?" goto Usage
+if "%~1"=="/?" goto Usage
+if /i "%~1"=="Help" goto Usage
+
+set FspWrapper=FALSE
+set Stepping=B
+
+if /i "%~2"=="B" (
+ set Stepping=B
+)
+
+if /i "%~2"=="A" (
+ set Stepping=A
+)
+
+:OptLoop1
+
+if /i "%~1"=="/FspW" (
+ echo FspW enabled..
+ set FspWrapper=TRUE
+ shift
+ goto OptLoop1
+)
+
+::Require first parameter
+if not exist %~1 echo BIOS [%~1] not found. & goto Usage
+set BIOS_Names=%~1
+shift
+
+:: **********************************************************************
+:: Stitching Init
+:: **********************************************************************
+echo %date% %time% >>Stitching.log 2>&1
+echo %date% %time%
+echo.
+for %%i in (%BIOS_Names%) do (
+ set BIOS_Name=%%~ni
+)
+set BIOS_Version=!BIOS_Name:~-7,7!
+
+REM extract PlatformType from BIOS filename
+set Platform_Type=!BIOS_Name:~0,4!
+
+REM search BIOS_Name for Arch substring: either IA32 or X64
+if not "!BIOS_Name!"=="!BIOS_Name:_IA32_=!" (
+ set Arch=IA32
+) else if not "!BIOS_Name!"=="!BIOS_Name:_X64_=!" (
+ set Arch=X64
+) else (
+ echo Error: Could not determine Architecture for !BIOS_Name!
+ goto Usage
+)
+
+set IFWI_Prefix=!Platform_Type!_IFWI_FSPW_!Arch!
+
+REM search BIOS_Name for Build_Target substring: either R or D
+if not "!BIOS_Name!"=="!BIOS_Name:_R_=!" (
+ set Build_Target=Release
+ set IFWI_Prefix=!IFWI_Prefix!_R
+ set IFWI_Version=!IFWI_Prefix!_%IFWI_Suffix%
+) else if not "!BIOS_Name!"=="!BIOS_Name:_D_=!" (
+ set Build_Target=Debug
+ set IFWI_Prefix=!IFWI_Prefix!_D
+ set IFWI_Version=!IFWI_Prefix!_%IFWI_Suffix%
+) else (
+ echo Error: Could not determine Build Target for !BIOS_Name!
+ goto Usage
+)
+
+if /i "!Platform_Type!"=="MINN" (
+ set Platform_Type=MINN
+) else (
+ echo Error - Unsupported PlatformType: !Platform_Type!
+ goto Usage
+)
+
+:: rd /s /q %BIOS_Names% >>Stitching.log
+
+pushd %BIOS_Names%
+copy /y /b FVIBBM.fv+FSP_M.fv IBBM.Fv
+copy /y /b FSP_S.fv+FVIBBR.fv+FVOBB.Fv+FVOBBX.Fv+FVOBBY.Fv+NvStorage.Fv OBB2.Fv
+popd
+
+set IFWI_Name=!IFWI_Prefix!_%IFWI_Suffix%
+
+echo.
+echo ------------------------------------------
+echo.
+echo Generating SPI Image...
+
+copy /y /b %BIOS_Names%\IBBM.Fv .
+copy /y /b %BIOS_Names%\OBB2.Fv .
+if %Stepping%==B (
+ copy /y /b ..\..\Binaries\IFWI\B_Stepping\SpiChunk1.bin .
+ copy /y /b ..\..\Binaries\IFWI\B_Stepping\SpiChunk2.bin .
+ copy /y /b ..\..\Binaries\IFWI\B_Stepping\SpiChunk3.bin .
+ copy /y /b SpiChunk1.bin+IBBM.Fv+SpiChunk2.bin+OBB2.Fv+SpiChunk3.bin spi_out.bin
+ ) else (
+ copy /y /b ..\..\Binaries\IFWI\A_Stepping\SpiChunk1.bin .
+ copy /y /b ..\..\Binaries\IFWI\A_Stepping\SpiChunk2.bin .
+ copy /y /b ..\..\Binaries\IFWI\A_Stepping\SpiChunk3.bin .
+ copy /y /b SpiChunk1.bin+IBBM.Fv+SpiChunk2.bin+OBB2.Fv+SpiChunk3.bin spi_out.bin
+ )
+
+move /y spi_out.bin %BIOS_ID%.bin >> Stitching.log
+
+if !ERRORLEVEL! NEQ 0 (
+ echo. & echo -- Error during stitching ^^! >>Stitching.log
+ goto ScriptFail
+)
+
+echo Stitched successfully >>Stitching.log
+echo *** Stitched successfully ***
+echo.
+echo ---------- IFWI_Stitch Complete ----------
+goto Exit
+
+
+:Usage
+echo.
+echo **************************************************************************************************
+echo.
+echo Usage: IFWIStitch_Simple.bat <BIOS Name>
+echo.
+echo ****************************************************************************************************
+exit /b 1
+
+:ScriptFail
+set exitCode=1
+copy Stitching.log ..\Stitching.log
+echo.
+
+:Exit
+echo.
+echo --- See 'Stitching.log' for more info. ---
+echo.
+echo %date% %time%
+echo.
+exit /b %exitCode%
+EndLocal
|