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