]> git.proxmox.com Git - mirror_edk2.git/blame - Vlv2TbltDevicePkg/bld_vlv.bat
CorebootPayloadPkg: Use extra braces to prevent gcc compile fail
[mirror_edk2.git] / Vlv2TbltDevicePkg / bld_vlv.bat
CommitLineData
3cbfba02
DW
1@REM @file\r
2@REM Windows batch file to build BIOS ROM\r
3@REM\r
4@REM Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
5@REM This program and the accompanying materials\r
6@REM are licensed and made available under the terms and conditions of the BSD License\r
7@REM which accompanies this distribution. The full text of the license may be found at\r
8@REM http://opensource.org/licenses/bsd-license.php\r
9@REM\r
10@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12@REM\r
13\r
14@echo off\r
15setlocal EnableDelayedExpansion EnableExtensions\r
16echo.\r
17echo %date% %time%\r
18echo.\r
19\r
20::**********************************************************************\r
21:: Initial Setup\r
22::**********************************************************************\r
23set WORKSPACE=%CD%\r
24if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%\r
25set /a build_threads=1\r
26set "Build_Flags= "\r
27set exitCode=0\r
28set Arch=X64\r
29set Source=0\r
30\r
31:: Clean up previous build files.\r
32if exist %WORKSPACE%\edk2.log del %WORKSPACE%\edk2.log\r
33if exist %WORKSPACE%\unitool.log del %WORKSPACE%\unitool.log\r
34if exist %WORKSPACE%\Conf\target.txt del %WORKSPACE%\Conf\target.txt\r
35if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt\r
36if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt\r
37if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db\r
38if exist conf\.cache rmdir /q/s conf\.cache\r
39\r
40:: Setup EDK environment. Edksetup puts new copies of target.txt, tools_def.txt, build_rule.txt in WorkSpace\Conf\r
41:: Also run edksetup as soon as possible to avoid it from changing environment variables we're overriding\r
42call edksetup.bat > nul\r
43@echo off\r
44\r
45:: Define platform specific environment variables.\r
46set PLATFORM_PACKAGE=Vlv2TbltDevicePkg\r
47set config_file=.\%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc\r
48set auto_config_inc=.\%PLATFORM_PACKAGE%\AutoPlatformCFG.txt\r
49\r
50set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg\r
51\r
52::create new AutoPlatformCFG.txt file\r
53copy /y nul %auto_config_inc% >nul\r
54\r
55::**********************************************************************\r
56:: Parse command line arguments\r
57::**********************************************************************\r
58\r
59:: Optional arguments\r
60:OptLoop\r
61if /i "%~1"=="/?" goto Usage\r
62\r
63if /i "%~1"=="/l" (\r
64 set Build_Flags=%Build_Flags% -j EDK2.log\r
65 shift\r
66 goto OptLoop\r
67)\r
68if /i "%~1" == "/c" (\r
69 echo Removing previous build files ...\r
70 if exist build (\r
71 del /f/s/q build > null\r
72 rmdir /s/q build\r
73 )\r
74 if exist conf\.cache (\r
75 del /f/s/q conf\.cache > null\r
76 rmdir /s/q conf\.cache\r
77 )\r
78 echo.\r
79 shift\r
80 goto OptLoop\r
81)\r
82\r
83if /i "%~1"=="/x64" (\r
84 set Arch=X64\r
85 shift\r
86 goto OptLoop\r
87)\r
88if /i "%~1"=="/IA32" (\r
89 set Arch=IA32\r
90 shift\r
91 goto OptLoop\r
92)\r
93\r
94:: Required argument(s)\r
95if "%~1"=="" goto Usage\r
96\r
97::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\\r
98if "%Arch%"=="IA32" (\r
99 findstr /b /v "BOARD_ID BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > Conf\BiosId.env\r
100 echo DEFINE X64_CONFIG = FALSE >> %auto_config_inc%\r
101) else if "%Arch%"=="X64" (\r
102 findstr /b /v "BOARD_ID BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > Conf\BiosId.env\r
103 echo DEFINE X64_CONFIG = TRUE >> %auto_config_inc%\r
104)\r
105\r
106:: -- Build flags settings for each Platform --\r
107echo Setting %1 platform configuration and BIOS ID...\r
108if /i "%~1" == "MNW2" (\r
109 echo BOARD_ID = MNW2MAX >> %Conf\BiosId.env\r
110 echo DEFINE ENBDT_PF_BUILD = TRUE >> %auto_config_inc%\r
111 \r
112) else (\r
113 echo Error - Unsupported PlatformType: %1\r
114 goto Usage\r
115)\r
116set Platform_Type=%~1\r
117\r
118if /i "%~2" == "RELEASE" (\r
119 set target=RELEASE\r
120 echo BUILD_TYPE = R >> Conf\BiosId.env\r
121) else (\r
122 set target=DEBUG\r
123 echo BUILD_TYPE = D >> Conf\BiosId.env\r
124)\r
125\r
126::**********************************************************************\r
6e4c9170
BC
127:: Additional EDK Build Setup/Configuration
128::**********************************************************************
129echo.
130echo Setting the Build environment for VS2008/VS2010/VS2012/VS2013...\r
131if 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\" (
3cbfba02
DW
134 set TOOL_CHAIN_TAG=VS2008\r
135 ) else (\r
136 set TOOL_CHAIN_TAG=VS2008x86\r
137 )\r
138 ) else if defined VS100COMNTOOLS (\r
139 if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"\r
140 if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (\r
141 set TOOL_CHAIN_TAG=VS2010\r
6e4c9170
BC
142 ) else (\r
143 set TOOL_CHAIN_TAG=VS2010x86
144 )\r
145) else if defined VS110COMNTOOLS (\r
146 if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"\r
147 if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (\r
148 set TOOL_CHAIN_TAG=VS2012\r
149 ) else (\r
150 set TOOL_CHAIN_TAG=VS2012x86\r
151 )\r
152) else if defined VS120COMNTOOLS (\r
153 if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"\r
154 if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (\r
155 set TOOL_CHAIN_TAG=VS2013\r
156 ) else (\r
157 set TOOL_CHAIN_TAG=VS2013x86\r
158 )\r
159) else (
160 echo --ERROR: VS2008/VS2010/VS2012/VS2013 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS not defined ^^!\r
161 echo.\r
162 goto :BldFail\r
163)
3cbfba02
DW
164\r
165echo Ensuring correct build directory is present for GenBiosId...\r
166set BUILD_PATH=Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\r
167\r
168echo Modifing Conf files for this build...\r
169:: Remove lines with these tags from target.txt\r
170findstr /V "TARGET TARGET_ARCH TOOL_CHAIN_TAG BUILD_RULE_CONF ACTIVE_PLATFORM MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp\r
171\r
172echo TARGET = %TARGET% >> Conf\target.txt.tmp\r
173if "%Arch%"=="IA32" (\r
174 echo TARGET_ARCH = IA32 >> Conf\target.txt.tmp\r
175) else if "%Arch%"=="X64" (\r
176 echo TARGET_ARCH = IA32 X64 >> Conf\target.txt.tmp\r
177)\r
178echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% >> Conf\target.txt.tmp\r
179echo BUILD_RULE_CONF = Conf/build_rule.txt >> Conf\target.txt.tmp\r
180if %Source% == 0 (\r
181 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc >> Conf\target.txt.tmp\r
182) else (\r
183 echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc >> Conf\target.txt.tmp\r
184)\r
185echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads% >> Conf\target.txt.tmp\r
186\r
187move /Y Conf\target.txt.tmp Conf\target.txt >nul\r
188\r
189::**********************************************************************\r
190:: Build BIOS\r
191::**********************************************************************\r
192\r
193echo Creating BiosId...\r
194pushd %PLATFORM_PACKAGE%\r
195if not exist ..\%BUILD_PATH%\IA32 mkdir ..\%BUILD_PATH%\IA32\r
196 GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\IA32\BiosId.bin -ob ..\Conf\BiosId.bat\r
197if "%Arch%"=="X64" (\r
198 if not exist ..\%BUILD_PATH%\X64 mkdir ..\%BUILD_PATH%\X64\r
199 GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\X64\BiosId.bin -ob ..\Conf\BiosId.bat\r
200)\r
201popd\r
202\r
203\r
204if %ERRORLEVEL% NEQ 0 goto BldFail\r
205\r
206echo.\r
207echo Invoking EDK2 build...\r
208build %Build_Flags%\r
209\r
210if %ERRORLEVEL% NEQ 0 goto BldFail\r
211\r
212::**********************************************************************\r
213:: Post Build processing and cleanup\r
214::**********************************************************************\r
215\r
216echo Running fce...\r
217\r
218pushd %PLATFORM_PACKAGE%\r
219:: Extract Hii data from build and store in HiiDefaultData.txt\r
220fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt 1>>EDK2.log 2>&1\r
221\r
222:: copy the Setup variable to the SetupDefault variable and save changes to VlvXXX.fd\r
223fce mirror -i ..\%BUILD_PATH%\FV\Vlv.fd -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd Setup SetupDefault 1>>EDK2.log 2>&1\r
224\r
225popd\r
226\r
227if %ERRORLEVEL% NEQ 0 goto BldFail\r
228::echo FD successfully updated with default Hii values.\r
229\r
230:: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables\r
231find /v "#" Conf\BiosId.env > ver_strings\r
232for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j\r
233del /f/q ver_strings >nul\r
234\r
235set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM\r
236copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd %WORKSPACE%\%BIOS_Name% >nul\r
237\r
238echo.\r
239echo Build location: %BUILD_PATH%\r
240echo BIOS ROM Created: %BIOS_Name%\r
241echo.\r
242echo -------------------- The EDKII BIOS build has successfully completed. --------------------\r
243echo.\r
244goto Exit\r
245\r
246:Usage\r
247echo.\r
248echo ***************************************************************************\r
249echo Build BIOS rom for VLV platforms.\r
250echo.\r
251echo Usage: bld_vlv.bat [options] PlatformType [Build Target]\r
252echo.\r
253echo /c CleanAll before building\r
254echo /IA32 Set Arch to IA32 (default: X64)\r
255echo /X64 Set Arch to X64 (default: X64)\r
256echo.\r
257echo Platform Types: MNW2\r
258echo Build Targets: Debug, Release (default: Debug)\r
259echo.\r
260echo Examples:\r
261echo bld_vlv.bat MNW2 : X64 Debug build for MinnowMax\r
262echo bld_vlv.bat /IA32 MNW2 release : IA32 Release build for MinnowMax\r
263echo.\r
264echo ***************************************************************************\r
265set exitCode=1\r
266goto Exit\r
267\r
268:BldFail\r
269set exitCode=1\r
270echo -- Error: EDKII BIOS Build has failed!\r
271echo See EDK2.log for more details\r
272\r
273:Exit\r
274echo %date% %time%\r
275exit /b %exitCode%\r
276\r
277EndLocal\r