forked from DyWN/android_kernel_xiaomi_msm8937
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·90 lines (76 loc) · 1.88 KB
/
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
#!/bin/bash
rm .version
# Bash Color
green='\033[01;32m'
red='\033[01;31m'
cyan='\033[01;36m'
blue='\033[01;34m'
blink_red='\033[05;31m'
restore='\033[0m'
# Resources
THREAD="-j$(grep -c ^processor /proc/cpuinfo)"
DEFCONFIG="land_defconfig"
KERNEL="Image.gz-dtb"
# Reloaded Kernel Details
BASE_VER="Spicy-"
VER="$(date +"%Y-%m-%d"-%H%M)"
K_VER="$BASE_VER$VER-land"
# Vars
export ARCH=arm64
export SUBARCH=arm64
# Paths
KERNEL_DIR=`pwd`
ANYKERNEL_DIR="$KERNEL_DIR/build"
REPACK_DIR="$ANYKERNEL_DIR"
PATCH_DIR="$ANYKERNEL_DIR/patch"
MODULES_DIR="$ANYKERNEL_DIR/modules"
ZIP_MOVE="$KERNEL_DIR/kernel_out"
ZIMAGE_DIR="$KERNEL_DIR/arch/arm64/boot"
# Functions
function make_kernel {
make $DEFCONFIG $THREAD
make savedefconfig
make $KERNEL $THREAD
make dtbs $THREAD
cp -vr $ZIMAGE_DIR/$KERNEL $REPACK_DIR/zImage
}
function make_modules {
cd $KERNEL_DIR
make modules $THREAD
mkdir $MODULES_DIR
find $KERNEL_DIR -name '*.ko' -exec cp {} $MODULES_DIR/ \;
cd $MODULES_DIR
$STRIP --strip-unneeded *.ko && mkdir pronto && mv wlan.ko pronto_wlan.ko && mv pronto_wlan.ko pronto
cd $KERNEL_DIR
}
function make_zip {
cd $REPACK_DIR
zip -r `echo $K_VER`.zip *
mkdir $ZIP_MOVE
mv `echo $K_VER`.zip $ZIP_MOVE
cd $KERNEL_DIR
}
DATE_START=$(date +"%s")
export CROSS_COMPILE=aarch64-linux-gnu-
rm -rf $MODULES_DIR/*
rm -rf $ZIP_MOVE/*
cd $ANYKERNEL_DIR
rm -rf zImage
cd $KERNEL_DIR
make clean && make mrproper
echo "cleaned directory"
echo "Compiling"
echo -e "${restore}"
make_kernel
#make_modules
make_zip
echo -e "${green}"
echo $K_VER.zip
echo "------------------------------------------"
echo -e "${restore}"
DATE_END=$(date +"%s")
DIFF=$(($DATE_END - $DATE_START))
echo "Time: $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."
echo " "
cd $ZIP_MOVE
ls