blob: 4cd3a7bc531a5d73eef0c63ae581670b6c551948 [file] [log] [blame]
liubin281ac462023-07-19 14:22:54 +08001#!/bin/bash
2
3# Config item.
4# static / shared
b.liu17d7f8b2023-10-08 16:57:59 +08005#LIB_TYPE=static
liubin281ac462023-07-19 14:22:54 +08006# gcc-4.9 / gcc-8.4
b.liu17d7f8b2023-10-08 16:57:59 +08007#export PLATFORM=gcc-4.9
8
9# static / shared
10export BUILD_LIB_TYPE=shared
11# gcc-4.9 / gcc-8.4
12
13grep "url" ../.git/config | cut -d " " -f 3 | grep "kernel_5.4.195"
14if [ $? -eq "0" ]; then
b.liu3403c932023-10-10 16:26:35 +080015 export BUILD_PLATFORM=asr1806
b.liu17d7f8b2023-10-08 16:57:59 +080016else
b.liu3403c932023-10-10 16:26:35 +080017 export BUILD_PLATFORM=asr1803
b.liu17d7f8b2023-10-08 16:57:59 +080018fi
liubin281ac462023-07-19 14:22:54 +080019
20ROOT_DIR=`pwd`
b.liu17d7f8b2023-10-08 16:57:59 +080021#TOOLCHAIN_DIR=$ROOT_DIR/toolchain/$BUILD_PLATFORM
22#echo "toolchain : $ROOT_DIR"
liubin281ac462023-07-19 14:22:54 +080023
liubin281ac462023-07-19 14:22:54 +080024
liubin281ac462023-07-19 14:22:54 +080025
liubin207854f2023-07-19 17:25:29 +080026function build()
27{
28 cd mbtk
liubin281ac462023-07-19 14:22:54 +080029
liubin207854f2023-07-19 17:25:29 +080030 if [ -n "$1" ] ;then
31 case "$1" in
32 clean)
33 make clean
34 ;;
35 *)
b.liu8f67dfb2023-11-27 11:27:51 +080036# exit 1;;
37 make -C $1
liubin207854f2023-07-19 17:25:29 +080038 esac
39 else # 无参数
40 make || exit 1
41 fi
liubin281ac462023-07-19 14:22:54 +080042
liubin207854f2023-07-19 17:25:29 +080043 cd $ROOT_DIR
liubin281ac462023-07-19 14:22:54 +080044
liubin207854f2023-07-19 17:25:29 +080045 echo "Build MBTK success."
46}
47
48function file_copy()
49{
liubin1673a9c2023-07-19 20:59:43 +080050 ROOTFS_DIR=$ROOT_DIR/../asr_code/mbtk
liubin207854f2023-07-19 17:25:29 +080051
52 if [ -d $ROOTFS_DIR ];then
53 echo "Copy MBTK out files..."
54 if [ ! -d $ROOTFS_DIR/bin ];then
55 mkdir $ROOTFS_DIR/bin
56 fi
57 if [ ! -d $ROOTFS_DIR/lib ];then
58 mkdir $ROOTFS_DIR/lib
59 fi
60
61 # Copy All SO Files.
62 cp -f out/lib/* $ROOTFS_DIR/lib
63
64 # Copy All Bin Files.
liubinb8a0dd72023-08-04 15:26:48 +080065 #cp -f out/bin/* $ROOTFS_DIR/bin
66 cp -f out/bin/at $ROOTFS_DIR/bin
67 cp -f out/bin/mbtk_ril $ROOTFS_DIR/bin
68 cp -f out/bin/mbtk_logd $ROOTFS_DIR/bin
69 cp -f out/bin/mbtk_adbd $ROOTFS_DIR/bin
liubin207854f2023-07-19 17:25:29 +080070
71 else
72 echo "No found rootfs : $ROOTFS_DIR"
73 fi
74}
75
76function main()
77{
liubine760bd52023-07-20 15:57:21 +080078 if [ -n "$1" ] ;then
79 build $1
80 exit 0
81 fi
82
b.liu2f89bfb2023-11-30 17:14:01 +080083 if [ -d out/bin -a -d out/lib ];then
84 build
85
86 file_copy
87 else
88 if [ ! -d out/bin ];then
89 mkdir -p out/bin
90 fi
91
92 if [ ! -d out/lib ];then
93 mkdir -p out/lib
94 fi
95
96 build
97
98 file_copy
99 fi
liubin207854f2023-07-19 17:25:29 +0800100}
101
liubine760bd52023-07-20 15:57:21 +0800102main $1