-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-notb.sh
147 lines (127 loc) · 4.95 KB
/
build-notb.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
#
# Copyright (C) 2020 azrim.
# All rights reserved.
# Init
KERNEL_DIR="${PWD}"
KERN_IMG="${KERNEL_DIR}"/out/arch/arm64/boot/Image.gz-dtb
ANYKERNEL="${HOME}"/Build/kernel/anykernel
COMPILER_STRING="Proton Clang 15.0.0"
# Repo URL
CLANG_REPO="https://gitlab.com/LeCmnGend/proton-clang"
ANYKERNEL_REPO="https://github.com/zhantech/Anykernel3-tissot.git"
ANYKERNEL_BRANCH="Anykernel3"
# Compiler
CLANG_DIR="${HOME}"/Build/kernel/clang-proton
if ! [ -d "${CLANG_DIR}" ]; then
git clone "$CLANG_REPO" -b clang-15 --depth=1 "$CLANG_DIR"
fi
# git clone https://github.com/baalajimaestro/aarch64-maestro-linux-android.git -b 07032020-9.2.1 --depth=1 "${KERNEL_DIR}/gcc"
# git clone https://github.com/baalajimaestro/arm-maestro-linux-gnueabi.git -b 07032020-9.2.1 --depth=1 "${KERNEL_DIR}/gcc32"
# Defconfig
DEFCONFIG="tissot_defconfig"
REGENERATE_DEFCONFIG="false" # unset if don't want to regenerate defconfig
# Costumize
KERNEL="Pringgodani"
RELEASE_VERSION="1.6"
DEVICE="Tissot"
KERNELTYPE="NonOC-NonTreble"
KERNEL_SUPPORT="10 - 13"
KERNELNAME="${KERNEL}-${DEVICE}-${KERNELTYPE}-$(TZ=Asia/Jakarta date +%y%m%d-%H%M)"
TEMPZIPNAME="${KERNELNAME}.zip"
ZIPNAME="${KERNELNAME}.zip"
# Telegram
CHATIDQ="-1001308839345"
CHATID="-1001308839345" # Group/channel chatid (use rose/userbot to get it)
TELEGRAM_TOKEN="5136791856:AAGY5TeaVoeJbd6a2BAlxAjOc-MFWOJzZds" # Get from botfather
# Export Telegram.sh
TELEGRAM_FOLDER="${HOME}"/telegram
if ! [ -d "${TELEGRAM_FOLDER}" ]; then
git clone https://github.com/Anothermi1/telegram.sh/ "${TELEGRAM_FOLDER}"
fi
TELEGRAM="${TELEGRAM_FOLDER}"/telegram
tg_cast() {
"${TELEGRAM}" -t "${TELEGRAM_TOKEN}" -c "${CHATID}" -H \
"$(
for POST in "${@}"; do
echo "${POST}"
done
)"
}
# Regenerating Defconfig
regenerate() {
cp out/.config arch/arm64/configs/"${DEFCONFIG}"
git add arch/arm64/configs/"${DEFCONFIG}"
git commit -m "defconfig: Regenerate"
}
# Building
makekernel() {
echo ".........................."
echo ". Building Kernel ."
echo ".........................."
export PATH="${HOME}"/Build/kernel/clang-proton/bin:$PATH
# export CROSS_COMPILE=${KERNEL_DIR}/gcc/bin/aarch64-maestro-linux-gnu-
# export CROSS_COMPILE_ARM32=${KERNEL_DIR}/gcc32/bin/arm-maestro-linux-gnueabi-
rm -rf "${KERNEL_DIR}"/out/arch/arm64/boot # clean previous compilation
mkdir -p out
make O=out ARCH=arm64 ${DEFCONFIG}
if [[ "${REGENERATE_DEFCONFIG}" =~ "true" ]]; then
regenerate
fi
make -j$(nproc --all) CC=clang CROSS_COMPILE=aarch64-linux-gnu- CROSS_COMPILE_ARM32=arm-linux-gnueabi- O=out ARCH=arm64
# Check If compilation is success
if ! [ -f "${KERN_IMG}" ]; then
END=$(TZ=Asia/Jakarta date +"%s")
DIFF=$(( END - START ))
echo -e "Kernel compilation failed, See buildlog to fix errors"
tg_cast "Build for ${DEVICE} <b>failed</b> in $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s)! Check Instance for errors @zh4ntech"
exit 1
fi
}
# Packing kranul
packingkernel() {
echo "........................"
echo ". Packing Kernel ."
echo "........................"
# Copy compiled kernel
if [ -d "${ANYKERNEL}" ]; then
rm -rf "${ANYKERNEL}"
fi
git clone "$ANYKERNEL_REPO" -b "$ANYKERNEL_BRANCH" "${ANYKERNEL}"
# mkdir "${ANYKERNEL}"/kernel/
cp "${KERN_IMG}" "${ANYKERNEL}"/Image.gz-dtb
# mkdir "${ANYKERNEL}"/dtb-nontreble/
# cp "${KERN_DTB_NONTB}" "${ANYKERNEL}"/dtb-nontreble/msm8953-qrd-sku3-tissot-nontreble.dtb
# mkdir "${ANYKERNEL}"/dtb-treble/
# cp "${KERN_DTB_NONTB}" "${ANYKERNEL}"/dtb-treble/msm8953-qrd-sku3-tissot-nontreble.dtb
# Zip the kernel, or fail
cd "${ANYKERNEL}" || exit
zip -r9 "${TEMPZIPNAME}" ./*
# Sign the zip before sending it to Telegram
# curl -sLo zipsigner-3.0.jar https://raw.githubusercontent.com/baalajimaestro/AnyKernel2/master/zipsigner-3.0.jar
# java -jar zipsigner-3.0.jar "${TEMPZIPNAME}" "${ZIPNAME}"
# Ship it to the CI channel
"${TELEGRAM}" -f "$ZIPNAME" -t "${TELEGRAM_TOKEN}" -c "${CHATIDQ}"
}
# Starting
tg_cast "<b>STARTING KERNEL BUILD</b>" \
"Device: ${DEVICE}" \
"Kernel Name: <code>${KERNEL}</code>" \
"Build Type: <code>${KERNELTYPE}</code>" \
"Release Version: ${RELEASE_VERSION}" \
"Linux Version: <code>$(make kernelversion)</code>" \
"Android Supported: ${KERNEL_SUPPORT}"
START=$(TZ=Asia/Jakarta date +"%s")
makekernel
packingkernel
END=$(TZ=Asia/Jakarta date +"%s")
DIFF=$(( END - START ))
tg_cast "Build for ${DEVICE} with ${COMPILER_STRING} <b>succeed</b> took $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s)! by @zh4ntech"
tg_cast "<b>Changelog :</b>" \
"- Compile with Proton Clang 15.0.0" \
"- Bump 1.6" \
"- Upstremed Kernel to 4.9.337" \
"- More Changelogs : https://github.com/zhantech/android_kernel_msm8953/commits/Pringgodani"
echo "........................"
echo ". Build Finished ."
echo "........................"