blob: 2691cb25afe5ff090856ae7028338e5b99459809 [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
b.liu1c1c7212023-12-22 16:35:27 +080020export STAGING_DIR=
21
liubin281ac462023-07-19 14:22:54 +080022ROOT_DIR=`pwd`
b.liu17d7f8b2023-10-08 16:57:59 +080023#TOOLCHAIN_DIR=$ROOT_DIR/toolchain/$BUILD_PLATFORM
24#echo "toolchain : $ROOT_DIR"
liubin281ac462023-07-19 14:22:54 +080025
liubin281ac462023-07-19 14:22:54 +080026
liubin281ac462023-07-19 14:22:54 +080027
liubin207854f2023-07-19 17:25:29 +080028function build()
29{
30 cd mbtk
liubin281ac462023-07-19 14:22:54 +080031
liubin207854f2023-07-19 17:25:29 +080032 if [ -n "$1" ] ;then
33 case "$1" in
34 clean)
35 make clean
36 ;;
37 *)
b.liu8f67dfb2023-11-27 11:27:51 +080038# exit 1;;
39 make -C $1
liubin207854f2023-07-19 17:25:29 +080040 esac
41 else # 无参数
42 make || exit 1
43 fi
liubin281ac462023-07-19 14:22:54 +080044
liubin207854f2023-07-19 17:25:29 +080045 cd $ROOT_DIR
liubin281ac462023-07-19 14:22:54 +080046
liubin207854f2023-07-19 17:25:29 +080047 echo "Build MBTK success."
48}
49
50function file_copy()
51{
liubin1673a9c2023-07-19 20:59:43 +080052 ROOTFS_DIR=$ROOT_DIR/../asr_code/mbtk
liubin207854f2023-07-19 17:25:29 +080053
54 if [ -d $ROOTFS_DIR ];then
55 echo "Copy MBTK out files..."
56 if [ ! -d $ROOTFS_DIR/bin ];then
57 mkdir $ROOTFS_DIR/bin
58 fi
59 if [ ! -d $ROOTFS_DIR/lib ];then
60 mkdir $ROOTFS_DIR/lib
61 fi
62
63 # Copy All SO Files.
64 cp -f out/lib/* $ROOTFS_DIR/lib
65
66 # Copy All Bin Files.
liubinb8a0dd72023-08-04 15:26:48 +080067 #cp -f out/bin/* $ROOTFS_DIR/bin
68 cp -f out/bin/at $ROOTFS_DIR/bin
69 cp -f out/bin/mbtk_ril $ROOTFS_DIR/bin
70 cp -f out/bin/mbtk_logd $ROOTFS_DIR/bin
71 cp -f out/bin/mbtk_adbd $ROOTFS_DIR/bin
liubin207854f2023-07-19 17:25:29 +080072
73 else
74 echo "No found rootfs : $ROOTFS_DIR"
75 fi
76}
77
78function main()
79{
liubine760bd52023-07-20 15:57:21 +080080 if [ -n "$1" ] ;then
81 build $1
82 exit 0
83 fi
84
b.liu2f89bfb2023-11-30 17:14:01 +080085 if [ -d out/bin -a -d out/lib ];then
86 build
87
88 file_copy
89 else
90 if [ ! -d out/bin ];then
b.liu1c1c7212023-12-22 16:35:27 +080091 mkdir -p out/bin/asr1803
92 mkdir -p out/bin/asr1806
b.liu2f89bfb2023-11-30 17:14:01 +080093 fi
94
95 if [ ! -d out/lib ];then
96 mkdir -p out/lib
97 fi
98
99 build
100
101 file_copy
102 fi
liubin207854f2023-07-19 17:25:29 +0800103}
104
liubine760bd52023-07-20 15:57:21 +0800105main $1