blob: 4d5117c47fa7f596fa1b75b11765aa930222f667 [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
15 export BUILD_PLATFORM=gcc-8.4
16else
17 export BUILD_PLATFORM=gcc-4.9
18fi
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 *)
36 exit 1;;
37 esac
38 else # 无参数
39 make || exit 1
40 fi
liubin281ac462023-07-19 14:22:54 +080041
liubin207854f2023-07-19 17:25:29 +080042 cd $ROOT_DIR
liubin281ac462023-07-19 14:22:54 +080043
liubin207854f2023-07-19 17:25:29 +080044 echo "Build MBTK success."
45}
46
47function file_copy()
48{
liubin1673a9c2023-07-19 20:59:43 +080049 ROOTFS_DIR=$ROOT_DIR/../asr_code/mbtk
liubin207854f2023-07-19 17:25:29 +080050
51 if [ -d $ROOTFS_DIR ];then
52 echo "Copy MBTK out files..."
53 if [ ! -d $ROOTFS_DIR/bin ];then
54 mkdir $ROOTFS_DIR/bin
55 fi
56 if [ ! -d $ROOTFS_DIR/lib ];then
57 mkdir $ROOTFS_DIR/lib
58 fi
59
60 # Copy All SO Files.
61 cp -f out/lib/* $ROOTFS_DIR/lib
62
63 # Copy All Bin Files.
liubinb8a0dd72023-08-04 15:26:48 +080064 #cp -f out/bin/* $ROOTFS_DIR/bin
65 cp -f out/bin/at $ROOTFS_DIR/bin
66 cp -f out/bin/mbtk_ril $ROOTFS_DIR/bin
67 cp -f out/bin/mbtk_logd $ROOTFS_DIR/bin
68 cp -f out/bin/mbtk_adbd $ROOTFS_DIR/bin
liubin207854f2023-07-19 17:25:29 +080069
70 else
71 echo "No found rootfs : $ROOTFS_DIR"
72 fi
73}
74
75function main()
76{
liubine760bd52023-07-20 15:57:21 +080077 if [ -n "$1" ] ;then
78 build $1
79 exit 0
80 fi
81
liubin1673a9c2023-07-19 20:59:43 +080082 if [ -d out/bin -a -d out/lib ];then
83 file_copy
84 else
85 if [ ! -d out/bin ];then
86 mkdir -p out/bin
87 fi
88
89 if [ ! -d out/lib ];then
90 mkdir -p out/lib
91 fi
92
93 build
94
95 file_copy
liubin207854f2023-07-19 17:25:29 +080096 fi
liubin207854f2023-07-19 17:25:29 +080097}
98
liubine760bd52023-07-20 15:57:21 +080099main $1