]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/Build_IFWI.bat
NetworkPkg: Replace BSD License with BSD+Patent License
[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 - 2018, 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 work space directory.
19 cd ..
20 cd ..
21
22 :: Assign initial values
23 set exitCode=0
24 set "Build_Flags= "
25 set "Stitch_Flags= "
26 set Arch=X64
27 set WORKSPACE=%CD%
28 set CORE_PATH=%WORKSPACE%\edk2
29 set PLATFORM_PATH=%WORKSPACE%\edk2
30 set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
31
32 :: Parse Optional arguments
33 :OptLoop
34 if /i "%~1"=="/?" goto Usage
35
36 if /i "%~1"=="/q" (
37 set Build_Flags=%Build_Flags% /q
38 shift
39 goto OptLoop
40 )
41 if /i "%~1"=="/l" (
42 set Build_Flags=%Build_Flags% /l
43 shift
44 goto OptLoop
45 )
46 if /i "%~1"=="/y" (
47 set Build_Flags=%Build_Flags% /y
48 shift
49 goto OptLoop
50 )
51 if /i "%~1"=="/m" (
52 set Build_Flags=%Build_Flags% /m
53 shift
54 goto OptLoop
55 )
56 if /i "%~1" == "/c" (
57 set Build_Flags=%Build_Flags% /c
58 shift
59 goto OptLoop
60 )
61 if /i "%~1" == "/ECP" (
62 set Build_Flags=%Build_Flags% /ecp
63 shift
64 goto OptLoop
65 )
66
67 if /i "%~1"=="/s" (
68 set Build_Flags=%Build_Flags% /s
69 shift
70 goto OptLoop
71 )
72
73 if /i "%~1"=="/x64" (
74 set Arch=X64
75 set Build_Flags=%Build_Flags% /x64
76 shift
77 goto OptLoop
78 )
79
80 if /i "%~1"=="/IA32" (
81 set Arch=IA32
82 set Build_Flags=%Build_Flags% /IA32
83 shift
84 goto OptLoop
85 )
86
87 if /i "%~1"=="/nG" (
88 set Stitch_Flags=%Stitch_Flags% /nG
89 shift
90 goto OptLoop
91 )
92 if /i "%~1"=="/nM" (
93 set Stitch_Flags=%Stitch_Flags% /nM
94 shift
95 goto OptLoop
96 )
97 if /i "%~1"=="/nB" (
98 set Stitch_Flags=%Stitch_Flags% /nB
99 shift
100 goto OptLoop
101 )
102 if /i "%~1"=="/yL" (
103 set Stitch_Flags=%Stitch_Flags% /yL
104 shift
105 goto OptLoop
106 )
107
108
109 :: Require 2 input parameters
110 if "%~2"=="" goto Usage
111
112 :: Assign required arguments
113 set Platform_Type=%~1
114 set Build_Target=%~2
115
116 if "%~3"=="" (
117 set "IFWI_Suffix= "
118 ) else set "IFWI_Suffix=/S %~3"
119
120 :: Build BIOS
121 echo ======================================================================
122 echo Build_IFWI: Calling BIOS build Script...
123
124 call %PLATFORM_PATH%\%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 %CORE_PATH%\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 "#" %CORE_PATH%\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 pushd %CORE_PATH%\%PLATFORM_PACKAGE%\Stitch
147
148 :: IFWIStitch.bat [/nG] [/nM] [/nB] [/B BIOS.rom] [/C StitchConfig] [/S IFWISuffix]
149 call IFWIStitch.bat %Stitch_Flags% /B ..\..\%BIOS_Name% %IFWI_Suffix%
150
151 @echo off
152 popd
153 if %ERRORLEVEL% NEQ 0 (
154 echo echo -- Error Stitching %BIOS_Nam% & echo.
155 set exitCode=1
156 )
157 echo.
158 echo Build_IFWI is finished.
159 echo The final IFWI file is located in %ROOT_DIR%\Vlv2TbltDevicePkg\Stitch\
160 echo ======================================================================
161 goto Exit
162
163 :Usage
164 echo Script to build BIOS firmware and stitch the entire IFWI.
165 echo.
166 echo Usage: Build_IFWI.bat [options] PlatformType BuildTarget [IFWI Suffix]
167 echo.
168 echo /c CleanAll before building
169 echo /x64 Set Arch to X64 (default: X64)
170 echo /IA32 Set Arch to IA32 (default: X64)
171 echo /yL Enable SPI lock
172 echo.
173 echo Platform Types: MNW2
174 echo Build Targets: Release, Debug
175 echo IFWI Suffix: Suffix to append to end of IFWI filename (default: MM_DD_YYYY)
176 echo.
177 echo See Stitch/Stitch_Config.txt for additional stitching settings.
178 echo.
179 echo If capsule update is needed, please update CAPSULE_ENABLE = TRUE in Config.dsc.
180 echo If recovery is needed, please update RECOVERY_ENABLE = TRUE in Config.dsc.
181 echo If either of above is TRUE, please set OPENSSL_PATH in windows evironment
182 echo and put openssl.exe there, to generate final capsule image.
183 echo.
184 set exitCode=1
185
186 :Exit
187 @REM CD to platform package.
188 cd %PLATFORM_PATH%
189 exit /b %exitCode%
190
191 EndLocal