forked from bemerguy/bandido-j7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_kernel.sh
executable file
·46 lines (35 loc) · 1.2 KB
/
build_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
#!/bin/bash
#Bandido kernel build script. fbs @ xda
#Set CROSS_COMPILE to your gcc path.
#It should end in the last "-" of the gcc's binary full path
export CROSS_COMPILE=/home/me/x-tools/14.1forsize/bin/aarch64-linux-gnu-
export ARCH=arm64
DATE_START=$(date +"%s")
IMAGE="out/arch/arm64/boot/Image"
DTB="out/arch/arm64/boot/dtb.img"
mkdir -p out
rm $IMAGE &> /dev/null
CPU=$(($(nproc) - 1))
make -C $(pwd) O=$(pwd)/out bandido_defconfig
make -j$CPU -C $(pwd) O=$(pwd)/out |tee ../bandj7.log
if [[ -f "$IMAGE" ]] && [[ -f "$DTB" ]]; then
STATE=`adb get-state`
if [[ $STATE != "recovery" ]]; then
adb reboot recovery
fi
KERNELZIP="bandido-kernel-$(date +"%Y%m%d%H%M").zip"
rm AnyKernel3/*Image* > /dev/null 2>&1
rm AnyKernel3/*.zip > /dev/null 2>&1
rm AnyKernel3/dt* > /dev/null 2>&1
cp $IMAGE AnyKernel3
cp $DTB AnyKernel3/dt
cd AnyKernel3
zip -r9 $KERNELZIP .
DATE_END=$(date +"%s")
DIFF=$(($DATE_END - $DATE_START))
echo -e "\nTime elapsed: $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds.\n"
adb wait-for-recovery
adb push $KERNELZIP /sdcard/
else
echo -e "ERROR\n"
fi