forked from CPH1859/android_kernel_oppo_mt6771
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
96 lines (83 loc) · 2.47 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
88
89
90
91
92
93
94
95
96
#!/bin/bash
BOLD='\033[1m'
GRN='\033[01;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
RED='\033[01;31m'
RST='\033[0m'
echo "Cloning dependencies if they don't exist...."
if [ ! -d out ]
then
echo "clean"
else
rm -rf AnyKernel
fi
if [ ! -d clang ]
then
git clone --depth=1 https://github.com/kardebayan/android_prebuilts_clang_host_linux-x86_clang-5696680 clang
fi
if [ ! -d gcc32 ]
then
git clone --depth=1 https://github.com/KudProject/arm-linux-androideabi-4.9 gcc32
fi
if [ ! -d gcc ]
then
git clone --depth=1 https://github.com/KudProject/aarch64-linux-android-4.9 gcc
fi
if [ ! -d AnyKernel ]
then
git clone https://github.com/radeon790/AnyKernel3.git -b stormbreaker --depth=1 AnyKernel
fi
echo "Done"
KERNEL_DIR=$(pwd)
IMAGE="${KERNEL_DIR}/out/arch/arm64/boot/Image.gz-dtb"
TANGGAL=$(date +"%Y%m%d-%H")
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
PATH="${KERNEL_DIR}/clang/bin:${KERNEL_DIR}/gcc/bin:${KERNEL_DIR}/gcc32/bin:${PATH}"
export KBUILD_COMPILER_STRING="$(${KERNEL_DIR}/clang/bin/clang --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g')"
export ARCH=arm64
export KBUILD_BUILD_USER=Radeon
export KBUILD_BUILD_HOST=LVI
# Compile plox
function compile() {
echo -e "${CYAN}"
make -j$(nproc) O=out ARCH=arm64 oppo6771_18611_defconfig
make -j$(nproc) O=out \
ARCH=arm64 \
CC=clang \
CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=aarch64-linux-android- \
CROSS_COMPILE_ARM32=arm-linux-androideabi-
echo -e "${RST}"
SUCCESS=$?
if [ $SUCCESS -eq 0 ]
then
echo -e "${GRN}"
echo "------------------------------------------------------------"
echo "Compilation success"
echo "Image.gz-dt can be found at out/arch/arm64/boot/Image.gz-dtb"
cp out/arch/arm64/boot/Image.gz-dtb AnyKernel
echo "------------------------------------------------------------"
echo -e "${RST}"
else
echo -e "${RED}"
echo "------------------------------------------------------------"
echo "Compilation failed"
echo "------------------------------------------------------------"
echo -e "${RST}"
fi
}
# Zipping
function zipping() {
echo -e "${YELLOW}"
cd AnyKernel || exit 1
zip -r9 RadeonKernel-Symbiot-RMX1831-${TANGGAL}.zip * > /dev/null 2>&1
cd ..
echo "zip stored at AnyKernel/RadeonKernel-Symbiot-RMX1831-${TANGGAL}.zip"
echo -e "${RST}"
}
compile
if [ $SUCCESS -eq 0 ]
then
zipping
fi