-
Notifications
You must be signed in to change notification settings - Fork 2
/
kernel.sh
executable file
·90 lines (71 loc) · 2.64 KB
/
kernel.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
#!/bin/bash
#
#Custom Build Script
#
# Copyright © 2016, "DarkAbhi" <[email protected]>
#
# This software is licensed under the terms of the GNU General Public
# License version 2, as published by the Free Software Foundation, and
# may be copied, distributed, and modified under those terms.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# Please maintain this if you use this script or any part of it
#
# Init Script
KERNEL_DIR=$PWD
KERNEL="Image.gz-dtb"
KERN_IMG=$KERNEL_DIR/out/arch/arm64/boot/Image.gz-dtb
BASE_VER="v1.0"
VER="-v1-$(date +"%Y-%m-%d"-%H%M)-"
BUILD_START=$(date +"%s")
# Color Code Script
black='\e[0;30m' # Black
red='\e[0;31m' # Red
green='\e[0;32m' # Green
yellow='\e[0;33m' # Yellow
blue='\e[0;34m' # Blue
purple='\e[0;35m' # Purple
cyan='\e[0;36m' # Cyan
white='\e[0;37m' # White
nocol='\033[0m' # Default
# Tweakable Stuff
export ARCH=arm64
export CROSS_COMPILE=/home/darkabhi/aarch64-linux-android-4.9/bin/aarch64-linux-android-
export JOBS=16
export SUBARCH=arm
export KBUILD_BUILD_USER="DarkAbhi"
export KBUILD_BUILD_HOST="Arch"
#COMPILATION SCRIPTS
echo -e "${green}"
echo "--------------------------------------------------------"
echo " Initializing build to compile Ver: $VER "
echo "--------------------------------------------------------"
echo -e "$yellow***********************************************"
echo " Compiling KERNEL!! "
echo -e "***********************************************$nocol"
rm -f $KERN_IMG
echo -e "$red***********************************************"
echo " Cleaning Up Before Compile "
echo -e "***********************************************$nocol"
$clean rm -rf out && mkdir out
echo -e "$yellow***********************************************"
echo " Initialising DEFCONFIG "
echo -e "***********************************************$nocol"
make -C $PWD O=$PWD/out ARCH=arm64 dark_defconfig
echo -e "$yellow***********************************************"
echo " Cooking KERNEL!! "
echo -e "***********************************************$nocol"
make -j$JOBS -C $PWD O=$PWD/out ARCH=arm64 KCFLAGS=-mno-android
if ! [ -a $ZIMAGE ];
then
echo -e "$Red Kernel Compilation failed! Fix the errors! $nocol"
exit 1
fi
#BUILD TIME
BUILD_END=$(date +"%s")
DIFF=$(($BUILD_END - $BUILD_START))
echo -e "$Yellow Build completed in $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds.$nocol"