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