| #!/bin/bash |
| |
| red='\e[0;31m' # 红色 |
| green='\e[0;32m' # 绿色 |
| NC='\e[0m' # 没有颜色 |
| |
| export STAGING_DIR= |
| DECONFIG_FILE= |
| |
| # glibc / musl |
| GLIBC_NAME=glibc |
| ASR_PROJECT_NAME= |
| ASR_PROJECT_PATCH= |
| |
| DIR_BUILD_TARGET=build_dir/target-arm_cortex-a7+neon-vfpv4_"$GLIBC_NAME"_eabi |
| DIR_STAGING_TARGET=staging_dir/target-arm_cortex-a7+neon-vfpv4_"$GLIBC_NAME"_eabi |
| DIR_BIN= |
| |
| versionFile='mbtk/include/mbtk_device_info.h' |
| version=`cat $versionFile | grep -w 'MBTK_DEVICES_REVISION' | cut -d '"' -f 2 ` |
| |
| usage() |
| { |
| echo "Usage : ./build.sh <clean/path>" |
| } |
| |
| function excmd() |
| { |
| echo -e "${green}Excmd:${NC} $@ ..." |
| # && sleep 1 |
| $@ |
| } |
| |
| function timediff() { |
| # time format:date +"%s.%N", such as 1502758855.907197692 |
| start_time=$1 |
| end_time=$2 |
| |
| start_s=${start_time%.*} |
| start_nanos=${start_time#*.} |
| end_s=${end_time%.*} |
| end_nanos=${end_time#*.} |
| |
| # end_nanos > start_nanos? |
| # Another way, the time part may start with 0, which means |
| # it will be regarded as oct format, use "10#" to ensure |
| # calculateing with decimal |
| |
| if [ "$end_nanos" -lt "$start_nanos" ];then |
| end_s=$(( 10#$end_s - 1 )) |
| end_nanos=$(( 10#$end_nanos + 10**9 )) |
| fi |
| |
| # get timediff |
| time=$(( 10#$end_s - 10#$start_s )).`printf "%03ds" $(( (10#$end_nanos - 10#$start_nanos)/10**6 ))` |
| time_min=$(((end_s - start_s)/60 + 1)) |
| echo -e "${green}*${NC} Spend time: "$time \(\~ ${time_min}min\) ${green}***${NC} |
| } |
| |
| init_check() |
| { |
| |
| if [ ! -f "config/$DECONFIG_FILE" ]; then |
| echo 'Must exec "init.sh" in the first.' |
| exit 1 |
| fi |
| |
| # if [ ! -f "../pack.sh" ]; then |
| # echo 'Must exec "init.sh" in the first.' |
| # exit 1 |
| # fi |
| |
| } |
| |
| build_init() |
| { |
| init_check |
| |
| if [ ! -d "feeds/" ]; then |
| echo "Start build inti..." |
| excmd ./scripts/feeds update -a |
| excmd ./scripts/feeds install -a |
| |
| echo "$DECONFIG_FILE" |
| |
| # if [ "$DECONFIG_FILE" == "defconfig_asr1803p401" ];then |
| # excmd make prereq |
| # fi |
| |
| #excmd make $DECONFIG_FILE |
| fi |
| |
| if [ -f .config ];then |
| rm .config |
| fi |
| |
| excmd make $DECONFIG_FILE |
| } |
| |
| copy_bin() |
| { |
| echo "Start copy bin..." |
| # [ -f $MBTK_DIR/out/bin/mbtk_audio_set ] && cp -f $MBTK_DIR/out/bin/mbtk_audio_set $MBTK_DIR/bin |
| [ -f $MBTK_DIR/../out/bin/device_info ] && cp -f $MBTK_DIR/../out/bin/device_info $MBTK_DIR/bin |
| } |
| |
| copy_lib() |
| { |
| echo "Start copy lib..." |
| [ -f $MBTK_DIR/../out/lib/liblynq_lib.so ] && cp -f $MBTK_DIR/../out/lib/liblynq_lib.so $MBTK_DIR/lib |
| # [ -f $MBTK_DIR/../out/lib/libql_lib.so.* ] && cp -f $MBTK_DIR/../out/lib/libql_lib.so.* $MBTK_DIR/lib |
| |
| ls $MBTK_DIR/../out/lib/libql_lib.so.* |
| if [ $? -eq 0 ];then |
| cp -f $MBTK_DIR/../out/lib/libql_lib.so.* $MBTK_DIR/lib |
| fi |
| |
| } |
| |
| ln_lib() |
| { |
| PWD_TEMP=`pwd` |
| |
| cd $ROOTFS_DIR/lib |
| if [ -f liblynq_lib.so ];then |
| [ ! -f libpoweralarm.so ] && ln -s liblynq_lib.so libpoweralarm.so |
| [ ! -f liblynq-qser-audio.so ] && ln -s liblynq_lib.so liblynq-qser-audio.so |
| [ ! -f liblynq-adc.so ] && ln -s liblynq_lib.so liblynq-adc.so |
| [ ! -f liblynq-fota.so ] && ln -s liblynq_lib.so liblynq-fota.so |
| [ ! -f liblynq-qser-gnss.so ] && ln -s liblynq_lib.so liblynq-qser-gnss.so |
| [ ! -f liblynq-log.so ] && ln -s liblynq_lib.so liblynq-log.so |
| [ ! -f liblynq-led.so ] && ln -s liblynq_lib.so liblynq-led.so |
| [ ! -f liblynq-qser-autosuspend.so ] && ln -s liblynq_lib.so liblynq-qser-autosuspend.so |
| [ ! -f liblynq-systime.so ] && ln -s liblynq_lib.so liblynq-systime.so |
| [ ! -f liblynq-qser-thermal.so ] && ln -s liblynq_lib.so liblynq-qser-thermal.so |
| [ ! -f liblynq-qser-sim.so ] && ln -s liblynq_lib.so liblynq-qser-sim.so |
| [ ! -f liblynq-qser-sms.so ] && ln -s liblynq_lib.so liblynq-qser-sms.so |
| [ ! -f liblynq-qser-voice.so ] && ln -s liblynq_lib.so liblynq-qser-voice.so |
| [ ! -f liblynq-qser-network.so ] && ln -s liblynq_lib.so liblynq-qser-network.so |
| [ ! -f liblynq-qser-data.so ] && ln -s liblynq_lib.so liblynq-qser-data.so |
| [ ! -f liblynq-irq.so ] && ln -s liblynq_lib.so liblynq-irq.so |
| fi |
| |
| cd $PWD_TEMP |
| } |
| |
| build_mbtk() |
| { |
| copy_toolchain |
| make -C mbtk/ || exit 1 |
| |
| ROOTFS_DIR=$DIR_BUILD_TARGET/root-mmp |
| MBTK_DIR=mbtk/rootfs |
| |
| if [ "$SEC_SUPPORT" == "Y" ];then |
| # copy_lib |
| if [ -d $ROOTFS_DIR ];then |
| echo "Start build optee_test..." |
| [ -d mbtk/optee_test ] && make clean -C mbtk/optee_test && make -C mbtk/optee_test |
| echo "Should copy to mbtk/rootfs and build.sh if necessary." |
| fi |
| else |
| if [ -f staging_dir/host/bin/sstrip ];then |
| STRIP_FILE=./staging_dir/host/bin/sstrip |
| else |
| STRIP_FILE=./host/linux64/bin/sstrip |
| fi |
| |
| if [ ! -d $ROOTFS_DIR ];then |
| mkdir -p $ROOTFS_DIR |
| fi |
| |
| excmd cp -rf $MBTK_DIR/* $ROOTFS_DIR/ |
| |
| CUR_PWD=`pwd` |
| cd $ROOTFS_DIR/etc/rc.d |
| if [ ! -f S15mbtk_boot_normal -a -f ../init.d/mbtk_boot_normal ];then |
| ln -s ../init.d/mbtk_boot_normal S15mbtk_boot_normal |
| fi |
| if [ ! -f S98mbtk_boot_last -a -f ../init.d/mbtk_boot_last ];then |
| ln -s ../init.d/mbtk_boot_last S98mbtk_boot_last |
| fi |
| if [ ! -f S13mbtk_logd -a -f ../init.d/mbtk_logd ];then |
| ln -s ../init.d/mbtk_logd S13mbtk_logd |
| fi |
| |
| if [ ! -f S12gsw_start -a -f ../init.d/gsw_start ];then |
| ln -s ../init.d/gsw_start S12gsw_start |
| fi |
| mv S10adbd S13adbd |
| mv S10dnsmasq S13dnsmasq |
| mv S10sdcard_mount S20sdcard_mount |
| |
| cd $CUR_PWD |
| |
| if [ -d $MBTK_DIR/lib_tmp ];then |
| rm -rf $MBTK_DIR/lib_tmp |
| fi |
| |
| if [ -d $MBTK_DIR/bin_tmp ];then |
| rm -rf $MBTK_DIR/bin_tmp |
| fi |
| |
| # copy_lib |
| |
| copy_bin |
| |
| cp -r $MBTK_DIR/lib $MBTK_DIR/lib_tmp |
| cp -r $MBTK_DIR/bin $MBTK_DIR/bin_tmp |
| |
| 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 |
| 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 |
| |
| cp $MBTK_DIR/lib_tmp/* $ROOTFS_DIR/lib |
| cp $MBTK_DIR/bin_tmp/* $ROOTFS_DIR/bin |
| rm -rf $MBTK_DIR/lib_tmp |
| rm -rf $MBTK_DIR/bin_tmp |
| |
| [ -f $ROOTFS_DIR/etc/init.d/wpad ] && rm $ROOTFS_DIR/etc/init.d/wpad |
| ln_lib |
| fi |
| } |
| |
| |
| build_mbtk_clean() |
| { |
| cd mbtk |
| make clean |
| cd .. |
| } |
| |
| build_rootfs() |
| { |
| if [ -f ./staging_dir/host/bin/mksquashfs4 ];then |
| EXEC=./staging_dir/host/bin/mksquashfs4 |
| else |
| EXEC=./host/linux64/bin/mksquashfs4 |
| fi |
| |
| $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 |
| excmd dd if=$DIR_BUILD_TARGET/linux-mmp_"$ASR_PROJECT_NAME"/root.squashfs of=$DIR_BIN/swd/openwrt-mmp-"$ASR_PROJECT_NAME"-root.squashfs |
| } |
| |
| copy_toolchain() |
| { |
| # 1806 |
| if [ ! -d mbtk/toolchain ];then |
| if [ ! -d owtoolchain/linux64 ];then |
| "Build all in the first." |
| exit 1 |
| fi |
| echo "Start Copy Build Toolchain..." |
| mkdir -p mbtk/toolchain |
| cp -r owtoolchain/linux64 mbtk/toolchain/ |
| cp -r mbtk/toolchain/linux64/include/* mbtk/toolchain/linux64/usr/include/ |
| cp -r $DIR_STAGING_TARGET/usr/* mbtk/toolchain/linux64/usr/ |
| cp -r mbtk/toolchain/linux64/usr/include/* mbtk/toolchain/linux64/include/ |
| cp -drf $DIR_BUILD_TARGET/audio/obj/olibs/* mbtk/toolchain/linux64/usr/lib/ |
| cp -r marvell/services/audio_if/include/* mbtk/toolchain/linux64/include/ |
| cp -r mbtk/rootfs/usr/lib/* mbtk/toolchain/linux64/usr/lib/ |
| |
| cp -r marvell/services/ril/include/* mbtk/toolchain/linux64/include/ |
| cp -r marvell/services/audio/include/* mbtk/toolchain/linux64/include/ |
| cp -r marvell/services/audio/include/stub/* mbtk/toolchain/linux64/include/ |
| cp -r marvell/services/audio/tinyalsa/include/* mbtk/toolchain/linux64/include/ |
| cp -r marvell/services/audio/libaudio-apu/*.h mbtk/toolchain/linux64/include/ |
| cp -r marvell/lte-telephony/apps/aud_sw/vcm_ipc/*.h mbtk/toolchain/linux64/include/ |
| fi |
| |
| if [ "$SEC_SUPPORT" == "Y" ];then |
| if [ -f mbtk/gcc-arm-none-linux-gnueabihf.tar.gz -a ! -d mbtk/toolchain/gcc-arm-arm-none-linux-gnueabihf ];then |
| echo "Dec file : gcc-arm-none-linux-gnueabihf.tar.gz to mbtk/toolchain." |
| tar zxf mbtk/gcc-arm-none-linux-gnueabihf.tar.gz -C mbtk/toolchain |
| fi |
| fi |
| } |
| |
| build_oem() |
| { |
| excmd mkdir -p $DIR_BUILD_TARGET/root-mmp/NVM/oem_data |
| excmd rm -rf $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/oem_fs |
| excmd mkdir -p $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/oem_fs |
| excmd cp -fpR target/linux/mmp/$ASR_PROJECT_NAME/oem_fs/* $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/oem_fs/ |
| 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 |
| excmd mkdir -p $DIR_BIN/swd/ |
| if [ -e ./$ASR_PROJECT_NAME$ASR_PROJECT_PATCH-ubinize-oem.cfg ]; then |
| excmd cp -fpR ./$ASR_PROJECT_NAME$ASR_PROJECT_PATCH-ubinize-oem.cfg $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/ubinize-oem.cfg; |
| else |
| excmd cp -fpR ./target/linux/mmp/image/ubinize-oem.cfg $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME/ubinize-oem.cfg; |
| fi |
| excmd cd $DIR_BUILD_TARGET/linux-mmp_$ASR_PROJECT_NAME; |
| 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 |
| excmd cd ../../.. |
| 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 |
| } |
| |
| build_busybox() |
| { |
| if [ -d mbtk/busybox-1.36.1 ];then |
| CUR_PWD=`pwd` |
| cd mbtk/busybox-1.36.1 |
| [ -f busybox.config ] && cp busybox.config .config |
| make install |
| |
| if [ ! -d ../rootfs/bin ];then |
| mkdir ../rootfs/bin |
| fi |
| |
| if [ -f _install/bin/busybox ]; |
| then |
| cp -f _install/bin/busybox ../rootfs/bin |
| fi |
| |
| cd $CUR_PWD |
| fi |
| } |
| |
| build() |
| { |
| # 1806 |
| # if [ "$DECONFIG_FILE" == "defconfig_asr1806p301" ];then |
| excmd make $1/{clean,compile} V=99 2>&1 | tee build.log |
| # else |
| # excmd make $1/{clean,compile,install} V=99 2>&1 | tee build.log |
| # fi |
| } |
| |
| mbtk_version_update() |
| { |
| # SDK |
| if [ -f mbtk/mbtk_version ];then |
| PATCH_INDEX=`cat mbtk/mbtk_version | grep PATCH_INDEX | cut -d '=' -f 2` |
| if [ -z $PATCH_INDEX ];then |
| PATCH_INDEX=0 |
| fi |
| if [ $PATCH_INDEX -lt 10 ];then |
| PATCH_INDEX=00"$PATCH_INDEX" |
| else |
| if [ $PATCH_INDEX -lt 100 ];then |
| PATCH_INDEX=0"$PATCH_INDEX" |
| fi |
| fi |
| |
| # T108v05.02b01_YX.00 |
| MBTK_VERSION=${version#*:= } |
| MBTK_VERSION_1=`echo $MBTK_VERSION | cut -d '.' -f 1` |
| MBTK_VERSION_2=`echo $MBTK_VERSION | cut -d '.' -f 2` |
| MBTK_VERSION_3=`echo $MBTK_VERSION | cut -d '.' -f 3` |
| if [[ $MBTK_VERSION_3 == *_* ]];then # 有 '_' |
| MBTK_VERSION_3_1=`echo $MBTK_M1901_VERSION_3 | cut -d '_' -f 1` |
| MBTK_VERSION_3_2=`echo $MBTK_M1901_VERSION_3 | cut -d '_' -f 2` |
| |
| MBTK_VERSION=$MBTK_VERSION_1.$MBTK_VERSION_2."$PATCH_INDEX"_$MBTK_VERSION_3_2 |
| else |
| MBTK_VERSION=$MBTK_VERSION_1.$MBTK_VERSION_2.$PATCH_INDEX |
| fi |
| |
| echo "Version : $MBTK_VERSION" |
| sed -i "s/$version/$MBTK_VERSION/" $versionFile |
| fi |
| } |
| |
| build_menuconfig() |
| { |
| build_init |
| make menuconfig |
| |
| cp -f .config config/$DECONFIG_FILE |
| } |
| |
| config_init() |
| { |
| PROJECT=`cat build_version | grep -w 'PROJECT' | cut -d '=' -f 2` |
| # PYTHON_SUPPORT=`cat build_version | grep -w 'PYTHON_SUPPORT' | cut -d '=' -f 2` |
| SEC_SUPPORT=`cat build_version | grep -w 'SEC_SUPPORT' | cut -d '=' -f 2` |
| echo "PROJECT = $PROJECT" |
| # echo "PYTHON_SUPPORT = $PYTHON_SUPPORT" |
| echo "SEC_SUPPORT = $SEC_SUPPORT" |
| if [ "$PROJECT" == "L901CD-L" ];then |
| ASR_PROJECT_NAME=asr1903 |
| ASR_PROJECT_PATCH=p501 |
| elif [ "$PROJECT" == "T108" -o "$PROJECT" == "T108-2" -o "$PROJECT" == "L508_X6" ];then |
| ASR_PROJECT_NAME=asr1806 |
| ASR_PROJECT_PATCH=p301 |
| else |
| ASR_PROJECT_NAME=asr1803 |
| ASR_PROJECT_PATCH=p401 |
| fi |
| |
| DECONFIG_FILE=defconfig_$ASR_PROJECT_NAME$ASR_PROJECT_PATCH |
| |
| if [ "$SEC_SUPPORT" == "Y" ];then |
| if [ "$GLIBC_NAME" == "glibc" ];then |
| DIR_BIN=bin/"$ASR_PROJECT_NAME$ASR_PROJECT_PATCH"sec_glibc |
| else |
| DIR_BIN=bin/"$ASR_PROJECT_NAME$ASR_PROJECT_PATCH"sec |
| fi |
| sed -i "/.*CONFIG_PACKAGE_mbtk-rootfs/c\CONFIG_PACKAGE_mbtk-rootfs=y" config/$DECONFIG_FILE |
| else |
| if [ "$GLIBC_NAME" == "glibc" ];then |
| DIR_BIN=bin/"$ASR_PROJECT_NAME$ASR_PROJECT_PATCH"-glibc |
| else |
| DIR_BIN=bin/"$ASR_PROJECT_NAME$ASR_PROJECT_PATCH" |
| fi |
| sed -i "/.*CONFIG_PACKAGE_mbtk-rootfs/c\# CONFIG_PACKAGE_mbtk-rootfs is not set" config/$DECONFIG_FILE |
| fi |
| } |
| |
| toolchain_generate() |
| { |
| MBTK_TOOLCHAIN_DIR=mbtk_toolchain |
| |
| if [ ! -d mbtk/toolchain/linux64 ];then |
| echo "Build in the first." |
| exit 1 |
| fi |
| |
| [ -d $MBTK_TOOLCHAIN_DIR ] && rm -rf $MBTK_TOOLCHAIN_DIR |
| [ ! -d $MBTK_TOOLCHAIN_DIR ] && mkdir -p $MBTK_TOOLCHAIN_DIR |
| |
| echo "Start copy toolchain..." |
| cp -r mbtk/toolchain/linux64 $MBTK_TOOLCHAIN_DIR/toolchain |
| |
| echo "Start copy mbtk header files and libs..." |
| mkdir $MBTK_TOOLCHAIN_DIR/mbtk |
| cp -r mbtk/include $MBTK_TOOLCHAIN_DIR/mbtk |
| cp -r mbtk/rootfs/lib $MBTK_TOOLCHAIN_DIR/mbtk |
| |
| echo "Start copy mbtk config files..." |
| cp -r mbtk/mbtk_toolchain_config/* $MBTK_TOOLCHAIN_DIR |
| |
| echo "Delete unnecessary files..." |
| # rm -rf $MBTK_TOOLCHAIN_DIR/toolchain/usr |
| [ -d $MBTK_TOOLCHAIN_DIR/toolchain/initial ] && rm -rf $MBTK_TOOLCHAIN_DIR/toolchain/initial |
| [ -f $MBTK_TOOLCHAIN_DIR/toolchain/include.zip ] && rm $MBTK_TOOLCHAIN_DIR/toolchain/include.zip |
| |
| echo "Start packaging toolchain..." |
| tar -zcf mbtk_toolchain.tar.gz mbtk_toolchain/ |
| |
| echo "Toolchain generate complete." |
| } |
| |
| ################################################################ |
| ### Start ######## |
| ################################################################ |
| if [ ! -f build_version ];then |
| echo "No found file: build_version" |
| exit 1 |
| else |
| config_init |
| fi |
| |
| start=$(date +"%s.%N") |
| starttime=`date +"%Y-%m-%d %H:%M:%S"` |
| |
| ROOTFS_DIR="mbtk/rootfs" |
| ln_lib |
| |
| if [ -n "$1" ] ;then #有参数 |
| if [ ! -d "feeds/" -a "$1" != "menuconfig" ]; then |
| echo "Must make all in the first." |
| exit 1 |
| fi |
| |
| case "$1" in |
| clean) |
| # Can not remove toolchain. |
| # [ -d mbtk/toolchain ] && rm -rf mbtk/toolchain |
| excmd make distclean |
| ;; |
| kernel) |
| build target/linux |
| ;; |
| oem) |
| if [ "$SEC_SUPPORT" == "Y" ];then |
| echo "No support." |
| else |
| build_oem |
| fi |
| ;; |
| obm) |
| excmd make package/boot/obm-mmp/{clean,compile} V=99 2>&1 | tee build.log |
| excmd cp -f $DIR_BIN/"$ASR_PROJECT_NAME"_TLoader_QSPINAND.bin $DIR_BIN/swd |
| excmd cp -f $DIR_BIN/"$ASR_PROJECT_NAME"_TLoader_QSPINAND_ProductBuild.bin $DIR_BIN/swd |
| ;; |
| uboot) |
| excmd make package/boot/uboot-mmp/{clean,compile} V=99 2>&1 | tee build.log |
| excmd cp -f $DIR_BIN/openwrt-mmp-"$ASR_PROJECT_NAME"-u-boot.bin $DIR_BIN/swd |
| ;; |
| ffmpeg) |
| build package/feeds/packages/ffmpeg |
| ;; |
| mbtk-rootfs) |
| if [ "$SEC_SUPPORT" == "Y" ];then |
| excmd make package/$1/{clean,compile} V=99 2>&1 | tee build.log |
| else |
| echo "No support." |
| fi |
| ;; |
| openssl) |
| excmd make package/libs/$1/{clean,compile} V=99 2>&1 | tee build.log |
| ;; |
| mbtk) |
| build_mbtk |
| ;; |
| mbtk_clean) |
| build_mbtk_clean |
| ;; |
| rootfs) |
| if [ "$SEC_SUPPORT" == "Y" ];then |
| echo "No support." |
| else |
| build_mbtk |
| build_rootfs |
| fi |
| ;; |
| lte) |
| build package/network/services/lte-telephony |
| ;; |
| audio) |
| build package/services/audio_if |
| ;; |
| fstools) |
| build package/system/fstools |
| ;; |
| ril) |
| build package/services/ril |
| ;; |
| gnss) |
| build package/services/gnss |
| ;; |
| libprop2uci) |
| build package/libs/libprop2uci |
| ;; |
| con_mgr) |
| build package/services/con_mgr |
| ;; |
| ecall) |
| build package/services/ecall_daemon |
| ;; |
| adbd) |
| build package/utils/adbd |
| ;; |
| menuconfig) |
| build_menuconfig |
| ;; |
| openssl) |
| excmd make package/libs/openssl/{clean,compile,install} V=99 2>&1 | tee build.log |
| ;; |
| busybox) |
| build_busybox |
| ;; |
| toolchain) |
| toolchain_generate |
| ;; |
| optee) |
| build package/services/optee_app |
| ;; |
| *) |
| SUB_DIR=`find package/ -type d -name "$1" | sed -n '1,1p'` |
| if [ x$SUB_DIR = x ] |
| then |
| echo -e "${red}==Have No module: $1==${NC}" |
| exit 1 |
| fi |
| echo -e "Build: ${green}${1}${NC} ${red}${SUB_DIR}${NC}" |
| build $SUB_DIR |
| ;; |
| esac |
| else # 全编 |
| |
| cp $versionFile $versionFile.backup |
| # Change version |
| mbtk_version_update |
| |
| # Start build. |
| excmd build_init |
| #if [ -d mbtk/toolchain ];then |
| # build_mbtk |
| #fi |
| # OPT_SEC=y |
| if [ "$SEC_SUPPORT" == "Y" ];then |
| # build mbtk lib in the first. |
| build_mbtk |
| excmd make -j8 V=99 2>&1 | tee build.log |
| # excmd make OPT_SEC=y -j1 V=99 2>&1 | tee build.log |
| else |
| excmd make -j8 V=99 2>&1 | tee build.log |
| fi |
| |
| mv $versionFile.backup $versionFile |
| |
| tail -n1 build.log | grep Error |
| if [ $? -eq "0" ]; then |
| echo "********************Build Fail*****************" |
| else |
| if [ "$SEC_SUPPORT" == "Y" ];then |
| echo "********************Build Success*****************" |
| else |
| echo "********************Build Success*****************" |
| copy_toolchain |
| build_busybox |
| build_mbtk |
| build_rootfs |
| fi |
| |
| # ./pack.sh all |
| fi |
| fi |
| excmd date >> build.log |
| end=$(date +"%s.%N") |
| endtime=`date +"%Y-%m-%d %H:%M:%S"` |
| |
| echo -e "${green}***********************************${NC}" |
| echo -e "${green}* ${NC}Start time: "$starttime ${green}*${NC} |
| echo -e "${green}* ${NC}End time: "$endtime ${green}*${NC} |
| timediff $start $end |
| echo -e "${green}***********************************${NC}" |