blob: 51fe09ead0eebfcf1e9575325276c5c9cafbd037 [file] [log] [blame]
liubin281ac462023-07-19 14:22:54 +08001#!/bin/bash
2
3# Config item.
4# static / shared
b.liu17d7f8b2023-10-08 16:57:59 +08005#LIB_TYPE=static
liubin281ac462023-07-19 14:22:54 +08006# gcc-4.9 / gcc-8.4
b.liu17d7f8b2023-10-08 16:57:59 +08007#export PLATFORM=gcc-4.9
8
9# static / shared
10export BUILD_LIB_TYPE=shared
11# gcc-4.9 / gcc-8.4
12
b.liu5d5b8ba2024-02-20 14:00:33 +080013ROOT_DIR=`pwd`
14
15cd ..
16grep "url" .git/config | cut -d " " -f 3 | grep "kernel_5.4.195"
b.liu17d7f8b2023-10-08 16:57:59 +080017if [ $? -eq "0" ]; then
b.liu3403c932023-10-10 16:26:35 +080018 export BUILD_PLATFORM=asr1806
b.liu17d7f8b2023-10-08 16:57:59 +080019else
b.liu3403c932023-10-10 16:26:35 +080020 export BUILD_PLATFORM=asr1803
b.liu17d7f8b2023-10-08 16:57:59 +080021fi
liubin281ac462023-07-19 14:22:54 +080022
b.liu5d5b8ba2024-02-20 14:00:33 +080023export BUILD_BRANCH=`git branch | grep "*" | cut -d " " -f 2`
24cd $ROOT_DIR
25
b.liu1c1c7212023-12-22 16:35:27 +080026export STAGING_DIR=
27
b.liu5d5b8ba2024-02-20 14:00:33 +080028
b.liu17d7f8b2023-10-08 16:57:59 +080029#TOOLCHAIN_DIR=$ROOT_DIR/toolchain/$BUILD_PLATFORM
30#echo "toolchain : $ROOT_DIR"
liubin281ac462023-07-19 14:22:54 +080031
liubin281ac462023-07-19 14:22:54 +080032
liubin281ac462023-07-19 14:22:54 +080033
liubin207854f2023-07-19 17:25:29 +080034function build()
35{
36 cd mbtk
liubin281ac462023-07-19 14:22:54 +080037
liubin207854f2023-07-19 17:25:29 +080038 if [ -n "$1" ] ;then
39 case "$1" in
40 clean)
41 make clean
42 ;;
43 *)
b.liu8f67dfb2023-11-27 11:27:51 +080044# exit 1;;
45 make -C $1
liubin207854f2023-07-19 17:25:29 +080046 esac
47 else # 无参数
48 make || exit 1
49 fi
liubin281ac462023-07-19 14:22:54 +080050
liubin207854f2023-07-19 17:25:29 +080051 cd $ROOT_DIR
liubin281ac462023-07-19 14:22:54 +080052
liubin207854f2023-07-19 17:25:29 +080053 echo "Build MBTK success."
54}
55
56function file_copy()
57{
liubin1673a9c2023-07-19 20:59:43 +080058 ROOTFS_DIR=$ROOT_DIR/../asr_code/mbtk
liubin207854f2023-07-19 17:25:29 +080059
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.
liubinb8a0dd72023-08-04 15:26:48 +080073 #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.liu3a41a312024-02-28 09:57:39 +080078 [ -f out/bin/device_info_generate ] && cp -f out/bin/device_info_generate $ROOTFS_DIR
b.liuc4984522024-02-29 14:54:51 +080079 [ -f out/bin/device_info ] && cp -f out/bin/device_info $ROOTFS_DIR/bin
liubin207854f2023-07-19 17:25:29 +080080 else
81 echo "No found rootfs : $ROOTFS_DIR"
82 fi
83}
84
85function main()
86{
liubine760bd52023-07-20 15:57:21 +080087 if [ -n "$1" ] ;then
88 build $1
89 exit 0
90 fi
91
b.liu2f89bfb2023-11-30 17:14:01 +080092 if [ -d out/bin -a -d out/lib ];then
93 build
94
95 file_copy
96 else
97 if [ ! -d out/bin ];then
b.liu1c1c7212023-12-22 16:35:27 +080098 mkdir -p out/bin/asr1803
99 mkdir -p out/bin/asr1806
b.liu2f89bfb2023-11-30 17:14:01 +0800100 fi
101
102 if [ ! -d out/lib ];then
103 mkdir -p out/lib
104 fi
105
106 build
107
108 file_copy
109 fi
liubin207854f2023-07-19 17:25:29 +0800110}
111
liubine760bd52023-07-20 15:57:21 +0800112main $1