blob: f60ff0e03bf1276ff79b1d706035ee7d0fba0c77 [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
Zhongfu Luo7bd99c92020-07-14 19:37:52 +0800142 elif [[ -n "${BLX_IMG_NAME[$loop]}" && "NULL" != "${BLX_BIN_NAME[$loop]}" && "${CUR_SOC}" != "sc2" ]]; then
Honglin Zhanga5041212020-03-05 21:11:31 +0800143 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
Zhongfu Luo7bd99c92020-07-14 19:37:52 +0800160 if [ "${CUR_SOC}" == "sc2" ]; then
161 check_bypass=y
162 fi
163
Honglin Zhang805bd102020-02-14 18:23:23 +0800164 if [ "y" != "${check_bypass}" ]; then
165 if [ "NULL" != "${BLX_BIN_NAME[$loop]}" ] && \
Honglin Zhanga5041212020-03-05 21:11:31 +0800166 [ -n "${BLX_BIN_NAME[$loop]}" ] && \
Honglin Zhang0b81ed72020-03-07 10:38:35 +0800167 [ "NULL" == "${BLX_IMG_NAME[$loop]}" ] && \
Honglin Zhang805bd102020-02-14 18:23:23 +0800168 [ ! -f ${FIP_BUILD_FOLDER}/${BLX_BIN_NAME[$loop]} ]; then
Honglin Zhanga5041212020-03-05 21:11:31 +0800169 echo "Error ${BLX_NAME[$loop]}: ${FIP_BUILD_FOLDER}/${BLX_BIN_NAME[$loop]} doesn't exit... abort"
Honglin Zhang805bd102020-02-14 18:23:23 +0800170 exit -1
171 fi
172 if [ "y" == "${CONFIG_FIP_IMG_SUPPORT}" ] && \
173 [ -n "${BLX_IMG_NAME[$loop]}" ] && \
174 [ "NULL" != "${BLX_IMG_NAME[$loop]}" ] && \
175 [ ! -f ${FIP_BUILD_FOLDER}/${BLX_IMG_NAME[$loop]} ]; then
Honglin Zhanga5041212020-03-05 21:11:31 +0800176 echo "Error ${BLX_NAME[$loop]}: ${FIP_BUILD_FOLDER}/${BLX_IMG_NAME[$loop]} doesn't exit... abort"
Honglin Zhang805bd102020-02-14 18:23:23 +0800177 exit -1
xiaobo gue6c46862018-01-10 18:58:09 +0800178 fi
179 fi
180 done
181 return
Xiaobo Gu059502e2017-01-12 21:20:39 +0800182}
183
184copy_bootloader() {
xiaobo gue6c46862018-01-10 18:58:09 +0800185 mkdir -p ${BUILD_FOLDER}
Haixiang Baof008dc12019-05-23 18:47:15 +0800186 cp ${FIP_BUILD_FOLDER}u-boot.bin* ${BUILD_FOLDER}
xiaobo gue6c46862018-01-10 18:58:09 +0800187 if [ "y" == "${CONFIG_AML_CRYPTO_IMG}" ]; then
188 cp ${FIP_BUILD_FOLDER}boot.img.encrypt ${BUILD_FOLDER}boot.img.encrypt
189 fi
Xiaobo Gu059502e2017-01-12 21:20:39 +0800190}
191
192function update_bin_path() {
xiaobo gu8a3907e2019-05-22 11:46:49 +0800193 for loop in ${!BLX_NAME[@]}; do
194 if [ "${BLX_NAME[$loop]}" == "${BLX_NAME_GLB[$1]}" ]; then
Honglin Zhangcd8a9fc2019-11-22 17:52:55 +0800195 dbg "Update BIN_PATH[$loop]=$2"
xiaobo gu8a3907e2019-05-22 11:46:49 +0800196 BIN_PATH[$loop]=$2
Honglin Zhangcd8a9fc2019-11-22 17:52:55 +0800197 break
xiaobo gu8a3907e2019-05-22 11:46:49 +0800198 fi
199 done
200}
Xiaobo Gu059502e2017-01-12 21:20:39 +0800201
202function clean() {
xiaobo gue6c46862018-01-10 18:58:09 +0800203 echo "Clean up"
xiaobo gu0c2598b2019-06-28 11:22:17 +0800204 if [ -e ${BL33_PATH1} ]; then
205 cd ${MAIN_FOLDER}
206 cd ${BL33_PATH1}
207 make distclean
208 fi
209 if [ -e ${BL33_PATH2} ]; then
210 cd ${MAIN_FOLDER}
211 cd ${BL33_PATH2}
212 make distclean
213 fi
xiaobo gue6c46862018-01-10 18:58:09 +0800214 cd ${MAIN_FOLDER}
215 rm ${FIP_BUILD_FOLDER} -rf
xiaobo gu3ce64072018-03-06 17:20:44 +0800216 rm ${BUILD_FOLDER}/* -rf
Haixiang Baof008dc12019-05-23 18:47:15 +0800217 mkdir -p ${BUILD_FOLDER}
xiaobo gue6c46862018-01-10 18:58:09 +0800218 return
Xiaobo Gu059502e2017-01-12 21:20:39 +0800219}
220
221function build() {
xiaobo gue6c46862018-01-10 18:58:09 +0800222 # *************************************************
223 # IMPORTANT!!!!
224 # don't change sequence of following function call
225 # *************************************************
226 clean
227
228 # pre-build, get .config defines
229 pre_build_uboot $@
230
231 # variable init depends on uboot .config
232 init_variable_early $@
233
234 # must source under main function, all sub function can use these variables
235 # but if source in sub-function, only sub-function(or sub-sub..) can use them
236 source ${FIP_FOLDER}${CUR_SOC}/variable_soc.sh
237
Honglin Zhang694f5342019-12-09 14:54:40 +0800238 # compile fip tools for ddr_parse and map_tool
239 prepare_tools
240
xiaobo gue6c46862018-01-10 18:58:09 +0800241 # source soc package script
242 source ${FIP_FOLDER}${CUR_SOC}/build.sh
243
244 # update bin path, use bin.git or user defined or source code
245 bin_path_parser $@
xiaobo gude8a46a2018-03-05 21:41:54 +0800246 #bin_path_update $@
xiaobo gue6c46862018-01-10 18:58:09 +0800247
248 # build bl33/bl301..etc
Liang Ji51eee082019-05-20 14:01:24 +0800249 if [ ! $CONFIG_SYSTEM_AS_ROOT ]; then
Xindong Xu33eda2d2018-09-25 18:52:38 +0800250 CONFIG_SYSTEM_AS_ROOT=null
251 fi
Liang Ji51eee082019-05-20 14:01:24 +0800252 if [ ! $CONFIG_AVB2 ]; then
Xindong Xu33eda2d2018-09-25 18:52:38 +0800253 CONFIG_AVB2=null
254 fi
Xindong Xua75ab9b2020-05-25 15:54:01 +0800255 if [ ! $CONFIG_CMD_BOOTCTOL_R ]; then
256 CONFIG_CMD_BOOTCTOL_R=null
257 fi
258 build_uboot ${CONFIG_SYSTEM_AS_ROOT} ${CONFIG_AVB2} ${CONFIG_CMD_BOOTCTOL_R}
xiaobo gue6c46862018-01-10 18:58:09 +0800259
260 # source other configs after uboot compile
261 init_variable_late
262
263 # bl2/bl30/bl31..etc, build or copy from bin.git
264 build_blx $@
265
266 # cp bl33(uboot)
267 copy_bl33
268
269 # cp other firmwares(soc related)
270 copy_other_soc
271
Zhongfu Luo6c2587f2019-05-15 16:27:50 +0800272 # make build directory
273 mkdir -p ${BUILD_FOLDER}
274
xiaobo gue6c46862018-01-10 18:58:09 +0800275 # package final bootloader
276 package
277
Zhongfu Luofd0ea3e2018-11-30 14:15:16 +0800278 if [ "y" != "${CONFIG_AML_SIGNED_UBOOT}" ]; then
279 # copy bootloader to main folder
280 copy_bootloader
281 fi
Xiaobo Gu059502e2017-01-12 21:20:39 +0800282}
283
284function usage() {
285 cat << EOF
286 Usage:
287 $(basename $0) --help
288
xiaobo gue6c46862018-01-10 18:58:09 +0800289 Bootloader build script.
Xiaobo Gu059502e2017-01-12 21:20:39 +0800290
291 command list:
Xiaobo Gu059502e2017-01-12 21:20:39 +0800292 1. build default uboot:
293 ./$(basename $0) [config_name]
Xiaobo Gu059502e2017-01-12 21:20:39 +0800294
xiaobo gue6c46862018-01-10 18:58:09 +0800295 2. build uboot with specified bl[x].bin
296 ./$(basename $0) [config_name] --bl[x] [path]
Xiaobo Gu059502e2017-01-12 21:20:39 +0800297
xiaobo gue6c46862018-01-10 18:58:09 +0800298 3. build uboot with bl[x]/src source code
Xiaobo Gu059502e2017-01-12 21:20:39 +0800299 ./$(basename $0) [config_name] --update-bl[x]
Xiaobo Gu059502e2017-01-12 21:20:39 +0800300
xiaobo gue6c46862018-01-10 18:58:09 +0800301 4. print config list
302 ./$(basename $0) --config
303
304 5. check compile status with filter(optional)
305 ./$(basename $0) --check-compile [filter]
306
xiaobo gu6368ebe2018-03-29 21:49:25 +0800307 6. update aml ddr fw by source code (for g12a and later use)
308 ./$(basename $0) [config_name] --update-bl2 --ddrfw
309
xiaobo gue6c46862018-01-10 18:58:09 +0800310
311 Example:
312 1) ./$(basename $0) gxb_p200_v1
313 build gxb_p200_v1 config
314
315 2) ./$(basename $0) gxb_p200_v1 --bl2 fip/bl2.bin --bl30 fip/bl30.bin
316 build gxb_p200_v1 with specified bl2.bin and bl30.bin
317
318 3) ./$(basename $0) gxb_p200_v1 --update-bl31 --update-bl2
319 build gxb_p200_v1 with bl31/bl2 source code
320
321 4) ./$(basename $0) --config
322 print config list
323
324 5) ./$(basename $0) --check-compile skt
325 check all skt board compile status
326
327 Remark:
328 bl[x].bin/img priority:
329 1. uboot will use binaries under bl[x]/bin/ folder by default, bl[x] version specified in .repo/manifest.xml
330 2. if you want use your own bl[x].bin, specify path by add "--bl[x] [path]" parameter
331 3. if you want use bl[x].bin by compile source code, please add "--update-bl[x]" parameter
332
Xiaobo Gu059502e2017-01-12 21:20:39 +0800333
334EOF
335 exit 1
336}
337
xiaobo gue6c46862018-01-10 18:58:09 +0800338function print_config() {
339 cat << EOF
340 Usable configs:
341`uboot_config_list`
342EOF
343 exit 1
344}
345
Xiaobo Gu059502e2017-01-12 21:20:39 +0800346function parser() {
xiaobo gue6c46862018-01-10 18:58:09 +0800347 local i=0
348 local argv=()
349 for arg in "$@" ; do
350 argv[$i]="$arg"
351 i=$((i + 1))
352 done
353 i=0
354 while [ $i -lt $# ]; do
355 arg="${argv[$i]}"
xiaobo gu3ce64072018-03-06 17:20:44 +0800356 i=$((i + 1)) # must place here
xiaobo gue6c46862018-01-10 18:58:09 +0800357 case "$arg" in
358 -h|--help|help)
359 usage
360 exit ;;
361 --config)
362 print_config
xiaobo gu3ce64072018-03-06 17:20:44 +0800363 return ;;
xiaobo gue6c46862018-01-10 18:58:09 +0800364 --check-compile)
xiaobo gu66f95292018-01-11 13:38:13 +0800365 check_compile "${argv[@]:$((i))}"
xiaobo gue6c46862018-01-10 18:58:09 +0800366 exit ;;
367 clean|distclean|-distclean|--distclean)
368 clean
369 exit ;;
370 *)
371 esac
372 done
373}
374
xiaobo gude8a46a2018-03-05 21:41:54 +0800375function bin_path_update() {
376 # overwrite path in case some git repository doesn't exist
377 for loop in ${!BLX_BIN_FOLDER[@]}; do
378 if [ -ne ${BLX_BIN_FOLDER[$loop]} ]; then
379 dbg "BLX_BIN_FOLDER[$loop] doesn't exist, use src code"
380 update_bin_path $loop "source"
381 fi
382 done
383
384 for loop in ${!BLX_SRC_FOLDER[@]}; do
385 echo ""
386 done
387}
388
xiaobo gue6c46862018-01-10 18:58:09 +0800389function bin_path_parser() {
390 local i=0
391 local argv=()
392 for arg in "$@" ; do
393 argv[$i]="$arg"
394 i=$((i + 1))
395 done
396 i=0
xiaobo gu6368ebe2018-03-29 21:49:25 +0800397 # ddr fw define, co-work with bl2 build script
398 export CONFIG_DDR_FW
xiaobo gue6c46862018-01-10 18:58:09 +0800399 while [ $i -lt $# ]; do
400 arg="${argv[$i]}"
401 i=$((i + 1)) # must pleace here
402 case "$arg" in
403 --bl2)
404 update_bin_path 0 "${argv[@]:$((i))}"
405 continue ;;
Honglin Zhang637c38b2020-06-28 02:16:39 -0400406 --bl2e)
407 update_bin_path 5 "${argv[@]:$((i))}"
408 continue ;;
409 --bl2x)
410 update_bin_path 6 "${argv[@]:$((i))}"
411 continue ;;
xiaobo gue6c46862018-01-10 18:58:09 +0800412 --bl30)
413 update_bin_path 1 "${argv[@]:$((i))}"
414 continue ;;
415 --bl31)
416 update_bin_path 2 "${argv[@]:$((i))}"
417 continue ;;
418 --bl32)
419 update_bin_path 3 "${argv[@]:$((i))}"
420 continue ;;
Honglin Zhang637c38b2020-06-28 02:16:39 -0400421 --bl40)
Zhongfu Luo3e54c6f2020-02-15 21:30:50 +0800422 update_bin_path 4 "${argv[@]:$((i))}"
423 continue ;;
Honglin Zhang637c38b2020-06-28 02:16:39 -0400424 --sign-bl40)
Zhongfu Luo3e54c6f2020-02-15 21:30:50 +0800425 update_bin_path 4 "${argv[@]:$((i))}"
426 CONFIG_SIGN_BL40=1
427 continue ;;
xiaobo gue6c46862018-01-10 18:58:09 +0800428 --update-bl2)
429 update_bin_path 0 "source"
430 continue ;;
Honglin Zhang637c38b2020-06-28 02:16:39 -0400431 --update-bl2e)
432 update_bin_path 5 "source"
433 continue ;;
434 --update-bl2x)
435 update_bin_path 6 "source"
436 continue ;;
xiaobo gue6c46862018-01-10 18:58:09 +0800437 --update-bl30)
438 update_bin_path 1 "source"
439 continue ;;
440 --update-bl31)
441 update_bin_path 2 "source"
442 continue ;;
443 --update-bl32)
444 update_bin_path 3 "source"
445 continue ;;
xiaobo gu6368ebe2018-03-29 21:49:25 +0800446 --ddrfw)
447 CONFIG_DDR_FW=1
448 export CONFIG_DDR_FW
449 continue ;;
Honglin Zhang8fa9d152020-02-10 12:29:27 +0800450 --cas)
451 cas="${argv[$i]}"
452 #limit the "--cas xxx" only works for g12a
Lawrence Mok762306e2020-05-13 20:38:08 -0700453 if [ "${CUR_SOC}" == "g12a" ] ||
454 ( [ "${cas}" == "vmx" ] && [ "${CUR_SOC}" == "gxl" ] ); then
Honglin Zhang8fa9d152020-02-10 12:29:27 +0800455 CONFIG_CAS=${cas}
456 fi
457 if [[ "${CONFIG_CAS}" == "irdeto" || \
458 "${CONFIG_CAS}" == "vmx" || \
459 "${CONFIG_CAS}" == "nagra" ]]; then
460 CONFIG_AML_SIGNED_UBOOT=y
461 export CONFIG_AML_SIGNED_UBOOT
462 fi
Lawrence Mok048be0f2020-02-24 18:03:43 -0800463 if [ "${CONFIG_CAS}" == "vmx" ]; then
464 dbg "Loading CAS VMX config"
465 source fip/config_cas_vmx.sh
466 fi
Honglin Zhang8fa9d152020-02-10 12:29:27 +0800467 echo "CAS: ${cas},${CONFIG_CAS}"
468 export CONFIG_CAS
469 continue ;;
Xindong Xuad0d2832018-07-30 19:15:52 +0800470 --systemroot)
471 CONFIG_SYSTEM_AS_ROOT=systemroot
472 echo "export CONFIG_SYSTEM_AS_ROOT"
473 export CONFIG_SYSTEM_AS_ROOT=systemroot
474 continue ;;
Xindong Xu33eda2d2018-09-25 18:52:38 +0800475 --avb2)
476 CONFIG_AVB2=avb2
477 echo "export CONFIG_AVB2"
478 export CONFIG_AVB2=avb2
479 continue ;;
Xindong Xua75ab9b2020-05-25 15:54:01 +0800480 --bootctrlR)
481 CONFIG_CMD_BOOTCTOL_R=1
482 echo "export CONFIG_CMD_BOOTCTOL_R"
483 export CONFIG_CMD_BOOTCTOL_R=1
484 continue ;;
Matthew Shyu4a863712020-02-19 17:58:17 +0800485 --avb2-fipkey)
486 CONFIG_AVB2_KPUB_FROM_FIP=1
487 echo "export CONFIG_AVB2_KPUB_FROM_FIP"
488 export CONFIG_AVB2_KPUB_FROM_FIP=1
489 continue ;;
xiaobo gue6c46862018-01-10 18:58:09 +0800490 *)
491 esac
492 done
Xiaobo Gu059502e2017-01-12 21:20:39 +0800493}
494
495function main() {
xiaobo gue6c46862018-01-10 18:58:09 +0800496 if [ -z $1 ]
497 then
498 usage
499 return
500 fi
Xiaobo Gu059502e2017-01-12 21:20:39 +0800501
xiaobo gue6c46862018-01-10 18:58:09 +0800502 MAIN_FOLDER=`pwd`
503 parser $@
504 build $@
Xiaobo Gu059502e2017-01-12 21:20:39 +0800505}
506
507main $@ # parse all paras to function