-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sh
executable file
·83 lines (72 loc) · 2.24 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
#! /usr/bin/env bash
#
# Build script for A12s/M12
#
export PLATFORM_VERSION=13
export ANDROID_MAJOR_VERSION=t
export ARCH=arm64
export RSU_ENV=/rsuntk
export CLANG_VERSION=11
export SHOW_TC_PATH=y
export DATE=$(date +'%Y%m%d%H%M%S')
# Print out function
pr_info() {
printf "[INFO] $@\n"
}
pr_err() {
printf "[ERR] $@\n"
exit 1;
}
if [ -d $RSU_ENV ]; then
ENV=$RSU_ENV/env
LLVM_PATH=$ENV/clang-$CLANG_VERSION/bin
pr_info "Environment is Rissu. Detected /rsuntk mountpoint."
__CC=$LLVM_PATH/clang
__LD=$LLVM_PATH/ld.lld
__CROSS_COMPILE=$ENV/google/bin/aarch64-linux-android-
__CLANG_TRIPLE=aarch64-linux-gnu-
# Rissu always use his defconfig
__DEFCONFIG="rsuntk-a12snsxx_defconfig"
elif [ ! -z $ENV_IS_CI ]; then
ENV=$(pwd)/toolchains
if [ ! -d $ENV ]; then
pr_err "Unspecified toolchains path."
fi
pr_info "Environment is CI."
__CC=$ENV/clang-$CLANG_VERSION/bin/clang
__LD=$ENV/clang-$CLANG_VERSION/bin/ld.lld
__CROSS_COMPILE=$ENV/google/bin/aarch64-linux-android-
__CLANG_TRIPLE=aarch64-linux-gnu-
__DEFCONFIG=$GIT_ENV_DEFCONFIG
if [[ $KSU_STATE = 'true' ]]; then
curl -LSs "https://raw.githubusercontent.com/rsuntk/KernelSU/main/kernel/setup.sh" | bash -s main
# KernelSU/kernel/Makefile#22
KSU_COMMIT_COUNT=$(cd KernelSU && git rev-list --count HEAD)
export KSU_VERSION=$(expr 10200 + $KSU_COMMIT_COUNT)
FMT="RsuCI-`echo $DEVICE_VARIANT`-KSU_`echo $KSU_VERSION`-`echo $SELINUX_STATE`"
else
FMT="RsuCI-`echo $DEVICE_VARIANT`-`echo $SELINUX_STATE`"
fi
echo $FMT > zipfile_format.txt
else
# Fill it by yourself
__CC=
__LD=
__CROSS_COMPILE=
__CLANG_TRIPLE=
__DEFCONFIG=
fi
make --no-silent --jobs $(nproc --all) CC=$__CC LD=$__LD CROSS_COMPILE=$__CROSS_COMPILE CLANG_TRIPLE=$__CLANG_TRIPLE -C $(pwd) O=$(pwd)/out ARCH=arm64 `echo $__DEFCONFIG`
export SHOW_TC_PATH=n
make --no-silent --jobs $(nproc --all) CC=$__CC LD=$__LD CROSS_COMPILE=$__CROSS_COMPILE CLANG_TRIPLE=$__CLANG_TRIPLE -C $(pwd) O=$(pwd)/out ARCH=arm64
if [ ! -z $ENV_IS_CI ]; then
mv $(pwd)/out/arch/$ARCH/boot/Image $(pwd)/Rissu/AnyKernel3/Image
cd $(pwd)/Rissu
bash mk_version
cd AnyKernel3
zip -6 -r $(pwd)/Rissu/$FMT *
cd ../..
fi
if [ ! -z $ENV_IS_CI ] && [[ $UPLOAD_GZ = 'true' ]]; then
mv $(pwd)/out/arch/$ARCH/boot/Image.gz $(pwd)/Rissu/Image.gz
fi