-
Notifications
You must be signed in to change notification settings - Fork 2
/
compile.sh
executable file
·131 lines (120 loc) · 3.81 KB
/
compile.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
#!/bin/sh
# Copyright (c) 2020 MhDzMR-Kernel <[email protected]>
KERNEL_DIR=$PWD
ZIMAGE=$KERNEL_DIR/out/arch/arm/boot/zImage-dtb
XIMAGE=$KERNEL_DIR/outdir/AnyKernel3/zImage-dtb
OUT=$KERNEL_DIR/out
BUILD_START=$(date +"%s")
blue='\033[0;34m'
cyan='\033[0;36m'
yellow='\033[0;33m'
green='\033[0;92m'
red='\033[0;31m'
purple='\033[0;95m'
white='\033[0;97m'
nocol='\033[0m'
banner(){
echo "$blue*****************************************************"
echo "*****************************************************"
echo "$purple Script create by MhDzuMAiR "
echo "$purple
███╗ ███╗██╗ ██╗██████╗ ███████╗███╗ ███╗██████╗
████╗ ████║██║ ██║██╔══██╗╚══███╔╝████╗ ████║██╔══██╗
██╔████╔██║███████║██║ ██║ ███╔╝ ██╔████╔██║██████╔╝
██║╚██╔╝██║██╔══██║██║ ██║ ███╔╝ ██║╚██╔╝██║██╔══██╗
██║ ╚═╝ ██║██║ ██║██████╔╝███████╗██║ ╚═╝ ██║██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
"
echo "$yellow ________________________________________________________ "
echo "$blue*****************************************************"
echo "*****************************************************$nocol"
}
check_dir() {
#make kernel compiling dir...
if ! [ -f $out ];
then
echo "$green create out dir fresh"
mkdir -p out
fi
}
export_things(){
#export toolchain , custom build_user , custom build_host , arch
export ARCH=arm
export ARCH_MTK_PLATFORM=mt6735
export CROSS_COMPILE=$KERNEL_DIR/gcc-linaro-7.5.0-2019.12-x86_64_arm-eabi/bin/arm-eabi-
export KBUILD_BUILD_USER="CheRRy"
export KBUILD_BUILD_HOST="JiLeBi"
#clean the build
make clean mrproper
#defconfig
make -C $PWD O=out ARCH=arm nicklaus_defconfig
}
compile_kernel ()
{
echo
echo
echo "$blue***********************************************"
echo " Compiling MhDzMR™.anDroid Kernel... "
echo "***********************************************$nocol"
echo ""
#start compile
make -j8 -C $PWD O=out ARCH=arm
if ! [ -f $ZIMAGE ];
then
echo "$red Kernel Compilation failed! Fix the errors! $nocol"
exit 1
fi
}
zipping ()
{
echo ""
echo ""
echo "$cyan***********************************************"
echo " Packing MhDzMR™ anDroid Kernel... "
echo "***********************************************$nocol"
echo ""
echo "$yellow It's Time for COOK MhDzMR™.anDroid Kernel $nocol"
echo ""
echo "$yellow Checking if there is already zImage $nocol"
if [ -f $XIMAGE ];
then
rm $XIMAGE
echo "$red Deleting existing zImage"
fi
echo "$yellow Copying zImage-dtb to outdir/Anykernel3 $nocol"
cp out/arch/arm/boot/zImage-dtb outdir/AnyKernel3/
#using AnyKernel3 templete
cd outdir/AnyKernel3
make
sleep 0.6;
echo ""
echo ""
echo "" "Done Making Recovery Flashable Zip"
echo ""
echo ""
echo "Locate MhDzMR™.anDroid Kernel in the following path : "
echo "outdir/Anykernel3"
echo ""
echo "$blue***********************************************"
echo " MhDzMR™.anDroid Kernel "
echo "***********************************************$nocol"
echo ""
BUILD_END=$(date +"%s")
echo " l.o.a.d.i.n.g..."
sleep 0.4;
echo " please wait... Calculating the build period"
sleep 0.1;
echo ""
echo ""
echo ""
echo ""
DIFF=$(($BUILD_END - $BUILD_START))
echo "$yellow Build completed in $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds.$n"
banner
sleep 5.0;
}
banner
check_dir
export_things
compile_kernel
zipping