2 @REM Windows batch file to build BIOS ROM
4 @REM Copyright
(c
) 2006 - 2014, Intel Corporation. All rights reserved.
<BR
>
6 @REM This program and the accompanying materials are licensed and made available under
7 @REM the terms and conditions of the BSD License that accompanies this distribution.
8 @REM The full text of the license may be found at
9 @REM http
://opensource.org
/licenses
/bsd
-license.php.
11 @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
"AS IS" BASIS
,
12 @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND
, EITHER EXPRESS OR IMPLIED.
16 SetLocal EnableDelayedExpansion EnableExtensions
18 :: Set script defaults
23 set Stitch_Config
=Stitch_Config.txt
24 copy /y nul Stitching.log
>nul
26 :: Set default Suffix as
: YYYY_MM_DD_HHMM
28 reg
copy "HKCU\Control Panel\International" "HKCU\Control Panel\International_Temp" /f
>nul
29 reg add
"HKCU\Control Panel\International" /v sShortDate
/d
"yyyy_MM_dd" /f
>nul
30 for /f
"tokens=1" %%i in
("%date%") do set today
=%%i
31 reg
copy "HKCU\Control Panel\International_Temp" "HKCU\Control Panel\International" /f
>nul
32 reg delete
"HKCU\Control Panel\International_Temp" /f
>nul
33 set IFWI_Suffix
=%today%_
%hour
:~
0,2%%time:~
3,2%
35 :: Process input arguments
36 if "%~1"=="?" goto Usage
37 if "%~1"=="/?" goto Usage
38 if /i
"%~1"=="Help" goto Usage
58 if "%~2"=="" goto Usage
59 if not exist %~
2 echo BIOS
not found.
& goto Usage
61 set BIOS_File_Name
=%~n2
66 if "%~2"=="" goto Usage
67 if not exist %~
2 echo ConfigFile
not found.
& goto Usage
73 if "%~2"=="" goto Usage
79 if "%BIOS_File_Name:~0,4%"=="MNW2" (
80 set Stitch_Config
= MNW2_Stitch_Config.txt
82 if "%BIOS_File_Name:~3,4%"=="MNW2" (
83 set Stitch_Config
= MNW2_Stitch_Config.txt
86 :: if no rom specified by user
, search in .
/ for ROM
files
87 if "%BIOS_Names%"=="" (
89 for /f
"tokens=*" %%i in
('dir /b *.rom') do set BIOS_Names
=!BIOS_Names
! %%i
90 if "!BIOS_Names!"==" " (
91 echo NO .ROM
files found
!!!
96 :: Parse the Stitch_Config File
97 if not exist %Stitch_Config% (
98 echo Stitch Configuration File
%Stitch_Config% not found.
101 for /f
"delims== tokens=1,2" %%i in
(%Stitch_Config%) do (
102 if /i
"%%i"=="HEADER" set IFWI_HEADER
=%%j
103 if /i
"%%i"=="SEC_VERSION" set SEC_VERSION
=%%j
104 if /i
"%%i"=="Source" (
105 if /i
"%%j"=="ALPHA" set Source_Prefix
=A_
106 if /i
"%%j"=="BF" set Source_Prefix
=BF_
107 if /i
"%%j"=="BE" set Source_Prefix
=BE_
108 if /i
"%%j"=="PV" set Source_Prefix
=PV_
109 if /i
"%%j"=="PR1" set Source_Prefix
=PR1_
114 set IFWI_HEADER_FILE
=IFWIHeader\
!IFWI_HEADER
!_SPILOCK.bin
116 set IFWI_HEADER_FILE
=IFWIHeader\
!IFWI_HEADER
!.bin
119 :: **********************************************************************
120 :: The Main Stitching Loop
121 :: **********************************************************************
122 echo %date% %time% >>Stitching.log
2>&1
125 for %%i in
(%BIOS_Names%) do (
127 REM
----- Do NOT use :: for comments Inside of code blocks
() -------
130 set BIOS_Version
=!BIOS_Name
:~
-7,7!
132 REM extract PlatformType from BIOS filename
133 set Platform_Type
=!BIOS_Name
:~
0,4!
135 REM Special treat
for BayLake FFD8
136 set Temp_Name
=!BIOS_Name
:~
0,7!
139 REM Capitalize and validate the Platform_Type
140 if /i
"!Platform_Type!"=="MNW2" (
141 set Platform_Type
=MNW2
143 echo Error
- Unsupported PlatformType
: !Platform_Type
!
148 REM search BIOS_Name
for Arch substring
: either IA32 or X64
149 if not "!BIOS_Name!"=="!BIOS_Name:_IA32_=!" (
151 ) else if not "!BIOS_Name!"=="!BIOS_Name:_X64_=!" (
154 echo Error
: Could
not determine Architecture
for !BIOS_Rom
!
157 set IFWI_Prefix
=!Platform_Type
!_IFWI_
%Source_Prefix%!Arch
!_
!!BIOS_Version
!
159 REM search BIOS_Name
for Build_Target substring
: either R or D
160 if not "!BIOS_Name!"=="!BIOS_Name:_R_=!" (
161 set Build_Target
=Release
162 set IFWI_Prefix
=!IFWI_Prefix
!_R
163 ) else if not "!BIOS_Name!"=="!BIOS_Name:_D_=!" (
164 set Build_Target
=Debug
165 set IFWI_Prefix
=!IFWI_Prefix
!_D
167 echo Error
: Could
not determine Build Target
for !BIOS_Rom
!
171 REM Create a BIOS
backup before Stitching
172 if %BackupRom% EQU
1 (
173 echo Creating
backup of original BIOS rom.
174 copy /y
!BIOS_Rom
! !BIOS_Rom
!.orig
>nul
177 echo.
>>Stitching.log
178 echo ********** Stitching
!BIOS_Rom
! ********** >>Stitching.log
179 echo.
>>Stitching.log
181 echo Stitching IFWI
for !BIOS_Rom
! ...
182 echo ---------------------------------------------------------------------------
183 echo IFWI Header
: !IFWI_HEADER_FILE
!, SEC version
: !SEC_VERSION
!,
184 echo BIOS Version
: !BIOS_Version
!
186 echo Platform
Type: !Platform_Type
!, IFWI Prefix
: %BIOS_ID%
187 echo ---------------------------------------------------------------------------
189 echo -----------------------------
191 echo Generating IFWI...
%BIOS_ID%.bin
194 copy /b
/y
!IFWI_HEADER_FILE
! + ..\..\Vlv2MiscBinariesPkg\SEC\
!SEC_VERSION
!\VLV_SEC_REGION.bin
+ ..\..\Vlv2MiscBinariesPkg\SEC\
!SEC_VERSION
!\Vacant.bin
+ !BIOS_Rom
! %BIOS_ID%.bin
196 echo ===========================================================================
200 ::**********************************************************************
202 ::**********************************************************************
205 echo -- All specified ROM
files Stitched.
--
211 echo **************************************************************************************************
212 echo This Script is used to Stitch together BIOS
, GOP Driver
, Microcode
Patch and TXE FW
213 echo into a single Integrated Firmware Image
(IFWI
).
215 echo Usage
: IFWIStitch.bat
[flags
] [/B BIOS.ROM
] [/C Stitch_Config
] [/S IFWI_Suffix
]
217 echo This script has NO Required arguments
, so that the user can just double click from the GUI.
218 echo However
, this requires that the BIOS.ROM file name is formatted correctly.
220 echo /nG
Do NOT update the GOP driver.
(applies to all ROM
files for this
run)
221 echo /nV
Do NOT update the VBIOS.
(applies to all ROM
files for this
run)
222 echo /nM
Do NOT update the Microcode.
(applies to all ROM
files for this
run)
223 echo /nB
Do NOT backup BIOS.ROMs.
(Default will
backup to BIOS.ROM.Orig
)
225 echo BIOS.ROM
: A single BIOS ROM file to
use for stitching
226 echo (DEFAULT
: ALL .ROM
files inside the current directory
)
227 echo Stitch_Config
: Text file containing version info of each FW component
228 echo (DEFAULT
: Stitch_Config.txt
)
229 echo IFWI_Suffix
: Suffix to
append to the
end of the IFWI filename
230 echo (DEFAULT
: YYYY_MM_DD_HHMM
)
233 echo IFIWStitch.bat
: Stitch all ROMs with defaults
234 echo IFIWStitch.bat
/B C
:/MyRoms
/testBIOS.rom
: Stitch single ROM with defaults
235 echo IFIWStitch.bat
/B ..
/testBIOS.rom
/S test123
: Stitch single ROM and add custom suffix
236 echo IFIWStitch.bat
/nM
/nB
/B testBIOS.rom
/S test456
: Stitch single ROM
, keep uCode from .rom
,
237 echo don
't create backup, and add custom suffix.
238 echo ****************************************************************************************************
246 echo -- See Stitching.log for more info. --
250 if "%Platform_Type%"=="MNW2" (
253 echo only support MNW2 for this project!