blob: 092b0e4b409b530655df543b59b1dfb655a1eccb [file] [log] [blame]
Xiaobo Gu059502e2017-01-12 21:20:39 +08001#!/bin/bash
2#
3# author: xiaobo.gu@amlogic.com
4# 2016.09.28
5# 2016.12.01-2016.12.20 Update for bootloader repo
Xiaobo Gu9dd3f3f2017-05-26 17:58:57 +08006# 2017.05.20-2017.05.26 Update for txlx and ATF1.3
Xiaobo Gu059502e2017-01-12 21:20:39 +08007
Xiaobo Gu9dd3f3f2017-05-26 17:58:57 +08008# include compile check script
9source fip/check_compile.sh
xiaobo gue6c46862018-01-10 18:58:09 +080010source fip/variables.sh
11source fip/lib.sh
12source fip/build_bl2.sh
13source fip/build_bl30.sh
14source fip/build_bl31.sh
15source fip/build_bl32.sh
16source fip/build_bl33.sh
17source fip/build_bl40.sh
Xiaobo Gu9dd3f3f2017-05-26 17:58:57 +080018
Xiaobo Gu059502e2017-01-12 21:20:39 +080019
xiaobo gue6c46862018-01-10 18:58:09 +080020function init_variable_early() {
21 # source uboot pre-build configs
22 if [ ! -e ${SOURCE_FILE} ]; then
23 echo "${SOURCE_FILE} doesn't exist!"
24 cd ${MAIN_FOLDER}
25 exit -1
26 else
27 source ${SOURCE_FILE} &> /dev/null # ignore warning/error
28 fi
Xiaobo Gu9dd3f3f2017-05-26 17:58:57 +080029
xiaobo gue6c46862018-01-10 18:58:09 +080030 CUR_SOC=${CONFIG_SYS_SOC}
Xiaobo Gu059502e2017-01-12 21:20:39 +080031
xiaobo gue6c46862018-01-10 18:58:09 +080032 if [ "y" == "${CONFIG_NEED_BL32}" ]; then
33 BLX_NEEDFUL[3]="true"
34 fi
Xiaobo Gu9dd3f3f2017-05-26 17:58:57 +080035
xiaobo gue6c46862018-01-10 18:58:09 +080036 # export variables
37 #export FIP_BUILD_FOLDER
38 #export CUR_SOC
Xiaobo Gu059502e2017-01-12 21:20:39 +080039
xiaobo gue6c46862018-01-10 18:58:09 +080040 export_variables
Xiaobo Gu059502e2017-01-12 21:20:39 +080041}
42
xiaobo gue6c46862018-01-10 18:58:09 +080043function init_variable_late() {
44 # after uboot build, source configs
xiaobo gua64f93c2018-07-31 21:27:43 +080045 local CONFIG_FILE_TMP="${MAIN_FOLDER}/autoconf"
46 local STR_INVALID="option"
47 if [ ! -e ${CONFIG_FILE} ]; then
48 echo "${CONFIG_FILE} doesn't exist!"
49 cd ${MAIN_FOLDER}
50 exit -1
51 else
52 # workaround for source file error
53 while read LINE
54 do
55 #echo $LINE
56 # ignore "*(option)*" lines
57 if [[ ${LINE} =~ ${STR_INVALID} ]]; then
58 echo "ignore: $LINE"
59 else
60 #echo "LINE: ${LINE}"
61 echo "$LINE" >> "${CONFIG_FILE_TMP}"
62 fi
63 done < ${CONFIG_FILE}
64 source "${CONFIG_FILE_TMP}" &> /dev/null
65 rm ${CONFIG_FILE_TMP}
66 fi
xiaobo gue6c46862018-01-10 18:58:09 +080067 if [ "y" == "${CONFIG_SUPPORT_CUSOTMER_BOARD}" ]; then
68 BOARD_DIR="customer/board/${CONFIG_SYS_BOARD}"
69 else
70 BOARD_DIR="${CONFIG_BOARDDIR}"
71 fi
xiaobo gua64f93c2018-07-31 21:27:43 +080072 export BOARD_DIR
Xiaobo Gu059502e2017-01-12 21:20:39 +080073}
74
75function build_blx_src() {
xiaobo gue6c46862018-01-10 18:58:09 +080076 # compile $name $src_folder $bin_folder $soc
77 local name=$1
78 local src_folder=$2
79 local bin_folder=$3
80 local soc=$4
81 #dbg "compile - name: ${name}, src_folder: ${src_folder}, bin_folder: ${bin_folder}, soc: ${soc}"
xiaobo gu8a3907e2019-05-22 11:46:49 +080082 if [ $name == ${BLX_NAME_GLB[0]} ]; then
xiaobo gue6c46862018-01-10 18:58:09 +080083 # bl2
84 build_bl2 $src_folder $bin_folder $soc
Honglin Zhang637c38b2020-06-28 02:16:39 -040085 elif [ $name == ${BLX_NAME_GLB[5]} ]; then
86 # bl2e
87 build_bl2e $src_folder $bin_folder $soc
88 elif [ $name == ${BLX_NAME_GLB[6]} ]; then
89 # bl2x
90 build_bl2x $src_folder $bin_folder $soc
xiaobo gu8a3907e2019-05-22 11:46:49 +080091 elif [ $name == ${BLX_NAME_GLB[1]} ]; then
xiaobo gue6c46862018-01-10 18:58:09 +080092 # bl30
93 build_bl30 $src_folder $bin_folder $soc
xiaobo gu8a3907e2019-05-22 11:46:49 +080094 elif [ $name == ${BLX_NAME_GLB[2]} ]; then
xiaobo gue6c46862018-01-10 18:58:09 +080095 # bl31
96 # some soc use v1.3
97 check_bl31_ver $soc
Honglin Zhang637c38b2020-06-28 02:16:39 -040098 if [ $? != 0 ]; then
99 echo "check bl31 ver: use v1.3"
100 build_bl31_v1_3 $src_folder $bin_folder $soc
101 else
102 echo "check bl31 ver: use v1.0"
103 build_bl31 $src_folder $bin_folder $soc
104 fi
xiaobo gu8a3907e2019-05-22 11:46:49 +0800105 elif [ $name == ${BLX_NAME_GLB[3]} ]; then
xiaobo gue8bf44f2019-03-18 14:23:36 +0800106 # control flow for jenkins patchbuild
107 if [ "$BUILD_TYPE" != "AOSP" ]; then
108 # bl32
109 if [ "y" == "${CONFIG_NEED_BL32}" ]; then
110 build_bl32 $src_folder $bin_folder $soc
111 fi
xiaobo gue6c46862018-01-10 18:58:09 +0800112 fi
113 fi
Xiaobo Gu059502e2017-01-12 21:20:39 +0800114}
115
116function build_blx() {
xiaobo gue6c46862018-01-10 18:58:09 +0800117 # build each blx
Xiaobo Gu9dd3f3f2017-05-26 17:58:57 +0800118
xiaobo gue6c46862018-01-10 18:58:09 +0800119 # switch bl31 version
120 switch_bl31 ${CUR_SOC}
Xiaobo Gu9dd3f3f2017-05-26 17:58:57 +0800121
xiaobo gue6c46862018-01-10 18:58:09 +0800122 # get version of each blx
123 get_versions
Xiaobo Gu9dd3f3f2017-05-26 17:58:57 +0800124
xiaobo gue6c46862018-01-10 18:58:09 +0800125 # build loop
126 for loop in ${!BLX_NAME[@]}; do
Honglin Zhang805bd102020-02-14 18:23:23 +0800127 dbg "BIN_PATH[${loop}]: ${BIN_PATH[$loop]}"
128 if [ "null" == ${BIN_PATH[$loop]} ]; then
xiaobo gue6c46862018-01-10 18:58:09 +0800129 get_blx_bin ${loop}
Honglin Zhang805bd102020-02-14 18:23:23 +0800130 elif [ "source" == ${BIN_PATH[$loop]} ]; then
xiaobo gue6c46862018-01-10 18:58:09 +0800131 dbg "Build blx source code..."
Honglin Zhang805bd102020-02-14 18:23:23 +0800132 build_blx_src ${BLX_NAME[$loop]} ${BLX_SRC_FOLDER[$loop]} ${FIP_BUILD_FOLDER} ${CUR_SOC}
xiaobo gue6c46862018-01-10 18:58:09 +0800133 else
Honglin Zhang805bd102020-02-14 18:23:23 +0800134 if [ ! -e ${BIN_PATH[$loop]} ]; then
135 echo "Error: ${BIN_PATH[$loop]} doesn't exist... abort"
xiaobo gue6c46862018-01-10 18:58:09 +0800136 exit -1
137 else
Honglin Zhanga5041212020-03-05 21:11:31 +0800138 if [ "y" == "${CONFIG_FIP_IMG_SUPPORT}" ] && \
139 [ -n "${BLX_IMG_NAME[$loop]}" ] && \
140 [ "NULL" != "${BLX_IMG_NAME[$loop]}" ]; then
141 cp ${BIN_PATH[$loop]} ${FIP_BUILD_FOLDER}/${BLX_IMG_NAME[$loop]} -f
142 elif [[ -n "${BLX_IMG_NAME[$loop]}" && "NULL" != "${BLX_BIN_NAME[$loop]}" ]]; then
143 cp ${BIN_PATH[$loop]} ${FIP_BUILD_FOLDER}/${BLX_BIN_NAME[$loop]} -f
144 else
145 cp ${BIN_PATH[$loop]} ${FIP_BUILD_FOLDER} -f
146 fi
147
Honglin Zhang805bd102020-02-14 18:23:23 +0800148 echo "Get ${BLX_NAME[$loop]} from ${BIN_PATH[$loop]}... done"
149 fi
150 fi
151
152 # start to check the blx firmware
153 if [ "bl32" == "${BLX_NAME[$loop]}" ]; then
Honglin Zhanga5041212020-03-05 21:11:31 +0800154 # no bl32/bin are exported for users
Honglin Zhang805bd102020-02-14 18:23:23 +0800155 check_bypass=y
156 else
157 check_bypass=n
158 fi
159
160 if [ "y" != "${check_bypass}" ]; then
161 if [ "NULL" != "${BLX_BIN_NAME[$loop]}" ] && \
Honglin Zhanga5041212020-03-05 21:11:31 +0800162 [ -n "${BLX_BIN_NAME[$loop]}" ] && \
Honglin Zhang0b81ed72020-03-07 10:38:35 +0800163 [ "NULL" == "${BLX_IMG_NAME[$loop]}" ] && \
Honglin Zhang805bd102020-02-14 18:23:23 +0800164 [ ! -f ${FIP_BUILD_FOLDER}/${BLX_BIN_NAME[$loop]} ]; then
Honglin Zhanga5041212020-03-05 21:11:31 +0800165 echo "Error ${BLX_NAME[$loop]}: ${FIP_BUILD_FOLDER}/${BLX_BIN_NAME[$loop]} doesn't exit... abort"
Honglin Zhang805bd102020-02-14 18:23:23 +0800166 exit -1
167 fi
168 if [ "y" == "${CONFIG_FIP_IMG_SUPPORT}" ] && \
169 [ -n "${BLX_IMG_NAME[$loop]}" ] && \
170 [ "NULL" != "${BLX_IMG_NAME[$loop]}" ] && \
171 [ ! -f ${FIP_BUILD_FOLDER}/${BLX_IMG_NAME[$loop]} ]; then
Honglin Zhanga5041212020-03-05 21:11:31 +0800172 echo "Error ${BLX_NAME[$loop]}: ${FIP_BUILD_FOLDER}/${BLX_IMG_NAME[$loop]} doesn't exit... abort"
Honglin Zhang805bd102020-02-14 18:23:23 +0800173 exit -1
xiaobo gue6c46862018-01-10 18:58:09 +0800174 fi
175 fi
176 done
177 return
Xiaobo Gu059502e2017-01-12 21:20:39 +0800178}
179
180copy_bootloader() {
xiaobo gue6c46862018-01-10 18:58:09 +0800181 mkdir -p ${BUILD_FOLDER}
Haixiang Baof008dc12019-05-23 18:47:15 +0800182 cp ${FIP_BUILD_FOLDER}u-boot.bin* ${BUILD_FOLDER}
xiaobo gue6c46862018-01-10 18:58:09 +0800183 if [ "y" == "${CONFIG_AML_CRYPTO_IMG}" ]; then
184 cp ${FIP_BUILD_FOLDER}boot.img.encrypt ${BUILD_FOLDER}boot.img.encrypt
185 fi
Xiaobo Gu059502e2017-01-12 21:20:39 +0800186}
187
188function update_bin_path() {
xiaobo gu8a3907e2019-05-22 11:46:49 +0800189 for loop in ${!BLX_NAME[@]}; do
190 if [ "${BLX_NAME[$loop]}" == "${BLX_NAME_GLB[$1]}" ]; then
Honglin Zhangcd8a9fc2019-11-22 17:52:55 +0800191 dbg "Update BIN_PATH[$loop]=$2"
xiaobo gu8a3907e2019-05-22 11:46:49 +0800192 BIN_PATH[$loop]=$2
Honglin Zhangcd8a9fc2019-11-22 17:52:55 +0800193 break
xiaobo gu8a3907e2019-05-22 11:46:49 +0800194 fi
195 done
196}
Xiaobo Gu059502e2017-01-12 21:20:39 +0800197
198function clean() {
xiaobo gue6c46862018-01-10 18:58:09 +0800199 echo "Clean up"
xiaobo gu0c2598b2019-06-28 11:22:17 +0800200 if [ -e ${BL33_PATH1} ]; then
201 cd ${MAIN_FOLDER}
202 cd ${BL33_PATH1}
203 make distclean
204 fi
205 if [ -e ${BL33_PATH2} ]; then
206 cd ${MAIN_FOLDER}
207 cd ${BL33_PATH2}
208 make distclean
209 fi
xiaobo gue6c46862018-01-10 18:58:09 +0800210 cd ${MAIN_FOLDER}
211 rm ${FIP_BUILD_FOLDER} -rf
xiaobo gu3ce64072018-03-06 17:20:44 +0800212 rm ${BUILD_FOLDER}/* -rf
Haixiang Baof008dc12019-05-23 18:47:15 +0800213 mkdir -p ${BUILD_FOLDER}
xiaobo gue6c46862018-01-10 18:58:09 +0800214 return
Xiaobo Gu059502e2017-01-12 21:20:39 +0800215}
216
217function build() {
xiaobo gue6c46862018-01-10 18:58:09 +0800218 # *************************************************
219 # IMPORTANT!!!!
220 # don't change sequence of following function call
221 # *************************************************
222 clean
223
224 # pre-build, get .config defines
225 pre_build_uboot $@
226
227 # variable init depends on uboot .config
228 init_variable_early $@
229
230 # must source under main function, all sub function can use these variables
231 # but if source in sub-function, only sub-function(or sub-sub..) can use them
232 source ${FIP_FOLDER}${CUR_SOC}/variable_soc.sh
233
Honglin Zhang694f5342019-12-09 14:54:40 +0800234 # compile fip tools for ddr_parse and map_tool
235 prepare_tools
236
xiaobo gue6c46862018-01-10 18:58:09 +0800237 # source soc package script
238 source ${FIP_FOLDER}${CUR_SOC}/build.sh
239
240 # update bin path, use bin.git or user defined or source code
241 bin_path_parser $@
xiaobo gude8a46a2018-03-05 21:41:54 +0800242 #bin_path_update $@
xiaobo gue6c46862018-01-10 18:58:09 +0800243
244 # build bl33/bl301..etc
Liang Ji51eee082019-05-20 14:01:24 +0800245 if [ ! $CONFIG_SYSTEM_AS_ROOT ]; then
Xindong Xu33eda2d2018-09-25 18:52:38 +0800246 CONFIG_SYSTEM_AS_ROOT=null
247 fi
Liang Ji51eee082019-05-20 14:01:24 +0800248 if [ ! $CONFIG_AVB2 ]; then
Xindong Xu33eda2d2018-09-25 18:52:38 +0800249 CONFIG_AVB2=null
250 fi
Xindong Xua75ab9b2020-05-25 15:54:01 +0800251 if [ ! $CONFIG_CMD_BOOTCTOL_R ]; then
252 CONFIG_CMD_BOOTCTOL_R=null
253 fi
254 build_uboot ${CONFIG_SYSTEM_AS_ROOT} ${CONFIG_AVB2} ${CONFIG_CMD_BOOTCTOL_R}
xiaobo gue6c46862018-01-10 18:58:09 +0800255
256 # source other configs after uboot compile
257 init_variable_late
258
259 # bl2/bl30/bl31..etc, build or copy from bin.git
260 build_blx $@
261
262 # cp bl33(uboot)
263 copy_bl33
264
265 # cp other firmwares(soc related)
266 copy_other_soc
267
Zhongfu Luo6c2587f2019-05-15 16:27:50 +0800268 # make build directory
269 mkdir -p ${BUILD_FOLDER}
270
xiaobo gue6c46862018-01-10 18:58:09 +0800271 # package final bootloader
272 package
273
Zhongfu Luofd0ea3e2018-11-30 14:15:16 +0800274 if [ "y" != "${CONFIG_AML_SIGNED_UBOOT}" ]; then
275 # copy bootloader to main folder
276 copy_bootloader
277 fi
Xiaobo Gu059502e2017-01-12 21:20:39 +0800278}
279
280function usage() {
281 cat << EOF
282 Usage:
283 $(basename $0) --help
284
xiaobo gue6c46862018-01-10 18:58:09 +0800285 Bootloader build script.
Xiaobo Gu059502e2017-01-12 21:20:39 +0800286
287 command list:
Xiaobo Gu059502e2017-01-12 21:20:39 +0800288 1. build default uboot:
289 ./$(basename $0) [config_name]
Xiaobo Gu059502e2017-01-12 21:20:39 +0800290
xiaobo gue6c46862018-01-10 18:58:09 +0800291 2. build uboot with specified bl[x].bin
292 ./$(basename $0) [config_name] --bl[x] [path]
Xiaobo Gu059502e2017-01-12 21:20:39 +0800293
xiaobo gue6c46862018-01-10 18:58:09 +0800294 3. build uboot with bl[x]/src source code
Xiaobo Gu059502e2017-01-12 21:20:39 +0800295 ./$(basename $0) [config_name] --update-bl[x]
Xiaobo Gu059502e2017-01-12 21:20:39 +0800296
xiaobo gue6c46862018-01-10 18:58:09 +0800297 4. print config list
298 ./$(basename $0) --config
299
300 5. check compile status with filter(optional)
301 ./$(basename $0) --check-compile [filter]
302
xiaobo gu6368ebe2018-03-29 21:49:25 +0800303 6. update aml ddr fw by source code (for g12a and later use)
304 ./$(basename $0) [config_name] --update-bl2 --ddrfw
305
xiaobo gue6c46862018-01-10 18:58:09 +0800306
307 Example:
308 1) ./$(basename $0) gxb_p200_v1
309 build gxb_p200_v1 config
310
311 2) ./$(basename $0) gxb_p200_v1 --bl2 fip/bl2.bin --bl30 fip/bl30.bin
312 build gxb_p200_v1 with specified bl2.bin and bl30.bin
313
314 3) ./$(basename $0) gxb_p200_v1 --update-bl31 --update-bl2
315 build gxb_p200_v1 with bl31/bl2 source code
316
317 4) ./$(basename $0) --config
318 print config list
319
320 5) ./$(basename $0) --check-compile skt
321 check all skt board compile status
322
323 Remark:
324 bl[x].bin/img priority:
325 1. uboot will use binaries under bl[x]/bin/ folder by default, bl[x] version specified in .repo/manifest.xml
326 2. if you want use your own bl[x].bin, specify path by add "--bl[x] [path]" parameter
327 3. if you want use bl[x].bin by compile source code, please add "--update-bl[x]" parameter
328
Xiaobo Gu059502e2017-01-12 21:20:39 +0800329
330EOF
331 exit 1
332}
333
xiaobo gue6c46862018-01-10 18:58:09 +0800334function print_config() {
335 cat << EOF
336 Usable configs:
337`uboot_config_list`
338EOF
339 exit 1
340}
341
Xiaobo Gu059502e2017-01-12 21:20:39 +0800342function parser() {
xiaobo gue6c46862018-01-10 18:58:09 +0800343 local i=0
344 local argv=()
345 for arg in "$@" ; do
346 argv[$i]="$arg"
347 i=$((i + 1))
348 done
349 i=0
350 while [ $i -lt $# ]; do
351 arg="${argv[$i]}"
xiaobo gu3ce64072018-03-06 17:20:44 +0800352 i=$((i + 1)) # must place here
xiaobo gue6c46862018-01-10 18:58:09 +0800353 case "$arg" in
354 -h|--help|help)
355 usage
356 exit ;;
357 --config)
358 print_config
xiaobo gu3ce64072018-03-06 17:20:44 +0800359 return ;;
xiaobo gue6c46862018-01-10 18:58:09 +0800360 --check-compile)
xiaobo gu66f95292018-01-11 13:38:13 +0800361 check_compile "${argv[@]:$((i))}"
xiaobo gue6c46862018-01-10 18:58:09 +0800362 exit ;;
363 clean|distclean|-distclean|--distclean)
364 clean
365 exit ;;
366 *)
367 esac
368 done
369}
370
xiaobo gude8a46a2018-03-05 21:41:54 +0800371function bin_path_update() {
372 # overwrite path in case some git repository doesn't exist
373 for loop in ${!BLX_BIN_FOLDER[@]}; do
374 if [ -ne ${BLX_BIN_FOLDER[$loop]} ]; then
375 dbg "BLX_BIN_FOLDER[$loop] doesn't exist, use src code"
376 update_bin_path $loop "source"
377 fi
378 done
379
380 for loop in ${!BLX_SRC_FOLDER[@]}; do
381 echo ""
382 done
383}
384
xiaobo gue6c46862018-01-10 18:58:09 +0800385function bin_path_parser() {
386 local i=0
387 local argv=()
388 for arg in "$@" ; do
389 argv[$i]="$arg"
390 i=$((i + 1))
391 done
392 i=0
xiaobo gu6368ebe2018-03-29 21:49:25 +0800393 # ddr fw define, co-work with bl2 build script
394 export CONFIG_DDR_FW
xiaobo gue6c46862018-01-10 18:58:09 +0800395 while [ $i -lt $# ]; do
396 arg="${argv[$i]}"
397 i=$((i + 1)) # must pleace here
398 case "$arg" in
399 --bl2)
400 update_bin_path 0 "${argv[@]:$((i))}"
401 continue ;;
Honglin Zhang637c38b2020-06-28 02:16:39 -0400402 --bl2e)
403 update_bin_path 5 "${argv[@]:$((i))}"
404 continue ;;
405 --bl2x)
406 update_bin_path 6 "${argv[@]:$((i))}"
407 continue ;;
xiaobo gue6c46862018-01-10 18:58:09 +0800408 --bl30)
409 update_bin_path 1 "${argv[@]:$((i))}"
410 continue ;;
411 --bl31)
412 update_bin_path 2 "${argv[@]:$((i))}"
413 continue ;;
414 --bl32)
415 update_bin_path 3 "${argv[@]:$((i))}"
416 continue ;;
Honglin Zhang637c38b2020-06-28 02:16:39 -0400417 --bl40)
Zhongfu Luo3e54c6f2020-02-15 21:30:50 +0800418 update_bin_path 4 "${argv[@]:$((i))}"
419 continue ;;
Honglin Zhang637c38b2020-06-28 02:16:39 -0400420 --sign-bl40)
Zhongfu Luo3e54c6f2020-02-15 21:30:50 +0800421 update_bin_path 4 "${argv[@]:$((i))}"
422 CONFIG_SIGN_BL40=1
423 continue ;;
xiaobo gue6c46862018-01-10 18:58:09 +0800424 --update-bl2)
425 update_bin_path 0 "source"
426 continue ;;
Honglin Zhang637c38b2020-06-28 02:16:39 -0400427 --update-bl2e)
428 update_bin_path 5 "source"
429 continue ;;
430 --update-bl2x)
431 update_bin_path 6 "source"
432 continue ;;
xiaobo gue6c46862018-01-10 18:58:09 +0800433 --update-bl30)
434 update_bin_path 1 "source"
435 continue ;;
436 --update-bl31)
437 update_bin_path 2 "source"
438 continue ;;
439 --update-bl32)
440 update_bin_path 3 "source"
441 continue ;;
xiaobo gu6368ebe2018-03-29 21:49:25 +0800442 --ddrfw)
443 CONFIG_DDR_FW=1
444 export CONFIG_DDR_FW
445 continue ;;
Honglin Zhang8fa9d152020-02-10 12:29:27 +0800446 --cas)
447 cas="${argv[$i]}"
448 #limit the "--cas xxx" only works for g12a
Lawrence Mok762306e2020-05-13 20:38:08 -0700449 if [ "${CUR_SOC}" == "g12a" ] ||
450 ( [ "${cas}" == "vmx" ] && [ "${CUR_SOC}" == "gxl" ] ); then
Honglin Zhang8fa9d152020-02-10 12:29:27 +0800451 CONFIG_CAS=${cas}
452 fi
453 if [[ "${CONFIG_CAS}" == "irdeto" || \
454 "${CONFIG_CAS}" == "vmx" || \
455 "${CONFIG_CAS}" == "nagra" ]]; then
456 CONFIG_AML_SIGNED_UBOOT=y
457 export CONFIG_AML_SIGNED_UBOOT
458 fi
Lawrence Mok048be0f2020-02-24 18:03:43 -0800459 if [ "${CONFIG_CAS}" == "vmx" ]; then
460 dbg "Loading CAS VMX config"
461 source fip/config_cas_vmx.sh
462 fi
Honglin Zhang8fa9d152020-02-10 12:29:27 +0800463 echo "CAS: ${cas},${CONFIG_CAS}"
464 export CONFIG_CAS
465 continue ;;
Xindong Xuad0d2832018-07-30 19:15:52 +0800466 --systemroot)
467 CONFIG_SYSTEM_AS_ROOT=systemroot
468 echo "export CONFIG_SYSTEM_AS_ROOT"
469 export CONFIG_SYSTEM_AS_ROOT=systemroot
470 continue ;;
Xindong Xu33eda2d2018-09-25 18:52:38 +0800471 --avb2)
472 CONFIG_AVB2=avb2
473 echo "export CONFIG_AVB2"
474 export CONFIG_AVB2=avb2
475 continue ;;
Xindong Xua75ab9b2020-05-25 15:54:01 +0800476 --bootctrlR)
477 CONFIG_CMD_BOOTCTOL_R=1
478 echo "export CONFIG_CMD_BOOTCTOL_R"
479 export CONFIG_CMD_BOOTCTOL_R=1
480 continue ;;
Matthew Shyu4a863712020-02-19 17:58:17 +0800481 --avb2-fipkey)
482 CONFIG_AVB2_KPUB_FROM_FIP=1
483 echo "export CONFIG_AVB2_KPUB_FROM_FIP"
484 export CONFIG_AVB2_KPUB_FROM_FIP=1
485 continue ;;
xiaobo gue6c46862018-01-10 18:58:09 +0800486 *)
487 esac
488 done
Xiaobo Gu059502e2017-01-12 21:20:39 +0800489}
490
491function main() {
xiaobo gue6c46862018-01-10 18:58:09 +0800492 if [ -z $1 ]
493 then
494 usage
495 return
496 fi
Xiaobo Gu059502e2017-01-12 21:20:39 +0800497
xiaobo gue6c46862018-01-10 18:58:09 +0800498 MAIN_FOLDER=`pwd`
499 parser $@
500 build $@
Xiaobo Gu059502e2017-01-12 21:20:39 +0800501}
502
503main $@ # parse all paras to function