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...
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
146 echo --ERROR: VS2008/VS2010 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS not defined ^^!
151 echo Ensuring correct build directory is present for GenBiosId...
152 set BUILD_PATH=Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%
154 echo Modifing Conf files for this build...
155 :: Remove lines with these tags from target.txt
156 findstr /V "TARGET TARGET_ARCH TOOL_CHAIN_TAG BUILD_RULE_CONF ACTIVE_PLATFORM MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp
158 echo TARGET = %TARGET% >> Conf\target.txt.tmp
159 if "%Arch%"=="IA32" (
160 echo TARGET_ARCH = IA32 >> Conf\target.txt.tmp
161 ) else if "%Arch%"=="X64" (
162 echo TARGET_ARCH = IA32 X64 >> Conf\target.txt.tmp
164 echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% >> Conf\target.txt.tmp
165 echo BUILD_RULE_CONF = Conf/build_rule.txt >> Conf\target.txt.tmp
167 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc >> Conf\target.txt.tmp
169 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc >> Conf\target.txt.tmp
171 echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads% >> Conf\target.txt.tmp
173 move /Y Conf\target.txt.tmp Conf\target.txt >nul
175 ::**********************************************************************
177 ::**********************************************************************
179 echo Creating BiosId...
180 pushd %PLATFORM_PACKAGE%
181 if not exist ..\%BUILD_PATH%\IA32 mkdir ..\%BUILD_PATH%\IA32
182 GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\IA32\BiosId.bin -ob ..\Conf\BiosId.bat
184 if not exist ..\%BUILD_PATH%\X64 mkdir ..\%BUILD_PATH%\X64
185 GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\X64\BiosId.bin -ob ..\Conf\BiosId.bat
190 if %ERRORLEVEL% NEQ 0 goto BldFail
193 echo Invoking EDK2 build...
196 if %ERRORLEVEL% NEQ 0 goto BldFail
198 ::**********************************************************************
199 :: Post Build processing and cleanup
200 ::**********************************************************************
204 pushd %PLATFORM_PACKAGE%
205 :: Extract Hii data from build and store in HiiDefaultData.txt
206 fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt 1>>EDK2.log 2>&1
208 :: copy the Setup variable to the SetupDefault variable and save changes to VlvXXX.fd
209 fce mirror -i ..\%BUILD_PATH%\FV\Vlv.fd -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd Setup SetupDefault 1>>EDK2.log 2>&1
213 if %ERRORLEVEL% NEQ 0 goto BldFail
214 ::echo FD successfully updated with default Hii values.
216 :: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
217 find /v "#" Conf\BiosId.env > ver_strings
218 for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
219 del /f/q ver_strings >nul
221 set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
222 copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd %WORKSPACE%\%BIOS_Name% >nul
225 echo Build location: %BUILD_PATH%
226 echo BIOS ROM Created: %BIOS_Name%
228 echo -------------------- The EDKII BIOS build has successfully completed. --------------------
234 echo ***************************************************************************
235 echo Build BIOS rom for VLV platforms.
237 echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
239 echo /c CleanAll before building
240 echo /IA32 Set Arch to IA32 (default: X64)
241 echo /X64 Set Arch to X64 (default: X64)
243 echo Platform Types: MNW2
244 echo Build Targets: Debug, Release (default: Debug)
247 echo bld_vlv.bat MNW2 : X64 Debug build for MinnowMax
248 echo bld_vlv.bat /IA32 MNW2 release : IA32 Release build for MinnowMax
250 echo ***************************************************************************
256 echo -- Error: EDKII BIOS Build has failed!
257 echo See EDK2.log for more details