-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·356 lines (329 loc) · 8.11 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
#!/bin/bash
export ARCH=arm64
export SUBARCH=arm64
export KBUILD_BUILD_USER=neel0210
export KBUILD_BUILD_HOST=Catelina
# Variables
export Image="$(pwd)/out/arch/arm64/boot/Image"
export TC="/home/neel/Desktop/toolchain/linaro/bin"
export VMTC="$(pwd)/gcc/linaro"
#
#export CROSS_COMPILE=
export ANDROID_MAJOR_VERSION=q
export ANDROID_PLATFORM_VERSION=10
# Devices
A3=exynos7870-a3y17lte_defconfig
J6=exynos7870-j6lte_defconfig
A6=exynos7870-a6lte_defconfig
J701=exynos7870-j7velte_defconfig
J710=exynos7870-j7xelte_defconfig
J730=exynos7870-j7y17lte_defconfig
J530=exynos7870-j5y17lte_defconfig
G610=exynos7870-on7xelte_defconfig
#
START(){
# Calculate compilation time
START=$(date +"%s")
}
#
END(){
END=$(date +"%s")
DIFF=$((END - START))
echo -e "Kernel has been compiled successfully and it took $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s)"
echo "Done!"
}
CLEANK(){
rm -rf KKRT/AIK/image-new.img
rm -rf KKRT/AIK/split_img/boot.img-kernel
}
CLEANBUILDS(){
rm -rf KKRT/ZIP/KKRT/D/a3y17lte/A3.img
rm -rf KKRT/ZIP/KKRT/D/a6lte/A6.img
rm -rf KKRT/ZIP/KKRT/D/j6lte/J6.img
rm -rf KKRT/ZIP/KKRT/D/j7velte/J701.img
rm -rf KKRT/ZIP/KKRT/D/j7xelte/J710.img
rm -rf KKRT/ZIP/KKRT/D/j5y17lte/J530.img
rm -rf KKRT/ZIP/KKRT/D/j7y17lte/J730.img
rm -rf KKRT/ZIP/KKRT/D/on7xelte/G610.img
rm -rf KKRT/*.zip
}
CLEANUPLOAD(){
rm -rf KKRT/*.zip
}
CLEAN(){
make clean && make mrproper
rm -rf out/arch/arm64/boot/Image
rm -rf KKRT/*.zip
rm -rf KKRT/Image
rm -rf out
}
PACKALL(){
CLEANBUILDS
#
CLEANK
echo "Packing A3 Kernel, wait... "
cp -r ./A3/arch/arm64/boot/Image ./KKRT/AIK/split_img/boot.img-kernel
bash KKRT/AIK/repackimg.sh
cp -r ./KKRT/AIK/image-new.img ./KKRT/ZIP/KKRT/D/a3y17lte/A3.img
rm -rf KKRT/*.zip
cd KKRT/ZIP
./zip.sh
mv KKRT-SSJ1_Exy7870-.zip KKRT-SSJ1_Exy7870-A3.zip
cd ../..
cp -r ./KKRT/ZIP/*.zip ./KKRT/
UPLOAD
CLEANUPLOAD
rm -rf KKRT/ZIP/KKRT/D/a3y17lte/A3.img
#
CLEANK
echo "Packing A6 Kernel, wait... "
cp -r ./A6/arch/arm64/boot/Image ./KKRT/AIK/split_img/boot.img-kernel
bash KKRT/AIK/repackimg.sh
cp -r ./KKRT/AIK/image-new.img ./KKRT/ZIP/KKRT/D/a6lte/A6.img
cd KKRT/ZIP
./zip.sh
mv KKRT-SSJ1_Exy7870-.zip KKRT-SSJ1_Exy7870-A6.zip
cd ../..
cp -r ./KKRT/ZIP/*.zip ./KKRT/
UPLOAD
CLEANUPLOAD
rm -rf KKRT/ZIP/KKRT/D/a6lte/A6.img
#
CLEANK
echo "Packing J6 Kernel, wait... "
cp -r ./J6/arch/arm64/boot/Image ./KKRT/AIK/split_img/boot.img-kernel
bash KKRT/AIK/repackimg.sh
cp -r ./KKRT/AIK/image-new.img ./KKRT/ZIP/KKRT/D/j6lte/J6.img
cd KKRT/ZIP
./zip.sh
mv KKRT-SSJ1_Exy7870-.zip KKRT-SSJ1_Exy7870-J6.zip
cd ../..
cp -r ./KKRT/ZIP/*.zip ./KKRT/
UPLOAD
CLEANUPLOAD
rm -rf KKRT/ZIP/KKRT/D/j6lte/J6.img
#
CLEANK
echo "Packing J701 Kernel, wait... "
cp -r ./J701/arch/arm64/boot/Image ./KKRT/AIK/split_img/boot.img-kernel
bash KKRT/AIK/repackimg.sh
cp -r ./KKRT/AIK/image-new.img ./KKRT/ZIP/KKRT/D/j7velte/J701.img
cd KKRT/ZIP
./zip.sh
mv KKRT-SSJ1_Exy7870-.zip KKRT-SSJ1_Exy7870-J701.zip
cd ../..
cp -r ./KKRT/ZIP/*.zip ./KKRT/
UPLOAD
CLEANUPLOAD
rm -rf KKRT/ZIP/KKRT/D/j7velte/J701.img
#
CLEANK
echo "Packing J710 Kernel, wait... "
cp -r ./J710/arch/arm64/boot/Image ./KKRT/AIK/split_img/boot.img-kernel
bash KKRT/AIK/repackimg.sh
cp -r ./KKRT/AIK/image-new.img ./KKRT/ZIP/KKRT/D/j7xelte/J710.img
cd KKRT/ZIP
./zip.sh
mv KKRT-SSJ1_Exy7870-.zip KKRT-SSJ1_Exy7870-J710.zip
cd ../..
cp -r ./KKRT/ZIP/*.zip ./KKRT/
UPLOAD
CLEANUPLOAD
rm -rf KKRT/ZIP/KKRT/D/j7xelte/J710.img
#
CLEANK
echo "Packing J530 Kernel, wait... "
cp -r ./J530/arch/arm64/boot/Image ./KKRT/AIK/split_img/boot.img-kernel
bash KKRT/AIK/repackimg.sh
cp -r ./KKRT/AIK/image-new.img ./KKRT/ZIP/KKRT/D/j5y17lte/J530.img
cd KKRT/ZIP
./zip.sh
mv KKRT-SSJ1_Exy7870-.zip KKRT-SSJ1_Exy7870-J530.zip
cd ../..
cp -r ./KKRT/ZIP/*.zip ./KKRT/
UPLOAD
CLEANUPLOAD
rm -rf KKRT/ZIP/KKRT/D/j5y17lte/J530.img
#
CLEANK
echo "Packing J730 Kernel, wait... "
cp -r ./J730/arch/arm64/boot/Image ./KKRT/AIK/split_img/boot.img-kernel
bash KKRT/AIK/repackimg.sh
cp -r ./KKRT/AIK/image-new.img ./KKRT/ZIP/KKRT/D/j7y17lte/J730.img
cd KKRT/ZIP
./zip.sh
mv KKRT-SSJ1_Exy7870-.zip KKRT-SSJ1_Exy7870-J730.zip
cd ../..
cp -r ./KKRT/ZIP/*.zip ./KKRT/
UPLOAD
CLEANUPLOAD
rm -rf KKRT/ZIP/KKRT/D/j7y17lte/J730.img
#
CLEANK
echo "Packing G610 Kernel, wait... "
cp -r ./G610/arch/arm64/boot/Image ./KKRT/AIK/split_img/boot.img-kernel
bash KKRT/AIK/repackimg.sh
cp -r ./KKRT/AIK/image-new.img ./KKRT/ZIP/KKRT/D/on7xelte/G610.img
cd KKRT/ZIP
./zip.sh
mv KKRT-SSJ1_Exy7870-.zip KKRT-SSJ1_Exy7870-G610.zip
cd ../..
cp -r ./KKRT/ZIP/*.zip ./KKRT/
UPLOAD
CLEANUPLOAD
rm -rf KKRT/ZIP/KKRT/D/on7xelte/G610.img
}
MAKE(){
echo "============"
echo "Compiling A3"
echo "============"
make $A3 O=A3
make -j$(nproc --all) O=A3
echo "============"
echo "Compiling J6"
echo "============"
make $J6 O=J6
make -j$(nproc --all) O=J6
echo "============"
echo "Compiling A6"
echo "============"
make $A6 O=A6
make -j$(nproc --all) O=A6
echo "==============="
echo "Compiling J7nxt"
echo "==============="
make $J701 O=J701
make -j$(nproc --all) O=J701
echo "================"
echo "Compiling J7 16"
echo "================"
make $J710 O=J710
make -j$(nproc --all) O=J710
echo "=============="
echo "Compiling J5 17"
echo "=============="
make $J530 O=J530
make -j$(nproc --all) O=J530
echo "=============="
echo "Compiling J7 17"
echo "=============="
make $J730 O=J730
make -j$(nproc --all) O=J730
echo "=============="
echo "Compiling J7 P"
echo "=============="
make $G610 O=G610
make -j$(nproc --all) O=G610
}
FLASHING(){
echo "X......Checking if Kernel ZIP is present or not"
sleep 2
cd KKRT
ZIP=$(find *.zip)
if [ -f $ZIP ];
then
echo "X.....$ZIP is able to be flashed"
fi
cd ..
echo "X......Flashing Kernel"
echo "X......Rebooting to recovery"
echo "X......Make sure USB debugging is enabled"
echo "X......If enabled, press ANYKEY now to reboot to recovery"
read -n1 -r key
adb reboot recovery
echo "X......As soon as you boot into recovery, run ADB sideload and then press ANY KEY"
read -n1 -r key
cd KKRT
adb sideload $ZIP >/dev/null 2>&1
cd ..
echo "X......Flashing Done!"
}
# export TC
if [ -d "$TC" ]; then
echo "building offline; thus exporting paths"
export CROSS_COMPILE=/home/neel/Desktop/toolchain/19/bin/aarch64-linux-android-
export CCACHE_EXEC="/usr/bin/ccache"
export USE_CCACHE=1
ccache -M 50G
export CCACHE_COMPRESS=1
export CCACHE_DIR="/home/neel/Desktop/ccache/.ccache"
else
echo "Not finding Toolchains at Home/toolchains; thus clonning them; would take some couple of minutes"
if [ -d "$VMTC" ]; then
echo exporting paths
export CROSS_COMPILE=$(pwd)/gcc/bin/aarch64-linux-gnu-
else
git clone --depth=1 https://github.com/KakarotKernel/clang.git -b linaro gcc
export CROSS_COMPILE=$(pwd)/gcc/bin/aarch64-linux-gnu-
fi
fi
UPLOAD(){
for i in KKRT/*.zip
do
curl -F "document=@$i" --form-string "caption=" "https://api.telegram.org/bot${BOT_TOKEN}/sendDocument?chat_id=${CHAT_ID}&parse_mode=HTML"
done
}
#
clear
echo " "
echo " _ __ _ ________ _____ _ _ "
echo "| | / /| | / /| ___ \_ _| ___ ___ _ __(_)_ __ | |_ "
echo "| |/ / | |/ / | |_/ / | | / __|/ __| '__| | '_ \| __|"
echo "| \ | \ | / | | \__ \ (__| | | | |_) | |_ "
echo "| |\ \| |\ \| |\ \ | | |___/\___|_| |_| .__/ \__|"
echo "\_| \_/\_| \_/\_| \_| \_/ |_| "
echo " coded by Neel0210 "
echo "Select"
echo "1 = Clean"
echo "2 = Clean Build"
echo "3 = Dirty Build"
echo "4 = Update dependencies"
echo "5 = Flash kernel using adb"
echo "6 = exit"
read n
if [ $n -eq 1 ]; then
CLEAN
fi
if [ $n -eq 2 ]; then
echo " " && echo " "
echo "Select build type"
echo "1 = Clean build all"
echo "2 = Test Build"
echo "3 = Production build"
read n
#
if [ $n -eq 1 ]; then
CLEAN
START
MAKE
END
fi
#
if [ $n -eq 2 ]; then
CLEAN
START
make $J701 O=J701
make -j$(nproc --all) O=J701
fi
#
if [ $n -eq 3 ]; then
CLEAN
START
MAKE
PACKALL
END
fi
#
fi
if [ $n -eq 3 ]; then
START
MAKE
PACKALL
END
fi
if [ $n -eq 4 ]; then
sudo bash scripts/bin
fi
if [ $n -eq 5 ]; then
FLASHING
fi