blob: 735d3ff96e79a1589dfe74ce3e401bf89eac2acf [file] [log] [blame]
b.liud440f9f2025-04-18 10:44:31 +08001#!/bin/bash
2
3red='\e[0;31m' # 红色
4green='\e[0;32m' # 绿色
5NC='\e[0m' # 没有颜色
6
7export STAGING_DIR=
8DECONFIG_FILE=
9
10# glibc / musl
b.liu5a480bd2025-05-26 11:32:52 +080011GLIBC_NAME=glibc
b.liud440f9f2025-04-18 10:44:31 +080012ASR_PROJECT_NAME=
13ASR_PROJECT_PATCH=
14
15DIR_BUILD_TARGET=build_dir/target-arm_cortex-a7+neon-vfpv4_"$GLIBC_NAME"_eabi
16DIR_STAGING_TARGET=staging_dir/target-arm_cortex-a7+neon-vfpv4_"$GLIBC_NAME"_eabi
17DIR_BIN=
18
19versionFile='mbtk/include/mbtk_device_info.h'
20version=`cat $versionFile | grep -w 'MBTK_DEVICES_REVISION' | cut -d '"' -f 2 `
21
22usage()
23{
24 echo "Usage : ./build.sh <clean/path>"
25}
26
27function excmd()
28{
29 echo -e "${green}Excmd:${NC} $@ ..."
30# && sleep 1
31 $@
32}
33
34function timediff() {
35# time format:date +"%s.%N", such as 1502758855.907197692
36 start_time=$1
37 end_time=$2
38
39 start_s=${start_time%.*}
40 start_nanos=${start_time#*.}
41 end_s=${end_time%.*}
42 end_nanos=${end_time#*.}
43
44 # end_nanos > start_nanos?
45 # Another way, the time part may start with 0, which means
46 # it will be regarded as oct format, use "10#" to ensure
47 # calculateing with decimal
48
49 if [ "$end_nanos" -lt "$start_nanos" ];then
50 end_s=$(( 10#$end_s - 1 ))
51 end_nanos=$(( 10#$end_nanos + 10**9 ))
52 fi
53
54# get timediff
55 time=$(( 10#$end_s - 10#$start_s )).`printf "%03ds" $(( (10#$end_nanos - 10#$start_nanos)/10**6 ))`
56 time_min=$(((end_s - start_s)/60 + 1))
57 echo -e "${green}*${NC} Spend time: "$time \(\~ ${time_min}min\) ${green}***${NC}
58}
59
60init_check()
61{
62
63 if [ ! -f "config/$DECONFIG_FILE" ]; then
64 echo 'Must exec "init.sh" in the first.'
65 exit 1
66 fi
67
68# if [ ! -f "../pack.sh" ]; then
69# echo 'Must exec "init.sh" in the first.'
70# exit 1
71# fi
72
73}
74
75build_init()
76{
77 init_check
78
79 if [ ! -d "feeds/" ]; then
80 echo "Start build inti..."
81 excmd ./scripts/feeds update -a
82 excmd ./scripts/feeds install -a
83
84 echo "$DECONFIG_FILE"
85
86# if [ "$DECONFIG_FILE" == "defconfig_asr1803p401" ];then
87# excmd make prereq
88# fi
89
90 #excmd make $DECONFIG_FILE
91 fi
92
93 if [ -f .config ];then
94 rm .config
95 fi
96
97 excmd make $DECONFIG_FILE
98}
99
100copy_bin()
101{
102 echo "Start copy bin..."
103# [ -f $MBTK_DIR/out/bin/mbtk_audio_set ] && cp -f $MBTK_DIR/out/bin/mbtk_audio_set $MBTK_DIR/bin
104 [ -f $MBTK_DIR/../out/bin/device_info ] && cp -f $MBTK_DIR/../out/bin/device_info $MBTK_DIR/bin
105}
106
107copy_lib()
108{
109 echo "Start copy lib..."
110 [ -f $MBTK_DIR/../out/lib/liblynq_lib.so ] && cp -f $MBTK_DIR/../out/lib/liblynq_lib.so $MBTK_DIR/lib
111# [ -f $MBTK_DIR/../out/lib/libql_lib.so.* ] && cp -f $MBTK_DIR/../out/lib/libql_lib.so.* $MBTK_DIR/lib
112
113 ls $MBTK_DIR/../out/lib/libql_lib.so.*
114 if [ $? -eq 0 ];then
115 cp -f $MBTK_DIR/../out/lib/libql_lib.so.* $MBTK_DIR/lib
116 fi
117
118}
119
120ln_lib()
121{
122 PWD_TEMP=`pwd`
123
124 cd $ROOTFS_DIR/lib
125 if [ -f liblynq_lib.so ];then
126 [ ! -f libpoweralarm.so ] && ln -s liblynq_lib.so libpoweralarm.so
127 [ ! -f liblynq-qser-audio.so ] && ln -s liblynq_lib.so liblynq-qser-audio.so
128 [ ! -f liblynq-adc.so ] && ln -s liblynq_lib.so liblynq-adc.so
129 [ ! -f liblynq-fota.so ] && ln -s liblynq_lib.so liblynq-fota.so
130 [ ! -f liblynq-qser-gnss.so ] && ln -s liblynq_lib.so liblynq-qser-gnss.so
131 [ ! -f liblynq-log.so ] && ln -s liblynq_lib.so liblynq-log.so
132 [ ! -f liblynq-led.so ] && ln -s liblynq_lib.so liblynq-led.so
133 [ ! -f liblynq-qser-autosuspend.so ] && ln -s liblynq_lib.so liblynq-qser-autosuspend.so
134 [ ! -f liblynq-systime.so ] && ln -s liblynq_lib.so liblynq-systime.so
135 [ ! -f liblynq-qser-thermal.so ] && ln -s liblynq_lib.so liblynq-qser-thermal.so
136 [ ! -f liblynq-qser-sim.so ] && ln -s liblynq_lib.so liblynq-qser-sim.so
137 [ ! -f liblynq-qser-sms.so ] && ln -s liblynq_lib.so liblynq-qser-sms.so
138 [ ! -f liblynq-qser-voice.so ] && ln -s liblynq_lib.so liblynq-qser-voice.so
139 [ ! -f liblynq-qser-network.so ] && ln -s liblynq_lib.so liblynq-qser-network.so
140 [ ! -f liblynq-qser-data.so ] && ln -s liblynq_lib.so liblynq-qser-data.so
141 [ ! -f liblynq-irq.so ] && ln -s liblynq_lib.so liblynq-irq.so
142 fi
143
144 cd $PWD_TEMP
145}
146
147build_mbtk()
148{
149 copy_toolchain
150 make -C mbtk/ || exit 1
151
152 ROOTFS_DIR=$DIR_BUILD_TARGET/root-mmp
153 MBTK_DIR=mbtk/rootfs
154
155 if [ "$SEC_SUPPORT" == "Y" ];then
156 # copy_lib
157 if [ -d $ROOTFS_DIR ];then
158 echo "Start build optee_test..."
159 [ -d mbtk/optee_test ] && make clean -C mbtk/optee_test && make -C mbtk/optee_test
160 echo "Should copy to mbtk/rootfs and build.sh if necessary."
161 fi
162 else
163 if [ -f staging_dir/host/bin/sstrip ];then
164 STRIP_FILE=./staging_dir/host/bin/sstrip
165 else
166 STRIP_FILE=./host/linux64/bin/sstrip
167 fi
168
169 if [ ! -d $ROOTFS_DIR ];then
170 mkdir -p $ROOTFS_DIR
171 fi
172
173 excmd cp -rf $MBTK_DIR/* $ROOTFS_DIR/
174
175 CUR_PWD=`pwd`
176 cd $ROOTFS_DIR/etc/rc.d
177 if [ ! -f S15mbtk_boot_normal -a -f ../init.d/mbtk_boot_normal ];then
178 ln -s ../init.d/mbtk_boot_normal S15mbtk_boot_normal
179 fi
180 if [ ! -f S98mbtk_boot_last -a -f ../init.d/mbtk_boot_last ];then
181 ln -s ../init.d/mbtk_boot_last S98mbtk_boot_last
182 fi
183 if [ ! -f S13mbtk_logd -a -f ../init.d/mbtk_logd ];then
184 ln -s ../init.d/mbtk_logd S13mbtk_logd
185 fi
186
hong.liufa3dc0a2025-06-30 17:30:59 +0800187 if [ ! -f S12gsw_start -a -f ../init.d/gsw_start ];then
188 ln -s ../init.d/gsw_start S12gsw_start
hong.liuf024a692025-06-11 02:40:53 -0700189 fi
190
b.liud440f9f2025-04-18 10:44:31 +0800191 cd $CUR_PWD
192
193 if [ -d $MBTK_DIR/lib_tmp ];then
194 rm -rf $MBTK_DIR/lib_tmp
195 fi
196
197 if [ -d $MBTK_DIR/bin_tmp ];then
198 rm -rf $MBTK_DIR/bin_tmp
199 fi
200
201 # copy_lib
202
203 copy_bin
204
205 cp -r $MBTK_DIR/lib $MBTK_DIR/lib_tmp
206 cp -r $MBTK_DIR/bin $MBTK_DIR/bin_tmp
207
208 CROSS="arm-openwrt-linux-uclibcgnueabi-" NO_RENAME=1 ; NM="arm-openwrt-linux-uclibcgnueabi-nm" STRIP="$STRIP_FILE" STRIP_KMOD="./scripts/strip-kmod.sh" ./scripts/rstrip.sh $MBTK_DIR/lib_tmp
209 CROSS="arm-openwrt-linux-uclibcgnueabi-" NO_RENAME=1 ; NM="arm-openwrt-linux-uclibcgnueabi-nm" STRIP="$STRIP_FILE" STRIP_KMOD="./scripts/strip-kmod.sh" ./scripts/rstrip.sh $MBTK_DIR/bin_tmp
210
211 cp $MBTK_DIR/lib_tmp/* $ROOTFS_DIR/lib
212 cp $MBTK_DIR/bin_tmp/* $ROOTFS_DIR/bin
213 rm -rf $MBTK_DIR/lib_tmp
214 rm -rf $MBTK_DIR/bin_tmp
215
216 [ -f $ROOTFS_DIR/etc/init.d/wpad ] && rm $ROOTFS_DIR/etc/init.d/wpad
217 ln_lib
218 fi
219}
220
221
222build_mbtk_clean()
223{
224 cd mbtk
225 make clean
226 cd ..
227}
228
229build_rootfs()
230{
231 if [ -f ./staging_dir/host/bin/mksquashfs4 ];then
232 EXEC=./staging_dir/host/bin/mksquashfs4
233 else
234 EXEC=./host/linux64/bin/mksquashfs4
235 fi
236
237 $EXEC $DIR_BUILD_TARGET/root-mmp $DIR_BUILD_TARGET/linux-mmp_"$ASR_PROJECT_NAME"/root.squashfs -nopad -noappend -root-owned -comp xz -Xpreset 8 -Xe -Xlc 0 -Xlp 2 -Xpb 2 -Xbcj arm -b 64k -p '/dev d 755 0 0' -p '/dev/console c 600 0 0 5 1' -processors 1
238 excmd dd if=$DIR_BUILD_TARGET/linux-mmp_"$ASR_PROJECT_NAME"/root.squashfs of=$DIR_BIN/swd/openwrt-mmp-"$ASR_PROJECT_NAME"-root.squashfs
239}
240
241copy_toolchain()
242{
243 # 1806
244 if [ ! -d mbtk/toolchain ];then
245 if [ ! -d owtoolchain/linux64 ];then
246 "Build all in the first."
247 exit 1
248 fi
249 echo "Start Copy Build Toolchain..."
250 mkdir -p mbtk/toolchain
251 cp -r owtoolchain/linux64 mbtk/toolchain/
252 cp -r mbtk/toolchain/linux64/include/* mbtk/toolchain/linux64/usr/include/
253 cp -r $DIR_STAGING_TARGET/usr/* mbtk/toolchain/linux64/usr/
254 cp -r mbtk/toolchain/linux64/usr/include/* mbtk/toolchain/linux64/include/
255 cp -drf $DIR_BUILD_TARGET/audio/obj/olibs/* mbtk/toolchain/linux64/usr/lib/
256 cp -r marvell/services/audio_if/include/* mbtk/toolchain/linux64/include/
b.liuf7f2d6d2025-05-20 15:10:18 +0800257 cp -r mbtk/rootfs/usr/lib/* mbtk/toolchain/linux64/usr/lib/
b.liude66b442025-05-15 15:17:48 +0800258
259 cp -r marvell/services/ril/include/* mbtk/toolchain/linux64/include/
260 cp -r marvell/services/audio/include/* mbtk/toolchain/linux64/include/
261 cp -r marvell/services/audio/include/stub/* mbtk/toolchain/linux64/include/
262 cp -r marvell/services/audio/tinyalsa/include/* mbtk/toolchain/linux64/include/
263 cp -r marvell/services/audio/libaudio-apu/*.h mbtk/toolchain/linux64/include/
264 cp -r marvell/lte-telephony/apps/aud_sw/vcm_ipc/*.h mbtk/toolchain/linux64/include/
b.liud440f9f2025-04-18 10:44:31 +0800265 fi
266
267 if [ "$SEC_SUPPORT" == "Y" ];then
268 if [ -f mbtk/gcc-arm-none-linux-gnueabihf.tar.gz -a ! -d mbtk/toolchain/gcc-arm-arm-none-linux-gnueabihf ];then
269 echo "Dec file : gcc-arm-none-linux-gnueabihf.tar.gz to mbtk/toolchain."
270 tar zxf mbtk/gcc-arm-none-linux-gnueabihf.tar.gz -C mbtk/toolchain
271 fi
272 fi
273}
274
275build_oem()
276{
277 excmd mkdir -p $DIR_BUILD_TARGET/root-mmp/NVM/oem_data
278 excmd rm -rf $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/oem_fs
279 excmd mkdir -p $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/oem_fs
280 excmd cp -fpR target/linux/mmp/$ASR_PROJECT_NAME/oem_fs/* $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/oem_fs/
281 excmd staging_dir/host/bin/mkfs.ubifs -m 2048 -e 126976 -c 156 -F --space-fixup --compr=zlib -o $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/oem_data.ubifs -d $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/oem_fs
282 excmd mkdir -p $DIR_BIN/swd/
283 if [ -e ./$ASR_PROJECT_NAME$ASR_PROJECT_PATCH-ubinize-oem.cfg ]; then
284 excmd cp -fpR ./$ASR_PROJECT_NAME$ASR_PROJECT_PATCH-ubinize-oem.cfg $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/ubinize-oem.cfg;
285 else
286 excmd cp -fpR ./target/linux/mmp/image/ubinize-oem.cfg $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/ubinize-oem.cfg;
287 fi
288 excmd cd $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME;
289 excmd sed -i 's/vol_size=.*KiB/vol_size=19344KiB/g' ubinize-oem.cfg; ../../../staging_dir/host/bin/ubinize -m 2048 -p 131072 -s 2048 -o ../../../$DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/oem_data.ubi ubinize-oem.cfg
290 excmd cd ../../..
291 excmd cp -fpR $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/oem_data.ubi $DIR_BIN/swd/openwrt-mmp-$ASR_PROJECT_NAME-oem_data.ubi
292}
293
294build_busybox()
295{
296 if [ -d mbtk/busybox-1.36.1 ];then
297 CUR_PWD=`pwd`
298 cd mbtk/busybox-1.36.1
299 [ -f busybox.config ] && cp busybox.config .config
300 make install
301
302 if [ ! -d ../rootfs/bin ];then
303 mkdir ../rootfs/bin
304 fi
305
306 if [ -f _install/bin/busybox ];
307 then
308 cp -f _install/bin/busybox ../rootfs/bin
309 fi
310
311 cd $CUR_PWD
312 fi
313}
314
315build()
316{
317 # 1806
318# if [ "$DECONFIG_FILE" == "defconfig_asr1806p301" ];then
319 excmd make $1/{clean,compile} V=99 2>&1 | tee build.log
320# else
321# excmd make $1/{clean,compile,install} V=99 2>&1 | tee build.log
322# fi
323}
324
325mbtk_version_update()
326{
327 # SDK
328 if [ -f mbtk/mbtk_version ];then
329 PATCH_INDEX=`cat mbtk/mbtk_version | grep PATCH_INDEX | cut -d '=' -f 2`
330 if [ -z $PATCH_INDEX ];then
331 PATCH_INDEX=0
332 fi
333 if [ $PATCH_INDEX -lt 10 ];then
334 PATCH_INDEX=00"$PATCH_INDEX"
335 else
336 if [ $PATCH_INDEX -lt 100 ];then
337 PATCH_INDEX=0"$PATCH_INDEX"
338 fi
339 fi
340
341 # T108v05.02b01_YX.00
342 MBTK_VERSION=${version#*:= }
343 MBTK_VERSION_1=`echo $MBTK_VERSION | cut -d '.' -f 1`
344 MBTK_VERSION_2=`echo $MBTK_VERSION | cut -d '.' -f 2`
345 MBTK_VERSION_3=`echo $MBTK_VERSION | cut -d '.' -f 3`
346 if [[ $MBTK_VERSION_3 == *_* ]];then # 有 '_'
347 MBTK_VERSION_3_1=`echo $MBTK_M1901_VERSION_3 | cut -d '_' -f 1`
348 MBTK_VERSION_3_2=`echo $MBTK_M1901_VERSION_3 | cut -d '_' -f 2`
349
350 MBTK_VERSION=$MBTK_VERSION_1.$MBTK_VERSION_2."$PATCH_INDEX"_$MBTK_VERSION_3_2
351 else
352 MBTK_VERSION=$MBTK_VERSION_1.$MBTK_VERSION_2.$PATCH_INDEX
353 fi
354
355 echo "Version : $MBTK_VERSION"
356 sed -i "s/$version/$MBTK_VERSION/" $versionFile
357 fi
358}
359
360build_menuconfig()
361{
362 build_init
363 make menuconfig
364
365 cp -f .config config/$DECONFIG_FILE
366}
367
368config_init()
369{
370 PROJECT=`cat build_version | grep -w 'PROJECT' | cut -d '=' -f 2`
371# PYTHON_SUPPORT=`cat build_version | grep -w 'PYTHON_SUPPORT' | cut -d '=' -f 2`
372 SEC_SUPPORT=`cat build_version | grep -w 'SEC_SUPPORT' | cut -d '=' -f 2`
373 echo "PROJECT = $PROJECT"
374# echo "PYTHON_SUPPORT = $PYTHON_SUPPORT"
375 echo "SEC_SUPPORT = $SEC_SUPPORT"
376 if [ "$PROJECT" == "L901CD-L" ];then
377 ASR_PROJECT_NAME=asr1903
378 ASR_PROJECT_PATCH=p501
379 elif [ "$PROJECT" == "T108" -o "$PROJECT" == "T108-2" -o "$PROJECT" == "L508_X6" ];then
380 ASR_PROJECT_NAME=asr1806
381 ASR_PROJECT_PATCH=p301
382 else
383 ASR_PROJECT_NAME=asr1803
384 ASR_PROJECT_PATCH=p401
385 fi
386
387 DECONFIG_FILE=defconfig_$ASR_PROJECT_NAME$ASR_PROJECT_PATCH
388
389 if [ "$SEC_SUPPORT" == "Y" ];then
390 if [ "$GLIBC_NAME" == "glibc" ];then
391 DIR_BIN=bin/"$ASR_PROJECT_NAME$ASR_PROJECT_PATCH"sec_glibc
392 else
393 DIR_BIN=bin/"$ASR_PROJECT_NAME$ASR_PROJECT_PATCH"sec
394 fi
395 sed -i "/.*CONFIG_PACKAGE_mbtk-rootfs/c\CONFIG_PACKAGE_mbtk-rootfs=y" config/$DECONFIG_FILE
396 else
397 if [ "$GLIBC_NAME" == "glibc" ];then
hong.liu0d542592025-06-05 16:21:58 +0800398 DIR_BIN=bin/"$ASR_PROJECT_NAME$ASR_PROJECT_PATCH"-glibc
b.liud440f9f2025-04-18 10:44:31 +0800399 else
400 DIR_BIN=bin/"$ASR_PROJECT_NAME$ASR_PROJECT_PATCH"
401 fi
402 sed -i "/.*CONFIG_PACKAGE_mbtk-rootfs/c\# CONFIG_PACKAGE_mbtk-rootfs is not set" config/$DECONFIG_FILE
403 fi
404}
b.liude66b442025-05-15 15:17:48 +0800405
b.liub17525e2025-05-14 17:22:29 +0800406toolchain_generate()
407{
408 MBTK_TOOLCHAIN_DIR=mbtk_toolchain
409
410 if [ ! -d mbtk/toolchain/linux64 ];then
411 echo "Build in the first."
412 exit 1
413 fi
414
415 [ -d $MBTK_TOOLCHAIN_DIR ] && rm -rf $MBTK_TOOLCHAIN_DIR
416 [ ! -d $MBTK_TOOLCHAIN_DIR ] && mkdir -p $MBTK_TOOLCHAIN_DIR
417
418 echo "Start copy toolchain..."
419 cp -r mbtk/toolchain/linux64 $MBTK_TOOLCHAIN_DIR/toolchain
420
421 echo "Start copy mbtk header files and libs..."
422 mkdir $MBTK_TOOLCHAIN_DIR/mbtk
423 cp -r mbtk/include $MBTK_TOOLCHAIN_DIR/mbtk
424 cp -r mbtk/rootfs/lib $MBTK_TOOLCHAIN_DIR/mbtk
425
426 echo "Start copy mbtk config files..."
427 cp -r mbtk/mbtk_toolchain_config/* $MBTK_TOOLCHAIN_DIR
428
429 echo "Delete unnecessary files..."
430 # rm -rf $MBTK_TOOLCHAIN_DIR/toolchain/usr
b.liuf7f2d6d2025-05-20 15:10:18 +0800431 [ -d $MBTK_TOOLCHAIN_DIR/toolchain/initial ] && rm -rf $MBTK_TOOLCHAIN_DIR/toolchain/initial
432 [ -f $MBTK_TOOLCHAIN_DIR/toolchain/include.zip ] && rm $MBTK_TOOLCHAIN_DIR/toolchain/include.zip
b.liub17525e2025-05-14 17:22:29 +0800433
434 echo "Start packaging toolchain..."
435 tar -zcf mbtk_toolchain.tar.gz mbtk_toolchain/
436
437 echo "Toolchain generate complete."
438}
b.liud440f9f2025-04-18 10:44:31 +0800439
440################################################################
441### Start ########
442################################################################
443if [ ! -f build_version ];then
444 echo "No found file: build_version"
445 exit 1
446else
447 config_init
448fi
449
450start=$(date +"%s.%N")
451starttime=`date +"%Y-%m-%d %H:%M:%S"`
452
453ROOTFS_DIR="mbtk/rootfs"
454ln_lib
455
456if [ -n "$1" ] ;then #有参数
457 if [ ! -d "feeds/" -a "$1" != "menuconfig" ]; then
458 echo "Must make all in the first."
459 exit 1
460 fi
461
462 case "$1" in
463 clean)
464 # Can not remove toolchain.
465 # [ -d mbtk/toolchain ] && rm -rf mbtk/toolchain
466 excmd make distclean
467 ;;
468 kernel)
469 build target/linux
470 ;;
471 oem)
472 if [ "$SEC_SUPPORT" == "Y" ];then
473 echo "No support."
474 else
475 build_oem
476 fi
477 ;;
478 obm)
479 excmd make package/boot/obm-mmp/{clean,compile} V=99 2>&1 | tee build.log
480 excmd cp -f $DIR_BIN/"$ASR_PROJECT_NAME"_TLoader_QSPINAND.bin $DIR_BIN/swd
481 excmd cp -f $DIR_BIN/"$ASR_PROJECT_NAME"_TLoader_QSPINAND_ProductBuild.bin $DIR_BIN/swd
482 ;;
483 uboot)
484 excmd make package/boot/uboot-mmp/{clean,compile} V=99 2>&1 | tee build.log
485 excmd cp -f $DIR_BIN/openwrt-mmp-"$ASR_PROJECT_NAME"-u-boot.bin $DIR_BIN/swd
486 ;;
487 ffmpeg)
488 build package/feeds/packages/ffmpeg
489 ;;
490 mbtk-rootfs)
491 if [ "$SEC_SUPPORT" == "Y" ];then
492 excmd make package/$1/{clean,compile} V=99 2>&1 | tee build.log
493 else
494 echo "No support."
495 fi
496 ;;
497 openssl)
498 excmd make package/libs/$1/{clean,compile} V=99 2>&1 | tee build.log
499 ;;
500 mbtk)
501 build_mbtk
502 ;;
503 mbtk_clean)
504 build_mbtk_clean
505 ;;
506 rootfs)
507 if [ "$SEC_SUPPORT" == "Y" ];then
508 echo "No support."
509 else
510 build_mbtk
511 build_rootfs
512 fi
513 ;;
514 lte)
515 build package/network/services/lte-telephony
516 ;;
517 audio)
518 build package/services/audio_if
519 ;;
520 fstools)
521 build package/system/fstools
522 ;;
523 ril)
524 build package/services/ril
525 ;;
526 gnss)
527 build package/services/gnss
528 ;;
529 libprop2uci)
530 build package/libs/libprop2uci
531 ;;
532 con_mgr)
533 build package/services/con_mgr
534 ;;
535 ecall)
536 build package/services/ecall_daemon
537 ;;
538 adbd)
539 build package/utils/adbd
540 ;;
541 menuconfig)
542 build_menuconfig
543 ;;
544 openssl)
545 excmd make package/libs/openssl/{clean,compile,install} V=99 2>&1 | tee build.log
546 ;;
547 busybox)
548 build_busybox
549 ;;
b.liub17525e2025-05-14 17:22:29 +0800550 toolchain)
551 toolchain_generate
552 ;;
553 optee)
554 build package/services/optee_app
555 ;;
b.liud440f9f2025-04-18 10:44:31 +0800556 *)
557 SUB_DIR=`find package/ -type d -name "$1" | sed -n '1,1p'`
558 if [ x$SUB_DIR = x ]
559 then
560 echo -e "${red}==Have No module: $1==${NC}"
561 exit 1
562 fi
563 echo -e "Build: ${green}${1}${NC} ${red}${SUB_DIR}${NC}"
564 build $SUB_DIR
565 ;;
566 esac
567else # 全编
568
569 cp $versionFile $versionFile.backup
570 # Change version
571 mbtk_version_update
572
573 # Start build.
574 excmd build_init
575 #if [ -d mbtk/toolchain ];then
576 # build_mbtk
577 #fi
578 # OPT_SEC=y
579 if [ "$SEC_SUPPORT" == "Y" ];then
580 # build mbtk lib in the first.
hong.liu802f6e02025-07-25 13:49:22 +0800581 #build_mbtk
lichengzhangac8cb002025-07-07 17:14:34 +0800582 excmd make -j8 V=99 2>&1 | tee build.log
583 # excmd make OPT_SEC=y -j1 V=99 2>&1 | tee build.log
b.liud440f9f2025-04-18 10:44:31 +0800584 else
585 excmd make -j8 V=99 2>&1 | tee build.log
586 fi
587
588 mv $versionFile.backup $versionFile
589
590 tail -n1 build.log | grep Error
591 if [ $? -eq "0" ]; then
592 echo "********************Build Fail*****************"
593 else
594 if [ "$SEC_SUPPORT" == "Y" ];then
595 echo "********************Build Success*****************"
596 else
597 echo "********************Build Success*****************"
598 copy_toolchain
599 build_busybox
600 build_mbtk
601 build_rootfs
602 fi
603
604 # ./pack.sh all
605 fi
606fi
607excmd date >> build.log
608end=$(date +"%s.%N")
609endtime=`date +"%Y-%m-%d %H:%M:%S"`
610
611echo -e "${green}***********************************${NC}"
612echo -e "${green}* ${NC}Start time: "$starttime ${green}*${NC}
613echo -e "${green}* ${NC}End time: "$endtime ${green}*${NC}
614timediff $start $end
615echo -e "${green}***********************************${NC}"