-
Notifications
You must be signed in to change notification settings - Fork 21
/
build-gcc-miui.sh
53 lines (50 loc) · 2.06 KB
/
build-gcc-miui.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
echo -e "\nStarting compilation...\n"
# ENV
CONFIG=vendor/sixteen_defconfig
KERNEL_DIR=$(pwd)
PARENT_DIR="$(dirname "$KERNEL_DIR")"
KERN_IMG="$HOME/out-new-R/out/arch/arm64/boot/Image.gz-dtb"
export KBUILD_BUILD_USER="elang"
export KBUILD_BUILD_HOST="kyvangkaelang"
export PATH="$HOME/toolchain/gcc-arm64/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/toolchain/gcc-arm64/lib:$LD_LIBRARY_PATH"
export KBUILD_COMPILER_STRING="$($HOME/toolchain/gcc-arm64/bin/aarch64-elf-gcc --version | head -n 1 | cut -d ')' -f 2 | awk '{print $1}')"
export CROSS_COMPILE_ARM32=$HOME/toolchain/gcc-arm/bin/arm-eabi-
export out=$HOME/out-new-R
# Functions
clang_build () {
make -j$(nproc --all) O=$out \
ARCH=arm64 \
CC="aarch64-elf-gcc" \
AR="aarch64-elf-ar" \
NM="aarch64-elf-nm" \
LD="aarch64-elf-ld.bfd" \
AS="aarch64-elf-as" \
OBJCOPY="aarch64-elf-objcopy" \
OBJDUMP="aarch64-elf-objdump" \
CROSS_COMPILE_ARM32=$CROSS_COMPILE_ARM32
}
# Build kernel
make O=$out ARCH=arm64 $CONFIG > /dev/null
echo -e "${bold}Compiling with GCC${normal}\n$KBUILD_COMPILER_STRING"
echo -e "\nCompiling $ZIPNAME\n"
clang_build
if [ -f "$out/arch/arm64/boot/Image.gz" ] && [ -f "$out/arch/arm64/boot/dtbo.img" ] && [ -f "$out/arch/arm64/boot/dts/qcom/trinket.dtb" ]; then
echo -e "\nKernel compiled succesfully! Zipping up...\n"
ZIPNAME="SixTeen•Kernel•MIUI•R•Ginkgo•Willow-$(date '+%Y%m%d-%H%M').zip"
if [ ! -d AnyKernel3 ]; then
git clone -q https://github.com/Kyvangka1610/AnyKernel3.git
fi;
cp -f $out/arch/arm64/boot/Image.gz AnyKernel3
cp -f $out/arch/arm64/boot/dtbo.img AnyKernel3
cp -f $out/arch/arm64/boot/dts/qcom/trinket.dtb AnyKernel3/dtb
cd AnyKernel3
zip -r9 "$HOME/$ZIPNAME" *
cd ..
rm -rf AnyKernel3
echo -e "\nCompleted in $((SECONDS / 60)) minute(s) and $((SECONDS % 60)) second(s) !"
echo -e "Zip: $ZIPNAME\n"
rm -rf $out
else
echo -e "\nCompilation failed!\n"
fi;