summaryrefslogtreecommitdiff
path: root/Platform
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2016-12-23 14:56:06 +0800
committerGuo Mang <mang.guo@intel.com>2016-12-26 19:15:28 +0800
commita6939ad103cb293322d613ab09b575ce98dabdb1 (patch)
tree359dc68a9e4ce57efe38902dd0baa449a1b58c7e /Platform
parent1763e4499a78a4093622c0fb14a5f3d0f8357abb (diff)
downloadedk2-platforms-a6939ad103cb293322d613ab09b575ce98dabdb1.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')
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Tools/Stitch/IFWIStitch_Simple.bat166
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