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