-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·75 lines (65 loc) · 2.16 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
#!/bin/bash
#
# Compile script for QuicksilveR kernel
# Copyright (C) 2020-2021 Adithya R.
SECONDS=0 # builtin bash timer
ZIPNAME="HydrogenKernel-miatoll-$(date '+%Y%m%d-%H%M').zip"
GCC64_DIR="$HOME/GCC/aarch64-elf"
GCC32_DIR="$HOME/GCC/arm-eabi"
WET="transfer"
DEFCONFIG="cust_defconfig"
export PATH="$GCC64_DIR/bin:$PATH"
export PATH="$GCC32_DIR/bin/:$PATH"
if ! [ -a "$WET" ]; then
echo "Setting up wetransfer"
if ! curl -sL https://git.io/file-transfer | sh; then
echo "Unable to setup wetransfer ..... aborting"
exit 1
fi
fi
if ! [ -d "$GCC64_DIR" ]; then
echo "GCC for arm64 not found! Cloning to $GCC64_DIR..."
if ! git clone --depth=1 https://github.com/AOSPA/android_prebuilts_gcc_linux-x86_aarch64_aarch64-elf $GCC64_DIR; then
echo "Cloning GCC for Arm64 failed! Aborting..."
exit 1
fi
fi
if ! [ -d "$GCC32_DIR" ]; then
echo "GCC for arm32 not found! Cloning to $GCC32_DIR..."
if ! git clone --depth=1 https://github.com/Positron-V/android_prebuilts_gcc_linux-x86_arm_arm-none-eabi $GCC32_DIR; then
echo "Cloning GCC for Arm64 failed! Aborting..."
exit 1
fi
fi
if [[ $1 = "-c" || $1 = "--clean" ]]; then
rm -rf out
fi
if [[ $1 = "-r" || $1 = "--regen" ]]; then
make O=out ARCH=arm64 $DEFCONFIG savedefconfig
cp out/defconfig arch/arm64/configs/$DEFCONFIG
exit 1;
fi
mkdir -p out
make O=out ARCH=arm64 $DEFCONFIG
echo -e "\nStarting compilation...\n"
make -j$(nproc --all) O=out ARCH=arm64 CROSS_COMPILE=$GCC64_DIR/bin/aarch64-elf- CROSS_COMPILE_ARM32=$GCC32_DIR/bin/arm-none-eabi- Image.gz dtbo.img
if [ -f "out/arch/arm64/boot/Image.gz" ] && [ -f "out/arch/arm64/boot/dtbo.img" ]; then
echo -e "\nKernel compiled succesfully! Zipping up...\n"
if ! git clone -q https://github.com/Arjun-Ingole/AnyKernel3 -b miatoll; then
echo -e "\nCloning AnyKernel3 repo failed! Aborting..."
exit 1
fi
cp out/arch/arm64/boot/Image.gz AnyKernel3
cp out/arch/arm64/boot/dtbo.img AnyKernel3
rm -f *zip
cd AnyKernel3
rm -rf out/arch/arm64/boot
zip -r9 "../$ZIPNAME" * -x '*.git*' README.md *placeholder
cd ..
rm -rf AnyKernel3
echo -e "\nCompleted in $((SECONDS / 60)) minute(s) and $((SECONDS % 60)) second(s) !"
echo "Zip: $ZIPNAME"
./transfer wet $ZIPNAME; echo
else
echo -e "\nCompilation failed!"
fi