forked from yarpiin/White-Wolf-SGS9-LOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
yarpiin-build.sh
executable file
·191 lines (165 loc) · 3.31 KB
/
yarpiin-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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/bin/bash
# Bash Color
green='\033[01;32m'
red='\033[01;31m'
blink_red='\033[05;31m'
restore='\033[0m'
clear
# Resources
THREAD="-j$(grep -c ^processor /proc/cpuinfo)"
KERNEL="Image"
DTBIMAGE="dtb.img"
STARDEFCONFIG="exynos9810-starlte_defconfig"
STAR2DEFCONFIG="yarpiin_defconfig"
KERNEL_DIR="/home/yarpiin/Android/Kernel/SGS9/White-Wolf-SGS9-LOS"
RESOURCE_DIR="$KERNEL_DIR/.."
KERNELFLASHER_DIR="/home/yarpiin/Android/Kernel/SGS9/LosFlasher"
TOOLCHAIN_DIR="/home/yarpiin/Android/Toolchains"
# Kernel Details
BASE_YARPIIN_VER="WHITE.WOLF.SGS9.LOS"
VER=".006"
PERM=".PERM"
YARPIIN_VER="$BASE_YARPIIN_VER$VER"
YARPIIN_PERM_VER="$BASE_YARPIIN_VER$VER$PERM"
# Vars
export LOCALVERSION=-`echo $YARPIIN_VER`
export CROSS_COMPILE="$TOOLCHAIN_DIR/aarch64-linux-gnu/bin/aarch64-linux-gnu-"
export ARCH=arm64
export SUBARCH=arm64
export KBUILD_BUILD_USER=yarpiin
export KBUILD_BUILD_HOST=kernel
# Paths
STARIMG_DIR="/home/yarpiin/Android/Kernel/SGS9/LosFlasher/boot/G960"
STAR2IMG_DIR="/home/yarpiin/Android/Kernel/SGS9/LosFlasher/boot/G965"
ZIP_MOVE="/home/yarpiin/Android/Kernel/SGS9/Zip"
ZIMAGE_DIR="$KERNEL_DIR/arch/arm64/boot"
# Functions
function clean_all {
if [ -f "$MODULES_DIR/*.ko" ]; then
rm `echo $MODULES_DIR"/*.ko"`
fi
cd $STARIMG_DIR
rm -rf zImage
rm -rf img.dtb
cd $STAR2IMG_DIR
rm -rf zImage
rm -rf img.dtb
cd $KERNEL_DIR
echo
make clean && make mrproper
}
function make_star_kernel {
echo
make $STARDEFCONFIG
make $THREAD
cp -vr $ZIMAGE_DIR/$KERNEL $STARIMG_DIR/zImage
cp -vr $ZIMAGE_DIR/$DTBIMAGE $STARIMG_DIR/img.dtb
}
function make_star2_kernel {
echo
make $STAR2DEFCONFIG
make $THREAD
cp -vr $ZIMAGE_DIR/$KERNEL $STAR2IMG_DIR/zImage
cp -vr $ZIMAGE_DIR/$DTBIMAGE $STAR2IMG_DIR/img.dtb
}
function make_zip {
cd $KERNELFLASHER_DIR
zip -r9 `echo $YARPIIN_VER`.zip *
mv `echo $YARPIIN_VER`.zip $ZIP_MOVE
cd $KERNEL_DIR
}
DATE_START=$(date +"%s")
echo -e "${green}"
echo "YARPIIN Kernel Creation Script:"
echo
echo "---------------"
echo "Kernel Version:"
echo "---------------"
echo -e "${red}"; echo -e "${blink_red}"; echo "$YARPIIN_VER"; echo -e "${restore}";
echo -e "${green}"
echo "-----------------"
echo "Making YARPIIN Kernel:"
echo "-----------------"
echo -e "${restore}"
while read -p "Do you want to clean stuffs (y/n)? " cchoice
do
case "$cchoice" in
y|Y )
clean_all
echo
echo "All Cleaned now."
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
echo
while read -p "Do you want to build G960 kernel (y/n)? " dchoice
do
case "$dchoice" in
y|Y)
make_star_kernel
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
echo
while read -p "Do you want to build G965 kernel (y/n)? " dchoice
do
case "$dchoice" in
y|Y)
make_star2_kernel
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
echo
while read -p "Do you want to zip kernel (y/n)? " dchoice
do
case "$dchoice" in
y|Y)
make_zip
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
echo -e "${green}"
echo "-------------------"
echo "Build Completed in:"
echo "-------------------"
echo -e "${restore}"
DATE_END=$(date +"%s")
DIFF=$(($DATE_END - $DATE_START))
echo "Time: $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."
echo