]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/bldX64.bat
ArmVirtualizationPkg: PlatformIntelBdsLib: detect consoles dynamically
[mirror_edk2.git] / Vlv2TbltDevicePkg / bldX64.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 @echo.
16 @time /t
17
18 @if exist %WORKSPACE%\edk2.log del %WORKSPACE%\edk2.log
19 @if exist %WORKSPACE%\unitool.log del %WORKSPACE%\unitool.log
20 @if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt
21 @if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db
22 @if exist %WORKSPACE%\Conf\target.txt del %WORKSPACE%\Conf\target.txt
23 @if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt
24 @if exist conf\.cache rmdir /q /s conf\.cache
25
26 @set target=DEBUG
27
28 @if /i "%1" == "release" set TARGET=RELEASE
29 @if /i "%2" == "release" set TARGET=RELEASE
30 @if /i "%3" == "release" set TARGET=RELEASE
31 @if /i "%4" == "release" set TARGET=RELEASE
32 @if /i "%5" == "release" set TARGET=RELEASE
33
34 @set PlatformType=NO_PLATFORM
35 @set config_file=.\Vlv2TbltDevicePkg\PlatformPkgConfig.dsc
36 @set EVN_debug_file=.\Vlv2TbltDevicePkg\BiosIdx64D.env
37 @set EVN_release_file=.\Vlv2TbltDevicePkg\BiosIdx64R.env
38 @set auto_config_inc=.\Vlv2TbltDevicePkg\AutoPlatformCFG.txt
39
40 @if "%1" == "MNW2" (
41 set %PlatformType% = MNW2
42 @echo Setting Baley Bay platform configration and BIOS ID ...
43 findstr /b /v BOARD_ID %EVN_debug_file% > newfile.env
44 echo BOARD_ID = MNW2MAX >> newfile.env
45 type newfile.env > %EVN_debug_file%
46 findstr /b /v BOARD_ID %EVN_release_file% > newfile.env
47 echo BOARD_ID = MNW2MAX >> newfile.env
48 type newfile.env > %EVN_release_file%
49 echo DEFINE ENBDT_PF_BUILD = TRUE >> %auto_config_inc%
50 echo DEFINE X64_CONFIG = TRUE >> %auto_config_inc%
51 goto PLATFORM_SETTING_DONE
52 )
53
54 @if "%PlatformType%" == "NO_PLATFORM" (
55 goto BldFail
56 )
57
58 rem clearup the temp file
59 :PLATFORM_SETTING_DONE
60 @DEL NEWFILE.ENV
61 @DEL NEWFILE.CFG
62
63 @REM Define platform specific environment variables.
64 @REM
65 @set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
66 @set SCRIPT_ERROR=0
67
68 @REM Set basic environment.
69 @echo.
70 @echo Run edksetup.bat batch file.
71 @echo.
72 @del Conf\build_rule.txt
73 @REM @del Conf\tools_def.txt
74 @call edksetup.bat
75
76
77 @echo.
78 @echo Set the VS2008 environment.
79 @echo.
80 @if defined VS90COMNTOOLS (
81 if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
82 if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
83 set TOOL_CHAIN_TAG=VS2008
84 ) else (
85 set TOOL_CHAIN_TAG=VS2008x86
86 )
87 ) else (
88 echo.
89 echo !!! ERROR !!! VS2008 not installed correctly. VS90COMNTOOLS not defined. !!!
90 echo.
91 set SCRIPT_ERROR=1
92 goto :BldEnd
93 )
94
95 @echo.
96 @echo Set build environment.
97 @echo.
98 @if not exist Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG% (
99 mkdir Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%
100 )
101
102
103 @REM Set clean build option
104 @set CLEAN_BUILD_OPTION=-e
105
106 @findstr /V "ACTIVE_PLATFORM TARGET TARGET_ARCH TOOL_CHAIN_TAG BUILD_RULE_CONF" Conf\target.txt > Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\target.txt
107
108 @echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkgX64.dsc >> Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\target.txt
109 @echo TARGET = %TARGET% >> Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\target.txt
110 @echo TARGET_ARCH = IA32 X64 >> Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\target.txt
111 @echo TOOL_CHAIN_TAG = %TOOL_CHAIN_TAG% >> Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\target.txt
112 @echo BUILD_RULE_CONF = Conf/build_rule.txt >> Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\target.txt
113 @move /Y Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\target.txt Conf
114
115
116
117 @echo.
118 @echo Create BiosIdx64.
119 @echo.
120 @if not exist Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\X64 (
121 mkdir Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\X64
122 )
123
124 @if "%TARGET%" == "DEBUG" (
125 set BIOS_ID_FILE=BiosIdx64D.env
126
127 ) else (
128 set BIOS_ID_FILE=BiosIdx64R.env
129
130 )
131
132
133 GenBiosId.exe -i %PLATFORM_PACKAGE%\%BIOS_ID_FILE% -o Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\X64\BiosId.bin
134 @if %ERRORLEVEL% NEQ 0 goto BldFail
135
136 @echo off
137 echo Copy reference code ASL files.
138
139
140 @if /i "/s" == "%1" goto BldSilent
141 @if /i "/s" == "%2" goto BldSilent
142 @if /i "/s" == "%3" goto BldSilent
143 @if /i "/s" == "%4" goto BldSilent
144 @if /i "/s" == "%5" goto BldSilent
145
146 build -n %NUMBER_OF_PROCESSORS%
147 @if %ERRORLEVEL% NEQ 0 goto BldFail
148
149 @If %SCRIPT_ERROR% EQU 1 goto BldFail
150 @goto BldSuccess
151
152 :BldSilent
153
154 build -n %NUMBER_OF_PROCESSORS% 1>>EDK2.log 2>&1
155 @if %ERRORLEVEL% NEQ 0 goto BldFail
156
157
158 @If %SCRIPT_ERROR% EQU 1 goto BldFail
159
160 :BldSuccess
161 @echo off
162 del Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\VlvX64.beforeconfig.fd 1>>EDK2.log 2>&1
163 del Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\HiiDefaultData.txt 1>>EDK2.log 2>&1
164 copy /y Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\Vlv.fd Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\VlvX64.beforeconfig.fd 1>>EDK2.log 2>&1
165
166 @echo.
167 @echo Extract setup default value from VFR (Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\HiiDefaultData.txt)
168 @echo.
169 fce read -i Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\VlvX64.beforeconfig.fd > Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\HiiDefaultData.txt
170
171
172 @echo Update FD with default Hii value successfully! (both 'Setup' and 'SetupDefault')
173 @echo.
174 fce mirror -i Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\VlvX64.beforeconfig.fd -o Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\VlvX64.fd Setup SetupDefault 1>>EDK2.log 2>&1
175
176 @echo off
177 del Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\Vlv.fd
178 del Vlv2TbltDevicePkg\RomImage\bios.rom
179 if not exist Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\ROM goto Gen8MImage
180 del /q /f Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\ROM\*
181 rd /Q Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\ROM
182 :Gen8MImage
183
184 copy /b Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV\VlvX64.fd Vlv2TbltDevicePkg\RomImage\bios.rom
185
186 pushd Vlv2TbltDevicePkg\RomImage\
187 @if "%TARGET%" == "DEBUG" (
188 call signbiosX64_debug.bat
189 ) else (
190 call signbiosX64_release.bat
191 )
192
193 call ftoolbuild.bat
194 call ftoolbuild_sec_enable.bat
195 popd
196
197 @echo off
198 mkdir Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\ROM
199 move Vlv2TbltDevicePkg\RomImage\SPI_Image\* Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\ROM\ > NUL
200
201 call GenBIOS.bat X64
202
203 @echo on
204
205 @echo TARGET: %TARGET%
206 @echo TOOL_CHAIN_TAG: %TOOL_CHAIN_TAG%
207 @echo BIOS location: Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\FV
208 @echo SPI Images location: Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%\ROM
209 @echo.
210 @echo The EDKII BIOS build has successfully completed!
211 @echo.
212 @goto BldEnd
213
214 :BldFail
215 @echo.
216 @echo The EDKII BIOS Build has failed!
217 @echo.
218 exit /b 1
219
220 :BldEnd
221 @time /t
222 exit /b 0