-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.sh
90 lines (78 loc) · 2.48 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
#!/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 clang ]
then
git clone --depth=1 https://github.com/kardebayan/android_prebuilts_clang_host_linux-x86_clang-5696680.git 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 --depth=1 https://github.com/stormbreaker-project/AnyKernel3.git -b CPH1859 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=kardebayan
export KBUILD_BUILD_HOST=buildbot
# Compile plox
function compile() {
echo -e "${CYAN}"
make -j$(nproc) O=out ARCH=arm64 oppo6771_17065_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 successful..."
echo "Image.gz-dtb 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.. check build logs for errors"
echo "------------------------------------------------------------"
echo -e "${RST}"
fi
}
# Zipping
function zipping() {
echo -e "${YELLOW}"
echo "Creating a flashable zip....."
cd AnyKernel || exit 1
zip -r9 Stormbreaker-CPH1859-${TANGGAL}.zip * > /dev/null 2>&1
cd ..
echo "Zip stored at AnyKernel/Stormbreaker-CPH1859-${TANGGAL}.zip"
echo -e "${RST}"
}
compile
if [ $SUCCESS -eq 0 ]
then
zipping
fi