2 @REM Windows batch file to build BIOS ROM
4 @REM Copyright
(c
) 2006 - 2016, Intel Corporation. All rights reserved.
<BR
>
5 @REM This program and the accompanying materials
6 @REM are licensed and made available under the terms and conditions of the BSD License
7 @REM which accompanies this distribution. The full text of the license may be found at
8 @REM http
://opensource.org
/licenses
/bsd
-license.php
10 @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
"AS IS" BASIS
,
11 @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND
, EITHER EXPRESS OR IMPLIED.
15 setlocal EnableDelayedExpansion EnableExtensions
20 ::**********************************************************************
22 ::**********************************************************************
23 REM set WORKSPACE=%CD%
24 REM if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
25 set /a build_threads
=1
31 :: Clean up previous build
files.
32 if exist %WORKSPACE%\
%PLATFORM_PACKAGE%\EDK2_
%PLATFORM_PACKAGE%.log
del %WORKSPACE%\
%PLATFORM_PACKAGE%\EDK2_
%PLATFORM_PACKAGE%.log
33 if exist %WORKSPACE%\
%PLATFORM_PACKAGE%\EDK2_
%PLATFORM_PACKAGE%.report
del %WORKSPACE%\
%PLATFORM_PACKAGE%\EDK2_
%PLATFORM_PACKAGE%.report
34 if exist %WORKSPACE%\unitool.log
del %WORKSPACE%\unitool.log
35 if exist %WORKSPACE%\Conf
\target.txt
del %WORKSPACE%\Conf
\target.txt
36 if exist %WORKSPACE%\Conf
\tools_def.txt
del %WORKSPACE%\Conf
\tools_def.txt
37 if exist %WORKSPACE%\Conf
\build_rule.txt
del %WORKSPACE%\Conf
\build_rule.txt
38 if exist %WORKSPACE%\Conf\FrameworkDatabase.db
del %WORKSPACE%\Conf\FrameworkDatabase.db
39 if exist %WORKSPACE%\Conf\.
cache rmdir /q
/s
%WORKSPACE%\Conf\.
cache
41 :: Setup EDK environment. Edksetup puts new copies of target.txt
, tools_def.txt
, build_rule.txt in WorkSpace\Conf
42 :: Also
run edksetup as soon as possible to avoid it from changing environment variables we
're overriding
43 call edksetup.bat > nul
46 :: Define platform specific environment variables.
47 set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
48 set config_file=.\%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
49 set auto_config_inc=.\%PLATFORM_PACKAGE%\AutoPlatformCFG.txt
51 REM set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg
53 ::create new AutoPlatformCFG.txt file
54 copy /y nul %auto_config_inc% >nul
56 ::**********************************************************************
57 :: Parse command line arguments
58 ::**********************************************************************
62 if /i "%~1"=="/?" goto Usage
65 set Build_Flags=%Build_Flags% -j %PLATFORM_PACKAGE%\EDK2_%PLATFORM_PACKAGE%.log
70 set Build_Flags=%Build_Flags% -y %PLATFORM_PACKAGE%\EDK2_%PLATFORM_PACKAGE%.report
75 if defined NUMBER_OF_PROCESSORS (
76 set /a build_threads=%NUMBER_OF_PROCESSORS%+1
82 echo Removing previous build files ...
84 del /f/s/q build > nul
87 if exist conf\.cache (
88 del /f/s/q conf\.cache > nul
89 rmdir /s/q conf\.cache
101 if /i "%~1"=="/IA32" (
107 :: Required argument(s)
108 if "%~1"=="" goto Usage
110 ::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\
111 if "%Arch%"=="IA32" (
112 findstr /b /v "BOARD_ID BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > %WORKSPACE%\Conf\BiosId.env
113 echo DEFINE X64_CONFIG = FALSE >> %auto_config_inc%
114 ) else if "%Arch%"=="X64" (
115 findstr /b /v "BOARD_ID BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > %WORKSPACE%\Conf\BiosId.env
116 echo DEFINE X64_CONFIG = TRUE >> %auto_config_inc%
119 :: -- Build flags settings for each Platform --
120 echo Setting %1 platform configuration and BIOS ID...
121 if /i "%~1" == "MNW2" (
122 echo BOARD_ID = MNW2MAX >> %WORKSPACE%\Conf\BiosId.env
123 echo DEFINE ENBDT_PF_BUILD = TRUE >> %auto_config_inc%
126 echo Error - Unsupported PlatformType: %1
129 set Platform_Type=%~1
131 if /i "%~2" == "RELEASE" (
133 echo BUILD_TYPE = R >> %WORKSPACE%\Conf\BiosId.env
136 echo BUILD_TYPE = D >> %WORKSPACE%\Conf\BiosId.env
139 ::**********************************************************************
140 :: Additional EDK Build Setup/Configuration
141 ::**********************************************************************
143 echo Setting the Build environment for VS2008/VS2010/VS2012/VS2013...
144 if defined VS140COMNTOOLS (
145 if not defined VSINSTALLDIR call "%VS140COMNTOOLS%\vsvars32.bat"
146 if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" (
147 set TOOL_CHAIN_TAG=VS2015
149 set TOOL_CHAIN_TAG=VS2015x86
151 ) else if defined VS120COMNTOOLS (
152 if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
153 if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
154 set TOOL_CHAIN_TAG=VS2013
156 set TOOL_CHAIN_TAG=VS2013x86
158 ) else if defined VS110COMNTOOLS (
159 if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
160 if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
161 set TOOL_CHAIN_TAG=VS2012
163 set TOOL_CHAIN_TAG=VS2012x86
165 ) else if defined VS100COMNTOOLS (
166 if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
167 if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
168 set TOOL_CHAIN_TAG=VS2010
170 set TOOL_CHAIN_TAG=VS2010x86
172 ) else if defined VS90COMNTOOLS (
173 if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
174 if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
175 set TOOL_CHAIN_TAG=VS2008
177 set TOOL_CHAIN_TAG=VS2008x86
180 echo --ERROR: VS2008/VS2010/VS2012/VS2013/VS2015 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS/VS140COMMONTOOLS not defined ^^!
185 echo Ensuring correct build directory is present for GenBiosId...
186 set BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%
188 echo Modifing Conf files for this build...
189 :: Remove lines with these tags from target.txt
190 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
192 echo TARGET = %TARGET% >> %WORKSPACE%\Conf\target.txt.tmp
193 if "%Arch%"=="IA32" (
194 echo TARGET_ARCH = IA32 >> %WORKSPACE%\Conf\target.txt.tmp
195 ) else if "%Arch%"=="X64" (
196 echo TARGET_ARCH = IA32 X64 >> %WORKSPACE%\Conf\target.txt.tmp
198 echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% >> %WORKSPACE%\Conf\target.txt.tmp
199 echo BUILD_RULE_CONF = Conf/build_rule.txt >> %WORKSPACE%\Conf\target.txt.tmp
201 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc >> %WORKSPACE%\Conf\target.txt.tmp
203 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc >> %WORKSPACE%\Conf\target.txt.tmp
205 echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads% >> %WORKSPACE%\Conf\target.txt.tmp
207 move /Y %WORKSPACE%\Conf\target.txt.tmp %WORKSPACE%\Conf\target.txt >nul
209 ::**********************************************************************
211 ::**********************************************************************
213 echo Creating BiosId...
214 pushd %PLATFORM_PACKAGE%
215 if not exist %BUILD_PATH%\IA32 mkdir %BUILD_PATH%\IA32
216 GenBiosId.exe -i %WORKSPACE%\Conf\BiosId.env -o %BUILD_PATH%\IA32\BiosId.bin -ob %WORKSPACE%\Conf\BiosId.bat
218 if not exist %BUILD_PATH%\X64 mkdir %BUILD_PATH%\X64
219 GenBiosId.exe -i %WORKSPACE%\Conf\BiosId.env -o %BUILD_PATH%\X64\BiosId.bin -ob %WORKSPACE%\Conf\BiosId.bat
224 if %ERRORLEVEL% NEQ 0 goto BldFail
227 echo Invoking EDK2 build...
228 call build %Build_Flags%
230 if %ERRORLEVEL% NEQ 0 goto BldFail
232 ::**********************************************************************
233 :: Post Build processing and cleanup
234 ::**********************************************************************
238 pushd %PLATFORM_PACKAGE%
239 :: Extract Hii data from build and store in HiiDefaultData.txt
240 fce read -i %BUILD_PATH%\FV\Vlv.fd > %BUILD_PATH%\FV\HiiDefaultData.txt
242 :: save changes to VlvXXX.fd
243 fce update -i %BUILD_PATH%\FV\Vlv.fd -s %BUILD_PATH%\FV\HiiDefaultData.txt -o %BUILD_PATH%\FV\Vlv%Arch%.fd
247 if %ERRORLEVEL% NEQ 0 goto BldFail
248 ::echo FD successfully updated with default Hii values.
250 :: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
251 find /v "#" %WORKSPACE%\Conf\BiosId.env > ver_strings
252 for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
253 del /f/q ver_strings >nul
255 set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
256 copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd %WORKSPACE%\%BIOS_Name% >nul
257 copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd %BUILD_PATH%\FV\Vlv.ROM >nul
260 echo Build location: %BUILD_PATH%
261 echo BIOS ROM Created: %BIOS_Name%
263 echo -------------------- The EDKII BIOS build has successfully completed. --------------------
266 @REM build capsule here
267 if "%openssl_path%" == "" (
268 echo -- Error: OPENSSL_PATH not set. Capule and Recovery images not generated.
272 echo > %BUILD_PATH%\FV\SYSTEMFIRMWAREUPDATECARGO.Fv
273 build -p %PLATFORM_PACKAGE%\PlatformCapsule.dsc
279 echo ***************************************************************************
280 echo Build BIOS rom for VLV platforms.
282 echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
284 echo /c CleanAll before building
285 echo /l Generate build log file
286 echo /y Generate build report file
287 echo /m Enable multi-processor build
288 echo /IA32 Set Arch to IA32 (default: X64)
289 echo /X64 Set Arch to X64 (default: X64)
291 echo Platform Types: MNW2
292 echo Build Targets: Debug, Release (default: Debug)
295 echo bld_vlv.bat MNW2 : X64 Debug build for MinnowMax
296 echo bld_vlv.bat /IA32 MNW2 release : IA32 Release build for MinnowMax
298 echo ***************************************************************************
304 echo -- Error: EDKII BIOS Build has failed!
305 echo See EDK2.log for more details