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 | ||||
15 | export BUILD_PLATFORM=gcc-8.4 | ||||
16 | else | ||||
17 | export BUILD_PLATFORM=gcc-4.9 | ||||
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 | *) | ||||
36 | exit 1;; | ||||
37 | esac | ||||
38 | else # 无参数 | ||||
39 | make || exit 1 | ||||
40 | fi | ||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 41 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 42 | cd $ROOT_DIR |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 43 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 44 | echo "Build MBTK success." |
45 | } | ||||
46 | |||||
47 | function file_copy() | ||||
48 | { | ||||
liubin | 1673a9c | 2023-07-19 20:59:43 +0800 | [diff] [blame] | 49 | ROOTFS_DIR=$ROOT_DIR/../asr_code/mbtk |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 50 | |
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. | ||||
liubin | b8a0dd7 | 2023-08-04 15:26:48 +0800 | [diff] [blame] | 64 | #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 | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 69 | |
70 | else | ||||
71 | echo "No found rootfs : $ROOTFS_DIR" | ||||
72 | fi | ||||
73 | } | ||||
74 | |||||
75 | function main() | ||||
76 | { | ||||
liubin | e760bd5 | 2023-07-20 15:57:21 +0800 | [diff] [blame] | 77 | if [ -n "$1" ] ;then |
78 | build $1 | ||||
79 | exit 0 | ||||
80 | fi | ||||
81 | |||||
liubin | 1673a9c | 2023-07-19 20:59:43 +0800 | [diff] [blame] | 82 | 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 | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 96 | fi |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 97 | } |
98 | |||||
liubin | e760bd5 | 2023-07-20 15:57:21 +0800 | [diff] [blame] | 99 | main $1 |