-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·73 lines (67 loc) · 2.14 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
#!/bin/bash
kernel_dir="${PWD}"
CCACHE=$(command -v ccache)
HOME=/home/rasenkai
objdir="${kernel_dir}/out"
anykernel=$HOME/kernel/asus/anykernel
builddir="${kernel_dir}/build"
ZIMAGE=$kernel_dir/out/arch/arm64/boot/Image.gz-dtb
kernel_name="Requiem-Nightly"
zip_name="$kernel_name-$(date +"%d%m%Y").zip"
GCC_DIR=$HOME/kernel/toolchain/gcc9
export CONFIG_FILE="X00T_defconfig"
export ARCH="arm64"
export KBUILD_BUILD_HOST="TheWorld"
export KBUILD_BUILD_USER="BuriBuriZaemon"
# Colors
NC='\033[0m'
RED='\033[0;31m'
LRD='\033[1;31m'
LGR='\033[1;32m'
make_defconfig()
{
# Needed to make sure we get dtb built and added to kernel image properly
START=$(date +"%s")
echo -e ${LGR} "############### Cleaning ################${NC}"
rm -rf ${objdir}/arch/arm64/boot/dts/essential/
rm $anykernel/Image.gz-dtb
rm -rf $ZIMAGE
echo -e ${LGR} "########### Generating Defconfig ############${NC}"
make -s ARCH=${ARCH} O=${objdir} ${CONFIG_FILE} -j$(nproc --all)
}
compile()
{
cd ${kernel_dir}
echo -e ${LGR} "######### Compiling kernel #########${NC}"
make -j$(nproc --all) O=out \
ARCH=${ARCH}\
CROSS_COMPILE="$HOME/kernel/toolchain/arm64-gcc/bin/aarch64-elf-" \
CROSS_COMPILE_ARM32="$HOME/kernel/toolchain/arm32-gcc/bin/arm-eabi-"
}
completion()
{
cd ${objdir}
COMPILED_IMAGE=arch/arm64/boot/Image.gz-dtb
if [[ -f ${COMPILED_IMAGE} ]]; then
mv -f $ZIMAGE $anykernel
cd $anykernel
find . -name "*.zip" -type f
find . -name "*.zip" -type f -delete
zip -r AnyKernel.zip *
mv AnyKernel.zip $zip_name
mv $anykernel/$zip_name $HOME/Desktop/$zip_name
END=$(date +"%s")
DIFF=$(($END - $START))
echo -e ${LGR} "############################################"
echo -e ${LGR} "############# OkThisIsEpic! ##############"
echo -e ${LGR} "############################################${NC}"
else
echo -e ${RED} "############################################"
echo -e ${RED} "## This Is Not Epic :'( ##"
echo -e ${RED} "############################################${NC}"
fi
}
make_defconfig
compile
completion
cd ${kernel_dir}