2 @REM Windows batch file to build BIOS ROM
4 @REM Copyright
(c
) 2006 - 2014, Intel Corporation. All rights reserved.
<BR
>
6 @REM SPDX
-License
-Identifier
: BSD
-2-Clause
-Patent
10 SetLocal EnableDelayedExpansion EnableExtensions
12 :: Set script defaults
17 set Stitch_Config
=Stitch_Config.txt
18 copy /y nul Stitching.log
>nul
20 :: Set default Suffix as
: YYYY_MM_DD_HHMM
22 reg
copy "HKCU\Control Panel\International" "HKCU\Control Panel\International_Temp" /f
>nul
23 reg add
"HKCU\Control Panel\International" /v sShortDate
/d
"yyyy_MM_dd" /f
>nul
24 for /f
"tokens=1" %%i in
("%date%") do set today
=%%i
25 reg
copy "HKCU\Control Panel\International_Temp" "HKCU\Control Panel\International" /f
>nul
26 reg delete
"HKCU\Control Panel\International_Temp" /f
>nul
27 set IFWI_Suffix
=%today%_
%hour
:~
0,2%%time:~
3,2%
29 :: Process input arguments
30 if "%~1"=="?" goto Usage
31 if "%~1"=="/?" goto Usage
32 if /i
"%~1"=="Help" goto Usage
52 if "%~2"=="" goto Usage
53 if not exist %~
2 echo BIOS
not found.
& goto Usage
55 set BIOS_File_Name
=%~n2
60 if "%~2"=="" goto Usage
61 if not exist %~
2 echo ConfigFile
not found.
& goto Usage
67 if "%~2"=="" goto Usage
73 if "%BIOS_File_Name:~0,4%"=="MNW2" (
74 set Stitch_Config
= MNW2_Stitch_Config.txt
76 if "%BIOS_File_Name:~3,4%"=="MNW2" (
77 set Stitch_Config
= MNW2_Stitch_Config.txt
80 :: if no rom specified by user
, search in .
/ for ROM
files
81 if "%BIOS_Names%"=="" (
83 for /f
"tokens=*" %%i in
('dir /b *.rom') do set BIOS_Names
=!BIOS_Names
! %%i
84 if "!BIOS_Names!"==" " (
85 echo NO .ROM
files found
!!!
90 :: Parse the Stitch_Config File
91 if not exist %Stitch_Config% (
92 echo Stitch Configuration File
%Stitch_Config% not found.
95 for /f
"delims== tokens=1,2" %%i in
(%Stitch_Config%) do (
96 if /i
"%%i"=="HEADER" set IFWI_HEADER
=%%j
97 if /i
"%%i"=="SEC_VERSION" set SEC_VERSION
=%%j
98 if /i
"%%i"=="Source" (
99 if /i
"%%j"=="ALPHA" set Source_Prefix
=A_
100 if /i
"%%j"=="BF" set Source_Prefix
=BF_
101 if /i
"%%j"=="BE" set Source_Prefix
=BE_
102 if /i
"%%j"=="PV" set Source_Prefix
=PV_
103 if /i
"%%j"=="PR1" set Source_Prefix
=PR1_
108 set IFWI_HEADER_FILE
=IFWIHeader\
!IFWI_HEADER
!_SPILOCK.bin
110 set IFWI_HEADER_FILE
=IFWIHeader\
!IFWI_HEADER
!.bin
113 :: **********************************************************************
114 :: The Main Stitching Loop
115 :: **********************************************************************
116 echo %date% %time% >>Stitching.log
2>&1
119 for %%i in
(%BIOS_Names%) do (
121 REM
----- Do NOT use :: for comments Inside of code blocks
() -------
124 set BIOS_Version
=!BIOS_Name
:~
-7,7!
126 REM extract PlatformType from BIOS filename
127 set Platform_Type
=!BIOS_Name
:~
0,4!
129 REM Special treat
for BayLake FFD8
130 set Temp_Name
=!BIOS_Name
:~
0,7!
133 REM Capitalize and validate the Platform_Type
134 if /i
"!Platform_Type!"=="MNW2" (
135 set Platform_Type
=MNW2
137 echo Error
- Unsupported PlatformType
: !Platform_Type
!
142 REM search BIOS_Name
for Arch substring
: either IA32 or X64
143 if not "!BIOS_Name!"=="!BIOS_Name:_IA32_=!" (
145 ) else if not "!BIOS_Name!"=="!BIOS_Name:_X64_=!" (
148 echo Error
: Could
not determine Architecture
for !BIOS_Rom
!
151 set IFWI_Prefix
=!Platform_Type
!_IFWI_
%Source_Prefix%!Arch
!_
!!BIOS_Version
!
153 REM search BIOS_Name
for Build_Target substring
: either R or D
154 if not "!BIOS_Name!"=="!BIOS_Name:_R_=!" (
155 set Build_Target
=Release
156 set IFWI_Prefix
=!IFWI_Prefix
!_R
157 ) else if not "!BIOS_Name!"=="!BIOS_Name:_D_=!" (
158 set Build_Target
=Debug
159 set IFWI_Prefix
=!IFWI_Prefix
!_D
161 echo Error
: Could
not determine Build Target
for !BIOS_Rom
!
165 REM Create a BIOS
backup before Stitching
166 if %BackupRom% EQU
1 (
167 echo Creating
backup of original BIOS rom.
168 copy /y
!BIOS_Rom
! !BIOS_Rom
!.orig
>nul
171 echo.
>>Stitching.log
172 echo ********** Stitching
!BIOS_Rom
! ********** >>Stitching.log
173 echo.
>>Stitching.log
175 echo Stitching IFWI
for !BIOS_Rom
! ...
176 echo ---------------------------------------------------------------------------
177 echo IFWI Header
: !IFWI_HEADER_FILE
!, SEC version
: !SEC_VERSION
!,
178 echo BIOS Version
: !BIOS_Version
!
180 echo Platform
Type: !Platform_Type
!, IFWI Prefix
: %BIOS_ID%
181 echo ---------------------------------------------------------------------------
183 echo -----------------------------
185 echo Generating IFWI...
%BIOS_ID%.bin
188 copy /b
/y
!IFWI_HEADER_FILE
! + ..\..\..\silicon\Vlv2SocBinPkg\SEC\
!SEC_VERSION
!\VLV_SEC_REGION.bin
+ ..\..\..\silicon\Vlv2SocBinPkg\SEC\
!SEC_VERSION
!\Vacant.bin
+ !BIOS_Rom
! %BIOS_ID%.bin
190 echo ===========================================================================
194 ::**********************************************************************
196 ::**********************************************************************
199 echo -- All specified ROM
files Stitched.
--
205 echo **************************************************************************************************
206 echo This Script is used to Stitch together BIOS
, GOP Driver
, Microcode
Patch and TXE FW
207 echo into a single Integrated Firmware Image
(IFWI
).
209 echo Usage
: IFWIStitch.bat
[flags
] [/B BIOS.ROM
] [/C Stitch_Config
] [/S IFWI_Suffix
]
211 echo This script has NO Required arguments
, so that the user can just double click from the GUI.
212 echo However
, this requires that the BIOS.ROM file name is formatted correctly.
214 echo /nG
Do NOT update the GOP driver.
(applies to all ROM
files for this
run)
215 echo /nV
Do NOT update the VBIOS.
(applies to all ROM
files for this
run)
216 echo /nM
Do NOT update the Microcode.
(applies to all ROM
files for this
run)
217 echo /nB
Do NOT backup BIOS.ROMs.
(Default will
backup to BIOS.ROM.Orig
)
219 echo BIOS.ROM
: A single BIOS ROM file to
use for stitching
220 echo (DEFAULT
: ALL .ROM
files inside the current directory
)
221 echo Stitch_Config
: Text file containing version info of each FW component
222 echo (DEFAULT
: Stitch_Config.txt
)
223 echo IFWI_Suffix
: Suffix to
append to the
end of the IFWI filename
224 echo (DEFAULT
: YYYY_MM_DD_HHMM
)
227 echo IFIWStitch.bat
: Stitch all ROMs with defaults
228 echo IFIWStitch.bat
/B C
:/MyRoms
/testBIOS.rom
: Stitch single ROM with defaults
229 echo IFIWStitch.bat
/B ..
/testBIOS.rom
/S test123
: Stitch single ROM and add custom suffix
230 echo IFIWStitch.bat
/nM
/nB
/B testBIOS.rom
/S test456
: Stitch single ROM
, keep uCode from .rom
,
231 echo don
't create backup, and add custom suffix.
232 echo ****************************************************************************************************
240 echo -- See Stitching.log for more info. --
244 if "%Platform_Type%"=="MNW2" (
247 echo only support MNW2 for this project!