liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 1 | #!/bin/bash |
2 | |||||
3 | # Config item. | ||||
4 | # static / shared | ||||
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 5 | #LIB_TYPE=static |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 6 | # gcc-4.9 / gcc-8.4 |
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 7 | #export PLATFORM=gcc-4.9 |
8 | |||||
9 | # static / shared | ||||
10 | export BUILD_LIB_TYPE=shared | ||||
11 | # gcc-4.9 / gcc-8.4 | ||||
12 | |||||
13 | grep "url" ../.git/config | cut -d " " -f 3 | grep "kernel_5.4.195" | ||||
14 | if [ $? -eq "0" ]; then | ||||
b.liu | 3403c93 | 2023-10-10 16:26:35 +0800 | [diff] [blame] | 15 | export BUILD_PLATFORM=asr1806 |
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 16 | else |
b.liu | 3403c93 | 2023-10-10 16:26:35 +0800 | [diff] [blame] | 17 | export BUILD_PLATFORM=asr1803 |
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 18 | fi |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 19 | |
20 | ROOT_DIR=`pwd` | ||||
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 21 | #TOOLCHAIN_DIR=$ROOT_DIR/toolchain/$BUILD_PLATFORM |
22 | #echo "toolchain : $ROOT_DIR" | ||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 23 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 24 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 25 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 26 | function build() |
27 | { | ||||
28 | cd mbtk | ||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 29 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 30 | if [ -n "$1" ] ;then |
31 | case "$1" in | ||||
32 | clean) | ||||
33 | make clean | ||||
34 | ;; | ||||
35 | *) | ||||
b.liu | 8f67dfb | 2023-11-27 11:27:51 +0800 | [diff] [blame] | 36 | # exit 1;; |
37 | make -C $1 | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 38 | esac |
39 | else # 无参数 | ||||
40 | make || exit 1 | ||||
41 | fi | ||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 42 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 43 | cd $ROOT_DIR |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 44 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 45 | echo "Build MBTK success." |
46 | } | ||||
47 | |||||
48 | function file_copy() | ||||
49 | { | ||||
liubin | 1673a9c | 2023-07-19 20:59:43 +0800 | [diff] [blame] | 50 | ROOTFS_DIR=$ROOT_DIR/../asr_code/mbtk |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 51 | |
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. | ||||
liubin | b8a0dd7 | 2023-08-04 15:26:48 +0800 | [diff] [blame] | 65 | #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 | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 70 | |
71 | else | ||||
72 | echo "No found rootfs : $ROOTFS_DIR" | ||||
73 | fi | ||||
74 | } | ||||
75 | |||||
76 | function main() | ||||
77 | { | ||||
liubin | e760bd5 | 2023-07-20 15:57:21 +0800 | [diff] [blame] | 78 | if [ -n "$1" ] ;then |
79 | build $1 | ||||
80 | exit 0 | ||||
81 | fi | ||||
82 | |||||
b.liu | 2f89bfb | 2023-11-30 17:14:01 +0800 | [diff] [blame^] | 83 | 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 | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 100 | } |
101 | |||||
liubin | e760bd5 | 2023-07-20 15:57:21 +0800 | [diff] [blame] | 102 | main $1 |