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