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