-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.sh
executable file
·87 lines (75 loc) · 2.31 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
usage()
{
echo "USAGE: [-U] [-CK] [-A] [-p] [-o] [-u] [-v VERSION_NAME] "
echo "No ARGS means use default build option "
echo "WHERE: -U = build uboot "
echo " -C = build kernel with Clang "
echo " -K = build kernel "
echo " -A = build android "
echo " -p = will build packaging in IMAGE "
echo " -o = build OTA package "
echo " -u = build update.img "
echo " -v = build android with 'user' or 'userdebug' "
echo " -d = huild kernel dts name "
echo " -V = build version "
echo " -J = build jobs "
exit 1
}
function clean_cmake_config()
{
rm -rf CMakeCache.txt
rm -rf CMakeFiles
rm -rf cmake_install.cmake
rm -rf Makefile
rm -rf CTestTestfile.cmake
}
format_code()
{
find . -name "*.c" -o -name "*.h" | xargs clang-format -style=WebKit -i
find . -name "*.h" | xargs clang-format -style=LLVM -i
find . -name "*.cpp" | xargs clang-format -style=LLVM -i
}
if [ ! -d "output/release" ]; then
mkdir -p "output/release"
fi
BUILD_CLEAN=false
BUILD_ARCH=arm
# check pass argument
while getopts "RC" arg
do
case $arg in
R)
echo "will reconfigure project"
BUILD_CLEAN=true
;;
C)
echo "will build cross platform"
BUILD_CROSS=arm
;;
?)
usage ;;
esac
done
# build clean
if [ "$BUILD_CLEAN" = true ] ; then
rm output/* -rf
fi
cd output
# 根据你的SDK的路径替换这里的路径在SDK里find -name toolchainfile.cmake 找到这个文件的路径,然后放在=后面
# build cross
if [ "$BUILD_ARCH" = "arm" ] ; then
echo "start build cross paltform"
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchainfile-rv1106.cmake -DCMAKE_INSTALL_PREFIX=./release ../
elif [ "$BUILD_ARCH" = "arm64" ] ; then
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchainfile-rk3588.cmake -DCMAKE_INSTALL_PREFIX=./release ../
else
cmake -DCMAKE_INSTALL_PREFIX=./release ../
fi
make -j8
if [ $? -eq 0 ]; then
echo Build finished!
# make install
# clean_cmake_config
cd ..
fi