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 | |||||
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame^] | 13 | ROOT_DIR=`pwd` |
14 | |||||
15 | cd .. | ||||
16 | grep "url" .git/config | cut -d " " -f 3 | grep "kernel_5.4.195" | ||||
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 17 | if [ $? -eq "0" ]; then |
b.liu | 3403c93 | 2023-10-10 16:26:35 +0800 | [diff] [blame] | 18 | export BUILD_PLATFORM=asr1806 |
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 19 | else |
b.liu | 3403c93 | 2023-10-10 16:26:35 +0800 | [diff] [blame] | 20 | export BUILD_PLATFORM=asr1803 |
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 21 | fi |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 22 | |
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame^] | 23 | export BUILD_BRANCH=`git branch | grep "*" | cut -d " " -f 2` |
24 | cd $ROOT_DIR | ||||
25 | |||||
b.liu | 1c1c721 | 2023-12-22 16:35:27 +0800 | [diff] [blame] | 26 | export STAGING_DIR= |
27 | |||||
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame^] | 28 | |
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 29 | #TOOLCHAIN_DIR=$ROOT_DIR/toolchain/$BUILD_PLATFORM |
30 | #echo "toolchain : $ROOT_DIR" | ||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 31 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 32 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 33 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 34 | function build() |
35 | { | ||||
36 | cd mbtk | ||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 37 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 38 | if [ -n "$1" ] ;then |
39 | case "$1" in | ||||
40 | clean) | ||||
41 | make clean | ||||
42 | ;; | ||||
43 | *) | ||||
b.liu | 8f67dfb | 2023-11-27 11:27:51 +0800 | [diff] [blame] | 44 | # exit 1;; |
45 | make -C $1 | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 46 | esac |
47 | else # 无参数 | ||||
48 | make || exit 1 | ||||
49 | fi | ||||
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 50 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 51 | cd $ROOT_DIR |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 52 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 53 | echo "Build MBTK success." |
54 | } | ||||
55 | |||||
56 | function file_copy() | ||||
57 | { | ||||
liubin | 1673a9c | 2023-07-19 20:59:43 +0800 | [diff] [blame] | 58 | ROOTFS_DIR=$ROOT_DIR/../asr_code/mbtk |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 59 | |
60 | if [ -d $ROOTFS_DIR ];then | ||||
61 | echo "Copy MBTK out files..." | ||||
62 | if [ ! -d $ROOTFS_DIR/bin ];then | ||||
63 | mkdir $ROOTFS_DIR/bin | ||||
64 | fi | ||||
65 | if [ ! -d $ROOTFS_DIR/lib ];then | ||||
66 | mkdir $ROOTFS_DIR/lib | ||||
67 | fi | ||||
68 | |||||
69 | # Copy All SO Files. | ||||
70 | cp -f out/lib/* $ROOTFS_DIR/lib | ||||
71 | |||||
72 | # Copy All Bin Files. | ||||
liubin | b8a0dd7 | 2023-08-04 15:26:48 +0800 | [diff] [blame] | 73 | #cp -f out/bin/* $ROOTFS_DIR/bin |
74 | cp -f out/bin/at $ROOTFS_DIR/bin | ||||
75 | cp -f out/bin/mbtk_ril $ROOTFS_DIR/bin | ||||
76 | cp -f out/bin/mbtk_logd $ROOTFS_DIR/bin | ||||
77 | cp -f out/bin/mbtk_adbd $ROOTFS_DIR/bin | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 78 | |
79 | else | ||||
80 | echo "No found rootfs : $ROOTFS_DIR" | ||||
81 | fi | ||||
82 | } | ||||
83 | |||||
84 | function main() | ||||
85 | { | ||||
liubin | e760bd5 | 2023-07-20 15:57:21 +0800 | [diff] [blame] | 86 | if [ -n "$1" ] ;then |
87 | build $1 | ||||
88 | exit 0 | ||||
89 | fi | ||||
90 | |||||
b.liu | 2f89bfb | 2023-11-30 17:14:01 +0800 | [diff] [blame] | 91 | if [ -d out/bin -a -d out/lib ];then |
92 | build | ||||
93 | |||||
94 | file_copy | ||||
95 | else | ||||
96 | if [ ! -d out/bin ];then | ||||
b.liu | 1c1c721 | 2023-12-22 16:35:27 +0800 | [diff] [blame] | 97 | mkdir -p out/bin/asr1803 |
98 | mkdir -p out/bin/asr1806 | ||||
b.liu | 2f89bfb | 2023-11-30 17:14:01 +0800 | [diff] [blame] | 99 | fi |
100 | |||||
101 | if [ ! -d out/lib ];then | ||||
102 | mkdir -p out/lib | ||||
103 | fi | ||||
104 | |||||
105 | build | ||||
106 | |||||
107 | file_copy | ||||
108 | fi | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 109 | } |
110 | |||||
liubin | e760bd5 | 2023-07-20 15:57:21 +0800 | [diff] [blame] | 111 | main $1 |