2 @REM Windows batch file to build BIOS ROM
4 @REM Copyright
(c
) 2006 - 2019, Intel Corporation. All rights reserved.
<BR
>
5 @REM SPDX
-License
-Identifier
: BSD
-2-Clause
-Patent
9 setlocal EnableDelayedExpansion EnableExtensions
15 ::**********************************************************************
17 ::**********************************************************************
18 if %WORKSPACE
:~
-1%==\
set WORKSPACE
=%WORKSPACE
:~
0,-1%
19 set /a build_threads
=1
24 set PLATFORM_NAME
=Vlv2TbltDevicePkg
26 set CORE_PATH
=%WORKSPACE%
27 if not exist %CORE_PATH%\edksetup.bat
(
28 if defined PACKAGES_PATH
(
29 for %%i IN
(%PACKAGES_PATH%) DO (
30 if exist %%~fi\edksetup.bat
(
37 echo !!! ERROR
!!! Cannot
find edksetup.bat
!!!
44 set PLATFORM_PACKAGE
=%WORKSPACE%\
%PLATFORM_NAME%
45 if not exist %PLATFORM_PACKAGE% (
46 if defined PACKAGES_PATH
(
47 for %%i IN
(%PACKAGES_PATH%) DO (
48 if exist %%~fi\
%PLATFORM_NAME% (
49 set PLATFORM_PACKAGE
=%%~fi\
%PLATFORM_NAME%
50 goto PlatformPackageFound
55 echo !!! ERROR
!!! Cannot
find %PLATFORM_NAME% !!!
64 :: Clean up previous build
files.
65 if exist %WORKSPACE%\edk2.log
del %WORKSPACE%\edk2.log
66 if exist %WORKSPACE%\unitool.log
del %WORKSPACE%\unitool.log
67 if exist %WORKSPACE%\Conf
\target.txt
del %WORKSPACE%\Conf
\target.txt
68 if exist %WORKSPACE%\Conf
\tools_def.txt
del %WORKSPACE%\Conf
\tools_def.txt
69 if exist %WORKSPACE%\Conf
\build_rule.txt
del %WORKSPACE%\Conf
\build_rule.txt
70 if exist %WORKSPACE%\Conf\.
cache rmdir /q
/s
%WORKSPACE%\Conf\.
cache
72 :: Setup EDK environment. Edksetup puts new copies of target.txt
, tools_def.txt
, build_rule.txt in WorkSpace\Conf
73 :: Also
run edksetup as soon as possible to avoid it from changing environment variables we
're overriding
74 call %CORE_PATH%\edksetup.bat Rebuild
77 :: Define platform specific environment variables.
78 set config_file=%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
79 set auto_config_inc=%PLATFORM_PACKAGE%\AutoPlatformCFG.txt
83 ::create new AutoPlatformCFG.txt file
84 copy /y nul %auto_config_inc% >nul
86 ::**********************************************************************
87 :: Parse command line arguments
88 ::**********************************************************************
92 if /i "%~1"=="/?" goto Usage
95 set Build_Flags=%Build_Flags% -j EDK2.log
100 set Build_Flags=%Build_Flags% -y %PLATFORM_PACKAGE%\EDK2_%PLATFORM_PACKAGE%.report
105 if defined NUMBER_OF_PROCESSORS (
106 set /a build_threads=%NUMBER_OF_PROCESSORS%+1
111 if /i "%~1" == "/c" (
112 echo Removing previous build files ...
114 del /f/s/q build > nul
117 if exist %WORKSPACE%\Conf\.cache (
118 del /f/s/q %WORKSPACE%\Conf\.cache > nul
119 rmdir /s/q %WORKSPACE%\Conf\.cache
126 if /i "%~1"=="/x64" (
131 if /i "%~1"=="/IA32" (
137 :: Required argument(s)
138 if "%~1"=="" goto Usage
140 ::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\
141 if "%Arch%"=="IA32" (
142 findstr /b /v "BOARD_ID BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > %WORKSPACE%\Conf\BiosId.env
143 echo DEFINE X64_CONFIG = FALSE >> %auto_config_inc%
144 ) else if "%Arch%"=="X64" (
145 findstr /b /v "BOARD_ID BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > %WORKSPACE%\Conf\BiosId.env
146 echo DEFINE X64_CONFIG = TRUE >> %auto_config_inc%
149 :: -- Build flags settings for each Platform --
150 echo Setting %1 platform configuration and BIOS ID...
151 if /i "%~1" == "MNW2" (
152 echo BOARD_ID = MNW2MAX >> %WORKSPACE%\Conf\BiosId.env
153 echo DEFINE ENBDT_PF_BUILD = TRUE >> %auto_config_inc%
156 echo Error - Unsupported PlatformType: %1
159 set Platform_Type=%~1
161 if /i "%~2" == "RELEASE" (
163 echo BUILD_TYPE = R >> %WORKSPACE%\Conf\BiosId.env
166 echo BUILD_TYPE = D >> %WORKSPACE%\Conf\BiosId.env
169 ::**********************************************************************
170 :: Additional EDK Build Setup/Configuration
171 ::**********************************************************************
173 echo Setting the Build environment for VS2015/VS2013/VS2012/VS2010/VS2008...
174 if defined VS140COMNTOOLS (
175 if not defined VSINSTALLDIR call "%VS140COMNTOOLS%\vsvars32.bat"
176 if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" (
177 set TOOL_CHAIN_TAG=VS2015
179 set TOOL_CHAIN_TAG=VS2015x86
181 ) else if defined VS120COMNTOOLS (
182 if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
183 if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
184 set TOOL_CHAIN_TAG=VS2013
186 set TOOL_CHAIN_TAG=VS2013x86
188 ) else if defined VS110COMNTOOLS (
189 if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
190 if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
191 set TOOL_CHAIN_TAG=VS2012
193 set TOOL_CHAIN_TAG=VS2012x86
195 ) else if defined VS100COMNTOOLS (
196 if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
197 if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
198 set TOOL_CHAIN_TAG=VS2010
200 set TOOL_CHAIN_TAG=VS2010x86
202 ) else if defined VS90COMNTOOLS (
203 if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
204 if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
205 set TOOL_CHAIN_TAG=VS2008
207 set TOOL_CHAIN_TAG=VS2008x86
210 echo --ERROR: VS2015/VS2013/VS2012/VS2010/VS2008 not installed correctly. VS140COMNTOOLS/VS120COMNTOOLS/VS110COMNTOOLS/VS100COMNTOOLS/VS90COMNTOOLS not defined ^^!
215 echo Ensuring correct build directory is present for GenBiosId...
216 set BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_NAME%\%TARGET%_%TOOL_CHAIN_TAG%
218 echo Modifing Conf files for this build...
219 :: Remove lines with these tags from target.txt
220 findstr /V "TARGET TARGET_ARCH TOOL_CHAIN_TAG BUILD_RULE_CONF ACTIVE_PLATFORM MAX_CONCURRENT_THREAD_NUMBER" %WORKSPACE%\Conf\target.txt > %WORKSPACE%\Conf\target.txt.tmp
222 echo TARGET = %TARGET% >> %WORKSPACE%\Conf\target.txt.tmp
223 if "%Arch%"=="IA32" (
224 echo TARGET_ARCH = IA32 >> %WORKSPACE%\Conf\target.txt.tmp
225 ) else if "%Arch%"=="X64" (
226 echo TARGET_ARCH = IA32 X64 >> %WORKSPACE%\Conf\target.txt.tmp
228 echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% >> %WORKSPACE%\Conf\target.txt.tmp
229 echo BUILD_RULE_CONF = Conf/build_rule.txt >> %WORKSPACE%\Conf\target.txt.tmp
231 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc >> %WORKSPACE%\Conf\target.txt.tmp
233 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc >> %WORKSPACE%\Conf\target.txt.tmp
235 echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads% >> %WORKSPACE%\Conf\target.txt.tmp
237 move /Y %WORKSPACE%\Conf\target.txt.tmp %WORKSPACE%\Conf\target.txt >nul
239 ::**********************************************************************
241 ::**********************************************************************
243 echo Creating BiosId...
244 if not exist %BUILD_PATH%\IA32 mkdir %BUILD_PATH%\IA32
245 %PLATFORM_PACKAGE%\GenBiosId.exe -i %WORKSPACE%\Conf\BiosId.env -o %BUILD_PATH%\IA32\BiosId.bin -ob %WORKSPACE%\Conf\BiosId.bat
247 if not exist %BUILD_PATH%\X64 mkdir %BUILD_PATH%\X64
248 %PLATFORM_PACKAGE%\GenBiosId.exe -i %WORKSPACE%\Conf\BiosId.env -o %BUILD_PATH%\X64\BiosId.bin -ob %WORKSPACE%\Conf\BiosId.bat
251 if %ERRORLEVEL% NEQ 0 goto BldFail
254 echo Invoking EDK2 build...
255 call build %Build_Flags%
257 if %ERRORLEVEL% NEQ 0 goto BldFail
259 ::**********************************************************************
260 :: Post Build processing and cleanup
261 ::**********************************************************************
265 pushd %PLATFORM_PACKAGE%
266 :: Extract Hii data from build and store in HiiDefaultData.txt
267 %PLATFORM_PACKAGE%\fce read -i %BUILD_PATH%\FV\Vlv.fd > %BUILD_PATH%\FV\HiiDefaultData.txt
269 :: save changes to VlvXXX.fd
270 %PLATFORM_PACKAGE%\fce update -i %BUILD_PATH%\FV\Vlv.fd -s %BUILD_PATH%\FV\HiiDefaultData.txt -o %BUILD_PATH%\FV\Vlv%Arch%.fd
273 if %ERRORLEVEL% NEQ 0 goto BldFail
274 ::echo FD successfully updated with default Hii values.
276 :: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
277 find /v "#" %WORKSPACE%\Conf\BiosId.env > ver_strings
278 for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
279 del /f/q ver_strings >nul
281 set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
282 copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd %PLATFORM_PACKAGE%\Stitch\%BIOS_Name% >nul
283 copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd %BUILD_PATH%\FV\Vlv.ROM >nul
286 echo Build location: %BUILD_PATH%
287 echo BIOS ROM Created: %BIOS_Name%
289 echo -------------------- The EDKII BIOS build has successfully completed. --------------------
292 @REM build capsule here
293 echo > %BUILD_PATH%\FV\SYSTEMFIRMWAREUPDATECARGO.Fv
294 build -p %PLATFORM_PACKAGE%\PlatformCapsule.dsc
300 echo ***************************************************************************
301 echo Build BIOS rom for VLV platforms.
303 echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
305 echo /c CleanAll before building
306 echo /l Generate build log file
307 echo /y Generate build report file
308 echo /m Enable multi-processor build
309 echo /IA32 Set Arch to IA32 (default: X64)
310 echo /X64 Set Arch to X64 (default: X64)
312 echo Platform Types: MNW2
313 echo Build Targets: Debug, Release (default: Debug)
316 echo bld_vlv.bat MNW2 : X64 Debug build for MinnowMax
317 echo bld_vlv.bat /IA32 MNW2 release : IA32 Release build for MinnowMax
319 echo ***************************************************************************
325 echo -- Error: EDKII BIOS Build has failed!
326 echo See EDK2.log for more details