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
22 set Stitch_Config
=Stitch_Config.txt
23 copy /y nul Stitching.log
>nul
25 :: Set default Suffix as
: YYYY_MM_DD_HHMM
27 reg
copy "HKCU\Control Panel\International" "HKCU\Control Panel\International_Temp" /f
>nul
28 reg add
"HKCU\Control Panel\International" /v sShortDate
/d
"yyyy_MM_dd" /f
>nul
29 for /f
"tokens=1" %%i in
("%date%") do set today
=%%i
30 reg
copy "HKCU\Control Panel\International_Temp" "HKCU\Control Panel\International" /f
>nul
31 reg delete
"HKCU\Control Panel\International_Temp" /f
>nul
32 set IFWI_Suffix
=%today%_
%hour
:~
0,2%%time:~
3,2%
34 :: Process input arguments
35 if "%~1"=="?" goto Usage
36 if "%~1"=="/?" goto Usage
37 if /i
"%~1"=="Help" goto Usage
51 if "%~2"=="" goto Usage
52 if not exist %~
2 echo BIOS
not found.
& goto Usage
54 set BIOS_File_Name
=%~n2
59 if "%~2"=="" goto Usage
60 if not exist %~
2 echo ConfigFile
not found.
& goto Usage
66 if "%~2"=="" goto Usage
72 if "%BIOS_File_Name:~0,4%"=="MNW2" (
73 set Stitch_Config
= MNW2_Stitch_Config.txt
75 if "%BIOS_File_Name:~3,4%"=="MNW2" (
76 set Stitch_Config
= MNW2_Stitch_Config.txt
79 :: if no rom specified by user
, search in .
/ for ROM
files
80 if "%BIOS_Names%"=="" (
82 for /f
"tokens=*" %%i in
('dir /b *.rom') do set BIOS_Names
=!BIOS_Names
! %%i
83 if "!BIOS_Names!"==" " (
84 echo NO .ROM
files found
!!!
89 :: Parse the Stitch_Config File
90 if not exist %Stitch_Config% (
91 echo Stitch Configuration File
%Stitch_Config% not found.
94 for /f
"delims== tokens=1,2" %%i in
(%Stitch_Config%) do (
95 if /i
"%%i"=="HEADER" set IFWI_HEADER
=%%j
96 if /i
"%%i"=="SEC_VERSION" set SEC_VERSION
=%%j
97 if /i
"%%i"=="Source" (
98 if /i
"%%j"=="ALPHA" set Source_Prefix
=A_
99 if /i
"%%j"=="BF" set Source_Prefix
=BF_
100 if /i
"%%j"=="BE" set Source_Prefix
=BE_
101 if /i
"%%j"=="PV" set Source_Prefix
=PV_
102 if /i
"%%j"=="PR1" set Source_Prefix
=PR1_
107 :: **********************************************************************
108 :: The Main Stitching Loop
109 :: **********************************************************************
110 echo %date% %time% >>Stitching.log
2>&1
113 for %%i in
(%BIOS_Names%) do (
115 REM
----- Do NOT use :: for comments Inside of code blocks
() -------
118 set BIOS_Version
=!BIOS_Name
:~
-7,7!
120 REM extract PlatformType from BIOS filename
121 set Platform_Type
=!BIOS_Name
:~
0,4!
123 REM Special treat
for BayLake FFD8
124 set Temp_Name
=!BIOS_Name
:~
0,7!
127 REM Capitalize and validate the Platform_Type
128 if /i
"!Platform_Type!"=="MNW2" (
129 set Platform_Type
=MNW2
131 echo Error
- Unsupported PlatformType
: !Platform_Type
!
136 REM search BIOS_Name
for Arch substring
: either IA32 or X64
137 if not "!BIOS_Name!"=="!BIOS_Name:_IA32_=!" (
139 ) else if not "!BIOS_Name!"=="!BIOS_Name:_X64_=!" (
142 echo Error
: Could
not determine Architecture
for !BIOS_Rom
!
145 set IFWI_Prefix
=!Platform_Type
!_IFWI_
%Source_Prefix%!Arch
!_
!!BIOS_Version
!
147 REM search BIOS_Name
for Build_Target substring
: either R or D
148 if not "!BIOS_Name!"=="!BIOS_Name:_R_=!" (
149 set Build_Target
=Release
150 set IFWI_Prefix
=!IFWI_Prefix
!_R
151 ) else if not "!BIOS_Name!"=="!BIOS_Name:_D_=!" (
152 set Build_Target
=Debug
153 set IFWI_Prefix
=!IFWI_Prefix
!_D
155 echo Error
: Could
not determine Build Target
for !BIOS_Rom
!
159 REM Create a BIOS
backup before Stitching
160 if %BackupRom% EQU
1 (
161 echo Creating
backup of original BIOS rom.
162 copy /y
!BIOS_Rom
! !BIOS_Rom
!.orig
>nul
165 echo.
>>Stitching.log
166 echo ********** Stitching
!BIOS_Rom
! ********** >>Stitching.log
167 echo.
>>Stitching.log
169 echo Stitching IFWI
for !BIOS_Rom
! ...
170 echo ---------------------------------------------------------------------------
171 echo IFWI Header
: !IFWI_HEADER
!.bin
, SEC version
: !SEC_VERSION
!,
172 echo BIOS Version
: !BIOS_Version
!
174 echo Platform
Type: !Platform_Type
!, IFWI Prefix
: %BIOS_ID%
175 echo ---------------------------------------------------------------------------
177 echo -----------------------------
179 echo Generating IFWI...
%BIOS_ID%.bin
181 copy /b
/y IFWIHeader\
!IFWI_HEADER
!.bin
+ ..\..\Vlv2MiscBinariesPkg\SEC\
!SEC_VERSION
!\VLV_SEC_REGION.bin
+ IFWIHeader\Vacant.bin
+ !BIOS_Rom
! %BIOS_ID%.bin
183 echo ===========================================================================
187 ::**********************************************************************
189 ::**********************************************************************
192 echo -- All specified ROM
files Stitched.
--
198 echo **************************************************************************************************
199 echo This Script is used to Stitch together BIOS
, GOP Driver
, Microcode
Patch and TXE FW
200 echo into a single Integrated Firmware Image
(IFWI
).
202 echo Usage
: IFWIStitch.bat
[flags
] [/B BIOS.ROM
] [/C Stitch_Config
] [/S IFWI_Suffix
]
204 echo This script has NO Required arguments
, so that the user can just double click from the GUI.
205 echo However
, this requires that the BIOS.ROM file name is formatted correctly.
207 echo /nG
Do NOT update the GOP driver.
(applies to all ROM
files for this
run)
208 echo /nV
Do NOT update the VBIOS.
(applies to all ROM
files for this
run)
209 echo /nM
Do NOT update the Microcode.
(applies to all ROM
files for this
run)
210 echo /nB
Do NOT backup BIOS.ROMs.
(Default will
backup to BIOS.ROM.Orig
)
212 echo BIOS.ROM
: A single BIOS ROM file to
use for stitching
213 echo (DEFAULT
: ALL .ROM
files inside the current directory
)
214 echo Stitch_Config
: Text file containing version info of each FW component
215 echo (DEFAULT
: Stitch_Config.txt
)
216 echo IFWI_Suffix
: Suffix to
append to the
end of the IFWI filename
217 echo (DEFAULT
: YYYY_MM_DD_HHMM
)
220 echo IFIWStitch.bat
: Stitch all ROMs with defaults
221 echo IFIWStitch.bat
/B C
:/MyRoms
/testBIOS.rom
: Stitch single ROM with defaults
222 echo IFIWStitch.bat
/B ..
/testBIOS.rom
/S test123
: Stitch single ROM and add custom suffix
223 echo IFIWStitch.bat
/nM
/nB
/B testBIOS.rom
/S test456
: Stitch single ROM
, keep uCode from .rom
,
224 echo don
't create backup, and add custom suffix.
225 echo ****************************************************************************************************
233 echo -- See Stitching.log for more info. --
237 if "%Platform_Type%"=="MNW2" (
240 echo only support MNW2 for this project!