]>
Commit | Line | Data |
---|---|---|
3cbfba02 DW |
1 | ##********************************************************************** |
2 | ## Function define | |
3 | ##********************************************************************** | |
4 | function Usage() { | |
5 | echo | |
6 | echo "***************************************************************************" | |
7 | echo "Build BIOS rom for VLV platforms." | |
8 | echo | |
9 | echo "Usage: bld_vlv.bat PlatformType [Build Target]" | |
10 | echo | |
11 | echo | |
12 | echo " Platform Types: MNW2" | |
13 | echo " Build Targets: Debug, Release (default: Debug)" | |
14 | echo | |
15 | echo "***************************************************************************" | |
16 | echo "Press any key......" | |
17 | read | |
18 | exit 0 | |
19 | } | |
20 | ||
21 | ||
22 | echo -e $(date) | |
23 | ##********************************************************************** | |
24 | ## Initial Setup | |
25 | ##********************************************************************** | |
26 | #WORKSPACE=$(pwd) | |
27 | #build_threads=($NUMBER_OF_PROCESSORS)+1 | |
28 | Build_Flags= | |
29 | exitCode=0 | |
30 | Arch=X64 | |
31 | ||
32 | ## Clean up previous build files. | |
33 | if [ -e $(pwd)/EDK2.log ]; then | |
34 | rm $(pwd)/EDK2.log | |
35 | fi | |
36 | ||
37 | if [ -e $(pwd)/Unitool.log ]; then | |
38 | rm $(pwd)/Unitool.log | |
39 | fi | |
40 | ||
41 | if [ -e $(pwd)/Conf/target.txt ]; then | |
42 | rm $(pwd)/Conf/target.txt | |
43 | fi | |
44 | ||
45 | if [ -e $(pwd)/Conf/BiosId.env ]; then | |
46 | rm $(pwd)/Conf/BiosId.env | |
47 | fi | |
48 | ||
49 | if [ -e $(pwd)/Conf/tools_def.txt ]; then | |
50 | rm $(pwd)/Conf/tools_def.txt | |
51 | fi | |
52 | ||
53 | if [ -e $(pwd)/Conf/build_rule.txt ]; then | |
54 | rm $(pwd)/Conf/build_rule.txt | |
55 | fi | |
56 | ||
57 | ||
58 | ## Setup EDK environment. Edksetup puts new copies of target.txt, tools_def.txt, build_rule.txt in WorkSpace\Conf | |
59 | ## Also run edksetup as soon as possible to avoid it from changing environment variables we're overriding | |
bfed5d80 | 60 | . edksetup.sh BaseTools |
3cbfba02 DW |
61 | make -C BaseTools |
62 | ||
63 | ## Define platform specific environment variables. | |
64 | PLATFORM_PACKAGE=Vlv2TbltDevicePkg | |
65 | config_file=$WORKSPACE/$PLATFORM_PACKAGE/PlatformPkgConfig.dsc | |
66 | auto_config_inc=$WORKSPACE/$PLATFORM_PACKAGE/AutoPlatformCFG.txt | |
67 | ||
68 | ## default ECP (override with /ECP flag) | |
69 | EDK_SOURCE=$WORKSPACE/EdkCompatibilityPkg | |
70 | ||
71 | ## create new AutoPlatformCFG.txt file | |
72 | if [ -f "$auto_config_inc" ]; then | |
73 | rm $auto_config_inc | |
74 | fi | |
75 | touch $auto_config_inc | |
76 | ||
77 | ##********************************************************************** | |
78 | ## Parse command line arguments | |
79 | ##********************************************************************** | |
80 | ||
81 | ## Optional arguments | |
82 | for (( i=1; i<=$#; )) | |
83 | do | |
84 | if [ "$1" == "/?" ]; then | |
85 | Usage | |
86 | elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/Q" ]; then | |
87 | Build_Flags="$Build_Flags --quiet" | |
88 | shift | |
89 | elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/L" ]; then | |
90 | Build_Flags="$Build_Flags -j EKD2.log" | |
91 | shift | |
92 | elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/C" ]; then | |
93 | echo Removing previous build files ... | |
94 | if [ -d "Build" ]; then | |
95 | rm -r Build | |
96 | fi | |
97 | shift | |
98 | elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/ECP" ]; then | |
99 | ECP_SOURCE=$WORKSPACE/EdkCompatibilityPkgEcp | |
100 | EDK_SOURCE=$WORKSPACE/EdkCompatibilityPkgEcp | |
101 | echo DEFINE ECP_BUILD_ENABLE = TRUE >> $auto_config_inc | |
102 | shift | |
103 | elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/X64" ]; then | |
104 | Arch=X64 | |
105 | shift | |
106 | else | |
107 | break | |
108 | fi | |
109 | done | |
110 | ||
111 | ||
112 | ||
113 | ||
114 | ||
115 | ## Required argument(s) | |
116 | if [ "$2" == "" ]; then | |
117 | Usage | |
118 | fi | |
119 | ||
120 | ## Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf | |
121 | if [ $Arch == "IA32" ]; then | |
122 | cp $PLATFORM_PACKAGE/BiosIdR.env Conf/BiosId.env | |
123 | echo DEFINE X64_CONFIG = FALSE >> $auto_config_inc | |
124 | else | |
125 | cp $PLATFORM_PACKAGE/BiosIdx64R.env Conf/BiosId.env | |
126 | echo DEFINE X64_CONFIG = TRUE >> $auto_config_inc | |
127 | fi | |
128 | sed -i '/^BOARD_ID/d' Conf/BiosId.env | |
129 | sed -i '/^BUILD_TYPE/d' Conf/BiosId.env | |
130 | ||
131 | ||
132 | ||
133 | ## -- Build flags settings for each Platform -- | |
134 | ## AlpineValley (ALPV): SVP_PF_BUILD = TRUE, ENBDT_PF_BUILD = FALSE, TABLET_PF_BUILD = FALSE, BYTI_PF_BUILD = FALSE, IVI_PF_BUILD = FALSE | |
135 | ## BayleyBay (BBAY): SVP_PF_BUILD = FALSE, ENBDT_PF_BUILD = TRUE, TABLET_PF_BUILD = FALSE, BYTI_PF_BUILD = FALSE, IVI_PF_BUILD = FALSE | |
136 | ## BayLake (BLAK): SVP_PF_BUILD = FALSE, ENBDT_PF_BUILD = FALSE, TABLET_PF_BUILD = TRUE, BYTI_PF_BUILD = FALSE, IVI_PF_BUILD = FALSE | |
137 | ## Bakersport (BYTI): SVP_PF_BUILD = FALSE, ENBDT_PF_BUILD = FALSE, TABLET_PF_BUILD = FALSE, BYTI_PF_BUILD = TRUE, IVI_PF_BUILD = FALSE | |
138 | ## Crestview Hills (CVHS): SVP_PF_BUILD = FALSE, ENBDT_PF_BUILD = FALSE, TABLET_PF_BUILD = FALSE, BYTI_PF_BUILD = TRUE, IVI_PF_BUILD = TRUE | |
139 | ## FFD8 (BLAK): SVP_PF_BUILD = FALSE, ENBDT_PF_BUILD = FALSE, TABLET_PF_BUILD = TRUE, BYTI_PF_BUILD = FALSE, IVI_PF_BUILD = FALSE | |
140 | echo "Setting $1 platform configuration and BIOS ID..." | |
141 | if [ "$(echo $1 | tr 'a-z' 'A-Z')" == "MNW2" ]; then | |
142 | echo BOARD_ID = MNW2MAX >> Conf/BiosId.env | |
143 | echo DEFINE ENBDT_PF_BUILD = TRUE >> $auto_config_inc | |
144 | else | |
145 | echo "Error - Unsupported PlatformType: $1" | |
146 | Usage | |
147 | fi | |
148 | ||
149 | Platform_Type=$1 | |
150 | ||
151 | if [ "$(echo $2 | tr 'a-z' 'A-Z')" == "RELEASE" ]; then | |
152 | TARGET=RELEASE | |
153 | BUILD_TYPE=R | |
154 | echo BUILD_TYPE = R >> Conf/BiosId.env | |
155 | else | |
156 | TARGET=DEBUG | |
157 | BUILD_TYPE=D | |
158 | echo BUILD_TYPE = D >> Conf/BiosId.env | |
159 | fi | |
160 | ||
161 | ||
162 | ##********************************************************************** | |
163 | ## Additional EDK Build Setup/Configuration | |
164 | ##********************************************************************** | |
165 | echo "Ensuring correct build directory is present for GenBiosId..." | |
166 | ||
167 | echo Modifing Conf files for this build... | |
168 | ## Remove lines with these tags from target.txt | |
169 | sed -i '/^ACTIVE_PLATFORM/d' Conf/target.txt | |
170 | sed -i '/^TARGET /d' Conf/target.txt | |
171 | sed -i '/^TARGET_ARCH/d' Conf/target.txt | |
172 | sed -i '/^TOOL_CHAIN_TAG/d' Conf/target.txt | |
173 | sed -i '/^MAX_CONCURRENT_THREAD_NUMBER/d' Conf/target.txt | |
174 | ||
175 | ACTIVE_PLATFORM=$PLATFORM_PACKAGE/PlatformPkgGcc"$Arch".dsc | |
176 | TOOL_CHAIN_TAG=GCC46 | |
177 | MAX_CONCURRENT_THREAD_NUMBER=1 | |
178 | echo ACTIVE_PLATFORM = $ACTIVE_PLATFORM >> Conf/target.txt | |
179 | echo TARGET = $TARGET >> Conf/target.txt | |
180 | echo TOOL_CHAIN_TAG = $TOOL_CHAIN_TAG >> Conf/target.txt | |
181 | echo MAX_CONCURRENT_THREAD_NUMBER = $MAX_CONCURRENT_THREAD_NUMBER >> Conf/target.txt | |
182 | if [ $Arch == "IA32" ]; then | |
183 | echo TARGET_ARCH = IA32 >> Conf/target.txt | |
184 | else | |
185 | echo TARGET_ARCH = IA32 X64 >> Conf/target.txt | |
186 | fi | |
187 | ||
188 | ##********************************************************************** | |
189 | ## Build BIOS | |
190 | ##********************************************************************** | |
191 | echo Skip "Running UniTool..." | |
192 | echo "Make GenBiosId Tool..." | |
193 | BUILD_PATH=Build/$PLATFORM_PACKAGE/"$TARGET"_"$TOOL_CHAIN_TAG" | |
194 | if [ ! -d "$BUILD_PATH/$Arch" ]; then | |
195 | mkdir -p $BUILD_PATH/$Arch | |
196 | fi | |
197 | if [ -e "$BUILD_PATH/$Arch/BiosId.bin" ]; then | |
198 | rm -f $BUILD_PATH/$Arch/BiosId.bin | |
199 | fi | |
200 | ||
201 | ||
202 | ./$PLATFORM_PACKAGE/GenBiosId -i Conf/BiosId.env -o $BUILD_PATH/$Arch/BiosId.bin | |
203 | ||
204 | ||
205 | echo "Invoking EDK2 build..." | |
206 | build | |
207 | ||
208 | ||
209 | ##********************************************************************** | |
210 | ## Post Build processing and cleanup | |
211 | ##********************************************************************** | |
212 | ||
213 | echo Skip "Running fce..." | |
214 | ||
215 | echo Skip "Running KeyEnroll..." | |
216 | ||
217 | ## Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables | |
218 | VERSION_MAJOR=$(grep '^VERSION_MAJOR' Conf/BiosId.env | cut -d ' ' -f 3 | cut -c 1-4) | |
219 | VERSION_MINOR=$(grep '^VERSION_MINOR' Conf/BiosId.env | cut -d ' ' -f 3 | cut -c 1-2) | |
220 | BOARD_ID=$(grep '^BOARD_ID' Conf/BiosId.env | cut -d ' ' -f 3 | cut -c 1-7) | |
221 | BIOS_Name="$BOARD_ID"_"$Arch"_"$BUILD_TYPE"_"$VERSION_MAJOR"_"$VERSION_MINOR".ROM | |
222 | BIOS_ID="$BOARD_ID"_"$Arch"_"$BUILD_TYPE"_"$VERSION_MAJOR"_"$VERSION_MINOR"_GCC.bin | |
223 | cp -f $BUILD_PATH/FV/VLV.fd $WORKSPACE/$BIOS_Name | |
224 | SEC_VERSION=1.0.2.1060v5 | |
225 | cat ./$PLATFORM_PACKAGE/Stitch/IFWIHeader/IFWI_HEADER.bin ./Vlv2MiscBinariesPkg/SEC/$SEC_VERSION/VLV_SEC_REGION.bin ./$PLATFORM_PACKAGE/Stitch/IFWIHeader/Vacant.bin $BIOS_Name > ./$PLATFORM_PACKAGE/Stitch/$BIOS_ID | |
226 | ||
227 | ||
228 | echo Skip "Running BIOS_Signing ..." | |
229 | ||
230 | echo | |
231 | echo Build location: $BUILD_PATH | |
232 | echo BIOS ROM Created: $BIOS_Name | |
233 | echo | |
234 | echo -------------------- The EDKII BIOS build has successfully completed. -------------------- | |
235 | echo |