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 | ||||
b.liu | 3a41a31 | 2024-02-28 09:57:39 +0800 | [diff] [blame] | 78 | [ -f out/bin/device_info_generate ] && cp -f out/bin/device_info_generate $ROOTFS_DIR |
b.liu | c498452 | 2024-02-29 14:54:51 +0800 | [diff] [blame] | 79 | [ -f out/bin/device_info ] && cp -f out/bin/device_info $ROOTFS_DIR/bin |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 80 | else |
81 | echo "No found rootfs : $ROOTFS_DIR" | ||||
82 | fi | ||||
83 | } | ||||
84 | |||||
85 | function main() | ||||
86 | { | ||||
liubin | e760bd5 | 2023-07-20 15:57:21 +0800 | [diff] [blame] | 87 | if [ -n "$1" ] ;then |
88 | build $1 | ||||
89 | exit 0 | ||||
90 | fi | ||||
91 | |||||
b.liu | 2f89bfb | 2023-11-30 17:14:01 +0800 | [diff] [blame] | 92 | if [ -d out/bin -a -d out/lib ];then |
93 | build | ||||
94 | |||||
95 | file_copy | ||||
96 | else | ||||
97 | if [ ! -d out/bin ];then | ||||
b.liu | 1c1c721 | 2023-12-22 16:35:27 +0800 | [diff] [blame] | 98 | mkdir -p out/bin/asr1803 |
99 | mkdir -p out/bin/asr1806 | ||||
b.liu | 2f89bfb | 2023-11-30 17:14:01 +0800 | [diff] [blame] | 100 | fi |
101 | |||||
102 | if [ ! -d out/lib ];then | ||||
103 | mkdir -p out/lib | ||||
104 | fi | ||||
105 | |||||
106 | build | ||||
107 | |||||
108 | file_copy | ||||
109 | fi | ||||
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame] | 110 | } |
111 | |||||
liubin | e760bd5 | 2023-07-20 15:57:21 +0800 | [diff] [blame] | 112 | main $1 |