forked from ZenkaBestia/White-Wolf-UMI-UNI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyarpiin-lmi-build.sh
executable file
·188 lines (158 loc) · 3.48 KB
/
yarpiin-lmi-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
#!/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.gz"
DTBOIMG="dtbo.img"
# Defconfigs
LMIDEFCONFIG="yarpiin_lmi_defconfig"
# Build dirs
KERNEL_DIR="$(pwd)"
RESOURCE_DIR="$KERNEL_DIR/.."
KERNELFLASHER_DIR="$KERNEL_DIR/AnyKernel3"
MODULES_DIR="$KERNELFLASHER_DIR/modules/system/lib/modules"
# Toolchain paths
CLANG_DIR="$KERNEL_DIR/Toolchains/clang/bin"
GCC_DIR="$KERNEL_DIR/Toolchains/gcc/bin"
# Kernel Details
YARPIIN_VER="WHITE WOLF KERNEL UNI"
BASE_YARPIIN_VER="WHITE.WOLF.S."
LMI_VER="LMI"
VER=".012"
YARPIIN_LMI_VER="$BASE_YARPIIN_VER$LMI_VER$VER"
# Vars
export ARCH=arm64
export SUBARCH=arm64
export KBUILD_BUILD_USER=ZenkaBestia
export KBUILD_BUILD_HOST=Linux-VM
# Image dirs
ZIMAGE_DIR="$KERNEL_DIR/out/arch/arm64/boot"
# Output dir
ZIP_MOVE="$KERNEL_DIR/Zip"
# Functions
function clean_all {
if [ -f "$MODULES_DIR/*.ko" ]; then
rm `echo $MODULES_DIR"/*.ko"`
fi
if [ -f "$KERNELFLASHER_DIR/$KERNEL" ]; then
rm `echo $KERNELFLASHER_DIR/$KERNEL`
fi
if [ -f "$KERNELFLASHER_DIR/$DTBOIMG" ]; then
rm `echo $KERNELFLASHER_DIR/$DTBOIMG`
fi
cd $KERNEL_DIR
echo
make clean && make mrproper
rm -rf out/
}
function make_lmi_kernel {
echo
export LOCALVERSION=-`echo $YARPIIN_LMI_VER`
export TARGET_PRODUCT=lmi
make O=out ARCH=arm64 $LMIDEFCONFIG
PATH="$CLANG_DIR:$GCC_DIR:${PATH}" \
make -j$(nproc --all) O=out \
ARCH=arm64 \
CC=clang \
CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=aarch64-linux-android-
cp -vr $ZIMAGE_DIR/$KERNEL $KERNELFLASHER_DIR
cp -vr $ZIMAGE_DIR/$DTBOIMG $KERNELFLASHER_DIR
find ${KERNEL_DIR} -name '*.ko' -exec cp -v {} ${MODULES_DIR} \;
}
function make_lmi_zip {
cd $KERNELFLASHER_DIR
zip -r9 `echo $YARPIIN_LMI_VER`.zip *
mkdir $ZIP_MOVE
mv `echo $YARPIIN_LMI_VER`.zip $ZIP_MOVE/`echo $YARPIIN_LMI_VER-$(date +"%d%m%y")`.zip
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 "Building White Wolf 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 "Starting to build POCO F2 Pro kernel"
make_lmi_kernel
echo
while read -p "Do you want to zip POCO F2 Pro kernel (y/n)? " dchoice
do
case "$dchoice" in
y|Y)
make_lmi_zip
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
echo
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
echo
echo
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