Vlv2TbltDevicePkg: Add /m flag for multi-processor build
[mirror_edk2.git] / Vlv2TbltDevicePkg / Build_IFWI.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
15\r
16SetLocal EnableDelayedExpansion EnableExtensions\r
17\r
18@REM Go to root directory of the codebase.\r
19cd ..\r
20\r
21:: Assign initial values\r
22set exitCode=0\r
23set "Build_Flags= "\r
24set "Stitch_Flags= "\r
25set Arch=X64\r
26set PLATFORM_PACKAGE=Vlv2TbltDevicePkg\r
27set ROOT_DIR=%CD%\r
28\r
29:: Parse Optional arguments\r
30:OptLoop\r
31if /i "%~1"=="/?" goto Usage\r
32\r
33if /i "%~1"=="/q" (\r
34 set Build_Flags=%Build_Flags% /q\r
35 shift\r
36 goto OptLoop\r
37)\r
38if /i "%~1"=="/l" (\r
39 set Build_Flags=%Build_Flags% /l\r
40 shift\r
41 goto OptLoop\r
42)\r
eafde7a2
MK
43if /i "%~1"=="/y" (\r
44 set Build_Flags=%Build_Flags% /y\r
45 shift\r
46 goto OptLoop\r
47)\r
eae631bc
MK
48if /i "%~1"=="/m" (\r
49 set Build_Flags=%Build_Flags% /m\r
50 shift\r
51 goto OptLoop\r
52)\r
3cbfba02
DW
53if /i "%~1" == "/c" (\r
54 set Build_Flags=%Build_Flags% /c\r
55 shift\r
56 goto OptLoop\r
57)\r
58if /i "%~1" == "/ECP" (\r
59 set Build_Flags=%Build_Flags% /ecp\r
60 shift\r
61 goto OptLoop\r
62)\r
63\r
64if /i "%~1"=="/s" (\r
65 set Build_Flags=%Build_Flags% /s\r
66 shift\r
67 goto OptLoop\r
68)\r
69\r
70if /i "%~1"=="/x64" (\r
71 set Arch=X64\r
72 set Build_Flags=%Build_Flags% /x64\r
73 shift\r
74 goto OptLoop\r
75)\r
76\r
77if /i "%~1"=="/IA32" (\r
78 set Arch=IA32\r
79 set Build_Flags=%Build_Flags% /IA32\r
80 shift\r
81 goto OptLoop\r
82)\r
83\r
84if /i "%~1"=="/nG" (\r
85 set Stitch_Flags=%Stitch_Flags% /nG\r
86 shift\r
87 goto OptLoop\r
88)\r
89if /i "%~1"=="/nM" (\r
90 set Stitch_Flags=%Stitch_Flags% /nM\r
91 shift\r
92 goto OptLoop\r
93)\r
94if /i "%~1"=="/nB" (\r
95 set Stitch_Flags=%Stitch_Flags% /nB\r
96 shift\r
97 goto OptLoop\r
98)\r
83586b5d
TH
99if /i "%~1"=="/yL" (\r
100 set Stitch_Flags=%Stitch_Flags% /yL\r
101 shift\r
102 goto OptLoop\r
103)\r
104\r
3cbfba02
DW
105\r
106:: Require 2 input parameters\r
107if "%~2"=="" goto Usage\r
108\r
109:: Assign required arguments\r
110set Platform_Type=%~1\r
111set Build_Target=%~2\r
83586b5d 112\r
3cbfba02
DW
113if "%~3"=="" (\r
114 set "IFWI_Suffix= "\r
115) else set "IFWI_Suffix=/S %~3"\r
116\r
117:: Build BIOS\r
118echo ======================================================================\r
119echo Build_IFWI: Calling BIOS build Script...\r
120if "%Platform_Type%" == "BYTC" (\r
121 call %PLATFORM_PACKAGE%\bld_vlv_cr.bat %Build_Flags% %Platform_Type% %Build_Target%\r
122 \r
123) else (\r
124 call %PLATFORM_PACKAGE%\bld_vlv.bat %Build_Flags% %Platform_Type% %Build_Target%\r
125)\r
126if %ERRORLEVEL% NEQ 0 (\r
127 echo echo -- Error Building BIOS & echo.\r
128 set exitCode=1\r
129 goto exit\r
130)\r
131echo.\r
132echo Finished Building BIOS.\r
133@REM Set BIOS_ID environment variable here.\r
134call Conf\BiosId.bat\r
135echo BIOS_ID=%BIOS_ID%\r
136\r
137:: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables\r
138find /v "#" Conf\BiosId.env > ver_strings\r
139for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j\r
140del /f/q ver_strings >nul\r
141set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM\r
142\r
143:: Start Integration process\r
144echo ======================================================================\r
145echo Build_IFWI: Calling IFWI Stitching Script...\r
146if "%Platform_Type%" == "BYTC" (\r
147 pushd %PLATFORM_PACKAGE%\Stitch_CR\r
148) else (\r
149 pushd %PLATFORM_PACKAGE%\Stitch\r
150)\r
151 :: IFWIStitch.bat [/nG] [/nM] [/nB] [/B BIOS.rom] [/C StitchConfig] [/S IFWISuffix]\r
152 call IFWIStitch.bat %Stitch_Flags% /B ..\..\%BIOS_Name% %IFWI_Suffix%\r
153 \r
154 @echo off\r
155popd\r
156if %ERRORLEVEL% NEQ 0 (\r
157 echo echo -- Error Stitching %BIOS_Nam% & echo.\r
158 set exitCode=1\r
159)\r
160echo.\r
161echo Build_IFWI is finished.\r
162echo The final IFWI file is located in %ROOT_DIR%\Vlv2TbltDevicePkg\Stitch\\r
163echo ======================================================================\r
164goto Exit\r
165\r
166:Usage\r
167echo Script to build BIOS firmware and stitch the entire IFWI.\r
168echo.\r
169echo Usage: Build_IFWI.bat [options] PlatformType BuildTarget [IFWI Suffix]\r
170echo.\r
3cbfba02 171echo /c CleanAll before building\r
3cbfba02
DW
172echo /x64 Set Arch to X64 (default: X64)\r
173echo /IA32 Set Arch to IA32 (default: X64)\r
83586b5d 174echo /yL Enable SPI lock\r
3cbfba02
DW
175echo. \r
176echo Platform Types: MNW2\r
177echo Build Targets: Release, Debug\r
178echo IFWI Suffix: Suffix to append to end of IFWI filename (default: MM_DD_YYYY)\r
179echo.\r
180echo See Stitch/Stitch_Config.txt for additional stitching settings.\r
181echo.\r
008e2ccf
JY
182echo If capsule update is needed, please update CAPSULE_ENABLE = TRUE in Config.dsc.\r
183echo If recovery is needed, please update RECOVERY_ENABLE = TRUE in Config.dsc.\r
184echo If either of above is TRUE, please set OPENSSL_PATH in windows evironment\r
185echo and put openssl.exe there, to generate final capsule image.\r
186echo.\r
3cbfba02
DW
187set exitCode=1\r
188\r
189:Exit\r
190@REM CD to platform package.\r
191cd %ROOT_DIR%\Vlv2TbltDevicePkg\r
192exit /b %exitCode%\r
193\r
194EndLocal\r