2 @REM Windows batch file to build BIOS ROM
4 @REM Copyright
(c
) 2006 - 2014, 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 ::**********************************************************************
24 if %WORKSPACE
:~
-1%==\
set WORKSPACE
=%WORKSPACE
:~
0,-1%
25 set /a build_threads
=1
31 :: Clean up previous build
files.
32 if exist %WORKSPACE%\edk2.log
del %WORKSPACE%\edk2.log
33 if exist %WORKSPACE%\unitool.log
del %WORKSPACE%\unitool.log
34 if exist %WORKSPACE%\Conf
\target.txt
del %WORKSPACE%\Conf
\target.txt
35 if exist %WORKSPACE%\Conf
\tools_def.txt
del %WORKSPACE%\Conf
\tools_def.txt
36 if exist %WORKSPACE%\Conf
\build_rule.txt
del %WORKSPACE%\Conf
\build_rule.txt
37 if exist %WORKSPACE%\Conf\FrameworkDatabase.db
del %WORKSPACE%\Conf\FrameworkDatabase.db
38 if exist conf\.
cache rmdir /q
/s conf\.
cache
40 :: Setup EDK environment. Edksetup puts new copies of target.txt
, tools_def.txt
, build_rule.txt in WorkSpace\Conf
41 :: Also
run edksetup as soon as possible to avoid it from changing environment variables we
're overriding
42 call edksetup.bat > nul
45 :: Define platform specific environment variables.
46 set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
47 set config_file=.\%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
48 set auto_config_inc=.\%PLATFORM_PACKAGE%\AutoPlatformCFG.txt
50 set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg
52 ::create new AutoPlatformCFG.txt file
53 copy /y nul %auto_config_inc% >nul
55 ::**********************************************************************
56 :: Parse command line arguments
57 ::**********************************************************************
61 if /i "%~1"=="/?" goto Usage
64 set Build_Flags=%Build_Flags% -j EDK2.log
69 echo Removing previous build files ...
71 del /f/s/q build > null
74 if exist conf\.cache (
75 del /f/s/q conf\.cache > null
76 rmdir /s/q conf\.cache
88 if /i "%~1"=="/IA32" (
94 :: Required argument(s)
95 if "%~1"=="" goto Usage
97 ::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\
99 findstr /b /v "BOARD_ID BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > Conf\BiosId.env
100 echo DEFINE X64_CONFIG = FALSE >> %auto_config_inc%
101 ) else if "%Arch%"=="X64" (
102 findstr /b /v "BOARD_ID BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > Conf\BiosId.env
103 echo DEFINE X64_CONFIG = TRUE >> %auto_config_inc%
106 :: -- Build flags settings for each Platform --
107 echo Setting %1 platform configuration and BIOS ID...
108 if /i "%~1" == "MNW2" (
109 echo BOARD_ID = MNW2MAX >> %Conf\BiosId.env
110 echo DEFINE ENBDT_PF_BUILD = TRUE >> %auto_config_inc%
113 echo Error - Unsupported PlatformType: %1
116 set Platform_Type=%~1
118 if /i "%~2" == "RELEASE" (
120 echo BUILD_TYPE = R >> Conf\BiosId.env
123 echo BUILD_TYPE = D >> Conf\BiosId.env
126 ::**********************************************************************
127 :: Additional EDK Build Setup/Configuration
128 ::**********************************************************************
130 echo Setting the Build environment for VS2008/VS2010/VS2012/VS2013...
131 if defined VS90COMNTOOLS (
132 if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
133 if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
134 set TOOL_CHAIN_TAG=VS2008
136 set TOOL_CHAIN_TAG=VS2008x86
138 ) else if defined VS100COMNTOOLS (
139 if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
140 if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
141 set TOOL_CHAIN_TAG=VS2010
143 set TOOL_CHAIN_TAG=VS2010x86
145 ) else if defined VS110COMNTOOLS (
146 if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
147 if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
148 set TOOL_CHAIN_TAG=VS2012
150 set TOOL_CHAIN_TAG=VS2012x86
152 ) else if defined VS120COMNTOOLS (
153 if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
154 if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
155 set TOOL_CHAIN_TAG=VS2013
157 set TOOL_CHAIN_TAG=VS2013x86
160 echo --ERROR: VS2008/VS2010/VS2012/VS2013 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS not defined ^^!
165 echo Ensuring correct build directory is present for GenBiosId...
166 set BUILD_PATH=Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%
168 echo Modifing Conf files for this build...
169 :: Remove lines with these tags from target.txt
170 findstr /V "TARGET TARGET_ARCH TOOL_CHAIN_TAG BUILD_RULE_CONF ACTIVE_PLATFORM MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp
172 echo TARGET = %TARGET% >> Conf\target.txt.tmp
173 if "%Arch%"=="IA32" (
174 echo TARGET_ARCH = IA32 >> Conf\target.txt.tmp
175 ) else if "%Arch%"=="X64" (
176 echo TARGET_ARCH = IA32 X64 >> Conf\target.txt.tmp
178 echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% >> Conf\target.txt.tmp
179 echo BUILD_RULE_CONF = Conf/build_rule.txt >> Conf\target.txt.tmp
181 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc >> Conf\target.txt.tmp
183 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc >> Conf\target.txt.tmp
185 echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads% >> Conf\target.txt.tmp
187 move /Y Conf\target.txt.tmp Conf\target.txt >nul
189 ::**********************************************************************
191 ::**********************************************************************
193 echo Creating BiosId...
194 pushd %PLATFORM_PACKAGE%
195 if not exist ..\%BUILD_PATH%\IA32 mkdir ..\%BUILD_PATH%\IA32
196 GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\IA32\BiosId.bin -ob ..\Conf\BiosId.bat
198 if not exist ..\%BUILD_PATH%\X64 mkdir ..\%BUILD_PATH%\X64
199 GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\X64\BiosId.bin -ob ..\Conf\BiosId.bat
204 if %ERRORLEVEL% NEQ 0 goto BldFail
207 echo Invoking EDK2 build...
210 if %ERRORLEVEL% NEQ 0 goto BldFail
212 ::**********************************************************************
213 :: Post Build processing and cleanup
214 ::**********************************************************************
218 pushd %PLATFORM_PACKAGE%
219 :: Extract Hii data from build and store in HiiDefaultData.txt
220 fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt
222 :: save changes to VlvXXX.fd
223 fce update -i ..\%BUILD_PATH%\FV\Vlv.fd -s ..\%BUILD_PATH%\FV\HiiDefaultData.txt -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd
227 if %ERRORLEVEL% NEQ 0 goto BldFail
228 ::echo FD successfully updated with default Hii values.
230 :: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
231 find /v "#" Conf\BiosId.env > ver_strings
232 for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
233 del /f/q ver_strings >nul
235 set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
236 copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd %WORKSPACE%\%BIOS_Name% >nul
239 echo Build location: %BUILD_PATH%
240 echo BIOS ROM Created: %BIOS_Name%
242 echo -------------------- The EDKII BIOS build has successfully completed. --------------------
248 echo ***************************************************************************
249 echo Build BIOS rom for VLV platforms.
251 echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
253 echo /c CleanAll before building
254 echo /IA32 Set Arch to IA32 (default: X64)
255 echo /X64 Set Arch to X64 (default: X64)
257 echo Platform Types: MNW2
258 echo Build Targets: Debug, Release (default: Debug)
261 echo bld_vlv.bat MNW2 : X64 Debug build for MinnowMax
262 echo bld_vlv.bat /IA32 MNW2 release : IA32 Release build for MinnowMax
264 echo ***************************************************************************
270 echo -- Error: EDKII BIOS Build has failed!
271 echo See EDK2.log for more details