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 | |
b.liu | 1c1c721 | 2023-12-22 16:35:27 +0800 | [diff] [blame] | 20 | export STAGING_DIR= |
21 | |||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 22 | ROOT_DIR=`pwd` |
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 23 | #TOOLCHAIN_DIR=$ROOT_DIR/toolchain/$BUILD_PLATFORM |
24 | #echo "toolchain : $ROOT_DIR" | ||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 25 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 26 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 27 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 28 | function build() |
29 | { | ||||
30 | cd mbtk | ||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 31 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 32 | if [ -n "$1" ] ;then |
33 | case "$1" in | ||||
34 | clean) | ||||
35 | make clean | ||||
36 | ;; | ||||
37 | *) | ||||
b.liu | 8f67dfb | 2023-11-27 11:27:51 +0800 | [diff] [blame] | 38 | # exit 1;; |
39 | make -C $1 | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 40 | esac |
41 | else # 无参数 | ||||
42 | make || exit 1 | ||||
43 | fi | ||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 44 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 45 | cd $ROOT_DIR |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 46 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 47 | echo "Build MBTK success." |
48 | } | ||||
49 | |||||
50 | function file_copy() | ||||
51 | { | ||||
liubin | 1673a9c | 2023-07-19 20:59:43 +0800 | [diff] [blame] | 52 | ROOTFS_DIR=$ROOT_DIR/../asr_code/mbtk |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 53 | |
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. | ||||
liubin | b8a0dd7 | 2023-08-04 15:26:48 +0800 | [diff] [blame] | 67 | #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 | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 72 | |
73 | else | ||||
74 | echo "No found rootfs : $ROOTFS_DIR" | ||||
75 | fi | ||||
76 | } | ||||
77 | |||||
78 | function main() | ||||
79 | { | ||||
liubin | e760bd5 | 2023-07-20 15:57:21 +0800 | [diff] [blame] | 80 | if [ -n "$1" ] ;then |
81 | build $1 | ||||
82 | exit 0 | ||||
83 | fi | ||||
84 | |||||
b.liu | 2f89bfb | 2023-11-30 17:14:01 +0800 | [diff] [blame] | 85 | if [ -d out/bin -a -d out/lib ];then |
86 | build | ||||
87 | |||||
88 | file_copy | ||||
89 | else | ||||
90 | if [ ! -d out/bin ];then | ||||
b.liu | 1c1c721 | 2023-12-22 16:35:27 +0800 | [diff] [blame] | 91 | mkdir -p out/bin/asr1803 |
92 | mkdir -p out/bin/asr1806 | ||||
b.liu | 2f89bfb | 2023-11-30 17:14:01 +0800 | [diff] [blame] | 93 | fi |
94 | |||||
95 | if [ ! -d out/lib ];then | ||||
96 | mkdir -p out/lib | ||||
97 | fi | ||||
98 | |||||
99 | build | ||||
100 | |||||
101 | file_copy | ||||
102 | fi | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 103 | } |
104 | |||||
liubin | e760bd5 | 2023-07-20 15:57:21 +0800 | [diff] [blame] | 105 | main $1 |