summaryrefslogtreecommitdiff
path: root/Platform/BroxtonPlatformPkg/BuildIFWI.bat
blob: 838f9b399907b792ee1a1ce0d138034dca5368cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
@echo off
SetLocal EnableDelayedExpansion EnableExtensions

:: Assign initial values
set exitCode=0
set "Build_Flags= "
set Arch=X64
set SkipUsageFlag=FALSE
set FabId=B
set WORKSPACE=%CD%
if %WORKSPACE:~-1%==\ (
  set WORKSPACE=%WORKSPACE:~0,-1%
)
set CORE_PATH=%WORKSPACE%\Core
set PLATFORM_PATH=Platform\BroxtonPlatformPkg
set SILICON_PATH=Silicon\Src\BroxtonSoC
set STITCH_PATH=%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\Stitch

set Minnow_RVP=MINN

:: Parse Optional arguments
:OptLoop
if /i "%~1"=="" goto Usage
if /i "%~1"=="/?" goto Usage

::Build Flags
if /i "%~1"=="/l" (
    set Build_Flags=%Build_Flags% /l
    shift
    goto OptLoop
)
if /i "%~1" == "/c" (
    set Build_Flags=%Build_Flags% /c
    shift
    set SkipUsageFlag=TRUE
    goto OptLoop
)
if /i "%~1"=="/ia32" (
    set Arch=IA32
    set Build_Flags=%Build_Flags% /ia32
    shift
    goto OptLoop
)
if /i "%~1"=="/x64" (
    set Arch=X64
    set Build_Flags=%Build_Flags% /x64
    shift
    goto OptLoop
)

if /i "%~1"=="/vs08" (
    set Build_Flags=%Build_Flags% /vs08
    shift
    goto OptLoop
)
if /i "%~1"=="/vs10" (
    set Build_Flags=%Build_Flags% /vs10
    shift
    goto OptLoop
)
if /i "%~1"=="/vs12" (
    set Build_Flags=%Build_Flags% /vs12
    shift
    goto OptLoop
)
if /i "%~1"=="/vs13" (
    set Build_Flags=%Build_Flags% /vs13
    shift
    goto OptLoop
)
if /i "%~1"=="/vs15" (
    set Build_Flags=%Build_Flags% /vs15
    shift
    goto OptLoop
)
if /i "%~1"=="/FspW" (
    set Build_Flags=%Build_Flags% /FspW
    shift
    goto OptLoop
)
if /i "%~1"=="/A" (
    set FabId=A
    set Build_Flags=%Build_Flags% /A
    shift
    goto OptLoop
)
if /i "%~1"=="/B" (
    set FabId=B
    set Build_Flags=%Build_Flags% /B
    shift
    goto OptLoop
)


:: Require 2 input parameters
if "%~2"=="" (
   echo. & echo -- ERROR: Not Enough Arguments Provided
   echo -- Please review the Help screen "/?" -- & echo.
   goto exit
)

:: Assign required arguments
set Platform_Type=%~1
set Build_Target=%~2

:: Build BIOS
echo ================================================================================
echo Build_IFWI:  Calling BIOS build Script...
echo.

echo - call BuildBios.bat %Build_Flags% %Platform_Type% %Build_Target%
call %WORKSPACE%\%PLATFORM_PATH%\BuildBios.bat %Build_Flags% %Platform_Type% %Build_Target%
if ErrorLevel 1 (
    echo echo  -- Error Building BIOS  & echo.
    set exitCode=1
    goto exit
)

echo ================================================================================
echo.

call Conf\BiosId.bat
echo BIOS_ID=%BIOS_ID%

:: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
find /v "#" Conf\BiosId.env > ver_strings
for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
del /f/q ver_strings >nul

:: Translate Release Build Type
if "%BUILD_TYPE%"=="R" set BUILD_TYPE=R

set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%

:: Start Integration process
echo ================================================================================
echo Build_IFWI:  Calling IFWI Stitching Script...
echo.
echo BIOS ROM input:  %BIOS_Name%
echo.
pushd %STITCH_PATH%
   echo  - call IFWIStitch_Simple.bat %STITCH_PATH%\%BIOS_Name% %FabId%
   call %STITCH_PATH%\IFWIStitch_Simple.bat %STITCH_PATH%\%BIOS_Name% %FabId%
   @echo off
popd
if ErrorLevel 1 (
    echo echo  -- Error Stitching %BIOS_Name% & echo.
    set exitCode=1
)
echo.
echo Build_IFWI is finished.
echo The final IFWI file is located in Stitch\
echo ======================================================================


goto Exit

:Usage
if /i "%SkipUsageFlag%" == "TRUE" goto Exit
echo Script to build BIOS firmware and stitch the entire IFWI.
echo.
echo Usage: BuildIFWI.bat [options] ^<PlatformType^> ^<BuildTarget^>
echo.
echo.    /?       Display this help text
echo     /l       Log a copy of the build output to EDK2.log
echo     /c       CleanAll before building
echo     /FspW    Build FSP and FSP Wrapper
echo     /x64     Set Arch to X64 (default)
echo     /vs08    Set compiler to VisualStudio 2008
echo     /vs10    Set compiler to VisualStudio 2010
echo     /vs12    Set compiler to VisualStudio 2012
echo     /vs13    Set compiler to VisualStudio 2013
echo     /vs15    Set compiler to VisualStudio 2015
echo.
echo     Platform Types:   %Minnow_RVP%
echo     MINN - Minnow (ApolloLake)
echo.
echo     Build Targets:    Release, Debug
echo.
set exitCode=1

:Exit
(
  EndLocal
  set Arch=%Arch%
  exit /b %exitCode%
)