2 @REM Windows batch file to build BIOS ROM
4 @REM Copyright
(c
) 2006 - 2018, Intel Corporation. All rights reserved.
<BR
>
5 @REM SPDX
-License
-Identifier
: BSD
-2-Clause
-Patent
9 setlocal EnableDelayedExpansion EnableExtensions
15 ::**********************************************************************
17 ::**********************************************************************
19 if %WORKSPACE
:~
-1%==\
set WORKSPACE
=%WORKSPACE
:~
0,-1%
20 set /a build_threads
=1
25 set CORE_PATH
=%WORKSPACE%\edk2
26 set PLATFORM_PATH
=%WORKSPACE%\edk2
29 :: Clean up previous build
files.
30 if exist %CORE_PATH%\edk2.log
del %CORE_PATH%\edk2.log
31 if exist %CORE_PATH%\unitool.log
del %CORE_PATH%\unitool.log
32 if exist %CORE_PATH%\Conf
\target.txt
del %CORE_PATH%\Conf
\target.txt
33 if exist %CORE_PATH%\Conf
\tools_def.txt
del %CORE_PATH%\Conf
\tools_def.txt
34 if exist %CORE_PATH%\Conf
\build_rule.txt
del %CORE_PATH%\Conf
\build_rule.txt
35 if exist %CORE_PATH%\Conf\FrameworkDatabase.db
del %CORE_PATH%\Conf\FrameworkDatabase.db
36 if exist conf\.
cache rmdir /q
/s conf\.
cache
38 :: Setup EDK environment. Edksetup puts new copies of target.txt
, tools_def.txt
, build_rule.txt in WorkSpace\Conf
39 :: Also
run edksetup as soon as possible to avoid it from changing environment variables we
're overriding
40 call %CORE_PATH%\edksetup.bat Rebuild
43 :: Define platform specific environment variables.
44 set PLATFORM_NAME=Vlv2TbltDevicePkg
45 set PLATFORM_PACKAGE=%PLATFORM_PATH%\Vlv2TbltDevicePkg
46 set config_file=%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
47 set auto_config_inc=%PLATFORM_PACKAGE%\AutoPlatformCFG.txt
51 ::create new AutoPlatformCFG.txt file
52 copy /y nul %auto_config_inc% >nul
54 ::**********************************************************************
55 :: Parse command line arguments
56 ::**********************************************************************
60 if /i "%~1"=="/?" goto Usage
63 set Build_Flags=%Build_Flags% -j EDK2.log
68 set Build_Flags=%Build_Flags% -y %PLATFORM_PACKAGE%\EDK2_%PLATFORM_PACKAGE%.report
73 if defined NUMBER_OF_PROCESSORS (
74 set /a build_threads=%NUMBER_OF_PROCESSORS%+1
80 echo Removing previous build files ...
82 del /f/s/q build > nul
85 if exist conf\.cache (
86 del /f/s/q conf\.cache > nul
87 rmdir /s/q conf\.cache
99 if /i "%~1"=="/IA32" (
105 :: Required argument(s)
106 if "%~1"=="" goto Usage
108 ::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\
109 if "%Arch%"=="IA32" (
110 findstr /b /v "BOARD_ID BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > Conf\BiosId.env
111 echo DEFINE X64_CONFIG = FALSE >> %auto_config_inc%
112 ) else if "%Arch%"=="X64" (
113 findstr /b /v "BOARD_ID BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > Conf\BiosId.env
114 echo DEFINE X64_CONFIG = TRUE >> %auto_config_inc%
117 :: -- Build flags settings for each Platform --
118 echo Setting %1 platform configuration and BIOS ID...
119 if /i "%~1" == "MNW2" (
120 echo BOARD_ID = MNW2MAX >> Conf\BiosId.env
121 echo DEFINE ENBDT_PF_BUILD = TRUE >> %auto_config_inc%
124 echo Error - Unsupported PlatformType: %1
127 set Platform_Type=%~1
129 if /i "%~2" == "RELEASE" (
131 echo BUILD_TYPE = R >> Conf\BiosId.env
134 echo BUILD_TYPE = D >> Conf\BiosId.env
137 ::**********************************************************************
138 :: Additional EDK Build Setup/Configuration
139 ::**********************************************************************
141 echo Setting the Build environment for VS2015/VS2013/VS2012/VS2010/VS2008...
142 if defined VS140COMNTOOLS (
143 if not defined VSINSTALLDIR call "%VS140COMNTOOLS%\vsvars32.bat"
144 if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" (
145 set TOOL_CHAIN_TAG=VS2015
147 set TOOL_CHAIN_TAG=VS2015x86
149 ) else if defined VS120COMNTOOLS (
150 if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
151 if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
152 set TOOL_CHAIN_TAG=VS2013
154 set TOOL_CHAIN_TAG=VS2013x86
156 ) else if defined VS110COMNTOOLS (
157 if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
158 if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
159 set TOOL_CHAIN_TAG=VS2012
161 set TOOL_CHAIN_TAG=VS2012x86
163 ) else if defined VS100COMNTOOLS (
164 if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
165 if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
166 set TOOL_CHAIN_TAG=VS2010
168 set TOOL_CHAIN_TAG=VS2010x86
170 ) else if defined VS90COMNTOOLS (
171 if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
172 if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
173 set TOOL_CHAIN_TAG=VS2008
175 set TOOL_CHAIN_TAG=VS2008x86
178 echo --ERROR: VS2015/VS2013/VS2012/VS2010/VS2008 not installed correctly. VS140COMNTOOLS/VS120COMNTOOLS/VS110COMNTOOLS/VS100COMNTOOLS/VS90COMNTOOLS not defined ^^!
183 echo Ensuring correct build directory is present for GenBiosId...
184 set BUILD_PATH=Build\%PLATFORM_NAME%\%TARGET%_%TOOL_CHAIN_TAG%
186 echo Modifing Conf files for this build...
187 :: Remove lines with these tags from target.txt
188 findstr /V "TARGET TARGET_ARCH TOOL_CHAIN_TAG BUILD_RULE_CONF ACTIVE_PLATFORM MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp
190 echo TARGET = %TARGET% >> Conf\target.txt.tmp
191 if "%Arch%"=="IA32" (
192 echo TARGET_ARCH = IA32 >> Conf\target.txt.tmp
193 ) else if "%Arch%"=="X64" (
194 echo TARGET_ARCH = IA32 X64 >> Conf\target.txt.tmp
196 echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% >> Conf\target.txt.tmp
197 echo BUILD_RULE_CONF = Conf/build_rule.txt >> Conf\target.txt.tmp
199 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc >> Conf\target.txt.tmp
201 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc >> Conf\target.txt.tmp
203 echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads% >> Conf\target.txt.tmp
205 move /Y Conf\target.txt.tmp Conf\target.txt >nul
207 ::**********************************************************************
209 ::**********************************************************************
211 echo Creating BiosId...
212 pushd %PLATFORM_PACKAGE%
213 if not exist %WORKSPACE%\%BUILD_PATH%\IA32 mkdir %WORKSPACE%\%BUILD_PATH%\IA32
214 GenBiosId.exe -i %CORE_PATH%\Conf\BiosId.env -o %WORKSPACE%\%BUILD_PATH%\IA32\BiosId.bin -ob %CORE_PATH%\Conf\BiosId.bat
216 if not exist %WORKSPACE%\%BUILD_PATH%\X64 mkdir %WORKSPACE%\%BUILD_PATH%\X64
217 GenBiosId.exe -i %CORE_PATH%\Conf\BiosId.env -o %WORKSPACE%\%BUILD_PATH%\X64\BiosId.bin -ob %CORE_PATH%\Conf\BiosId.bat
222 if %ERRORLEVEL% NEQ 0 goto BldFail
225 echo Invoking EDK2 build...
226 call build %Build_Flags%
228 if %ERRORLEVEL% NEQ 0 goto BldFail
230 ::**********************************************************************
231 :: Post Build processing and cleanup
232 ::**********************************************************************
236 pushd %PLATFORM_PACKAGE%
237 :: Extract Hii data from build and store in HiiDefaultData.txt
238 fce read -i %WORKSPACE%\%BUILD_PATH%\FV\Vlv.fd > %WORKSPACE%\%BUILD_PATH%\FV\HiiDefaultData.txt
240 :: save changes to VlvXXX.fd
241 fce update -i %WORKSPACE%\%BUILD_PATH%\FV\Vlv.fd -s %WORKSPACE%\%BUILD_PATH%\FV\HiiDefaultData.txt -o %WORKSPACE%\%BUILD_PATH%\FV\Vlv%Arch%.fd
244 if %ERRORLEVEL% NEQ 0 goto BldFail
245 ::echo FD successfully updated with default Hii values.
247 :: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
248 find /v "#" Conf\BiosId.env > ver_strings
249 for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
250 del /f/q ver_strings >nul
252 set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
253 copy /y/b %WORKSPACE%\%BUILD_PATH%\FV\Vlv%Arch%.fd %PLATFORM_PATH%\%BIOS_Name% >nul
254 copy /y/b %WORKSPACE%\%BUILD_PATH%\FV\Vlv%Arch%.fd %WORKSPACE%\%BUILD_PATH%\FV\Vlv.ROM >nul
257 echo Build location: %BUILD_PATH%
258 echo BIOS ROM Created: %BIOS_Name%
260 echo -------------------- The EDKII BIOS build has successfully completed. --------------------
263 @REM build capsule here
264 @REMif "%openssl_path%" == "" (
265 @REM echo -- Error: OPENSSL_PATH not set. Capule and Recovery images not generated.
269 @REM echo > %BUILD_PATH%\FV\SYSTEMFIRMWAREUPDATECARGO.Fv
270 @REM build -p %PLATFORM_PACKAGE%\PlatformCapsule.dsc
276 echo ***************************************************************************
277 echo Build BIOS rom for VLV platforms.
279 echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
281 echo /c CleanAll before building
282 echo /l Generate build log file
283 echo /y Generate build report file
284 echo /m Enable multi-processor build
285 echo /IA32 Set Arch to IA32 (default: X64)
286 echo /X64 Set Arch to X64 (default: X64)
288 echo Platform Types: MNW2
289 echo Build Targets: Debug, Release (default: Debug)
292 echo bld_vlv.bat MNW2 : X64 Debug build for MinnowMax
293 echo bld_vlv.bat /IA32 MNW2 release : IA32 Release build for MinnowMax
295 echo ***************************************************************************
301 echo -- Error: EDKII BIOS Build has failed!
302 echo See EDK2.log for more details