forked from aosp-mirror/kernel_msm
-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.sh
executable file
·150 lines (131 loc) · 2.62 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
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
#!/bin/bash
# Bash Color
green='\033[01;32m'
red='\033[01;31m'
blink_red='\033[05;31m'
restore='\033[0m'
clear
# Resources
THREAD="-j9"
KERNEL="zImage"
DEFCONFIG="hells_defconfig"
# Kernel Details
BASE_HC_VER="hC"
VER="-b83.5-L"
HC_VER="$BASE_HC_VER$VER"
# Vars
export LOCALVERSION=-`echo $HC_VER`
export ARCH=arm
export SUBARCH=arm
# Paths
KERNEL_DIR=`pwd`
REPACK_DIR="${HOME}/Android/Kernel/hC-N4-anykernel"
ZIP_MOVE="${HOME}/Android/Kernel/hC-releases/N4"
ZIMAGE_DIR="${HOME}/Android/Kernel/hells-Core-N4/arch/arm/boot"
DB_FOLDER="${HOME}/Dropbox/Kernel-Betas/N4"
# Functions
function clean_all {
rm -rf $REPACK_DIR/kernel/zImage
make clean && make mrproper
}
function make_kernel {
make $DEFCONFIG
make $THREAD
cp -vr $ZIMAGE_DIR/$KERNEL $REPACK_DIR/kernel
}
function make_zip {
cd $REPACK_DIR
zip -9 -r `echo $HC_VER`.zip .
mv `echo $HC_VER`.zip $ZIP_MOVE
cd $KERNEL_DIR
}
function copy_dropbox {
cd $ZIP_MOVE
cp -vr `echo $HC_VER`.zip $DB_FOLDER
cd $KERNEL_DIR
}
DATE_START=$(date +"%s")
echo -e "${green}"
echo "hC Kernel Creation Script:"
echo
echo "---------------"
echo "Kernel Version:"
echo "---------------"
echo -e "${red}"; echo -e "${blink_red}"; echo "$HC_VER"; echo -e "${restore}";
echo -e "${green}"
echo "-----------------"
echo "Making hC Kernel:"
echo "-----------------"
echo -e "${restore}"
while read -p "Please choose your option: [1]clean-build / [2]dirty-build / [3]abort " cchoice
do
case "$cchoice" in
1 )
echo -e "${green}"
echo
echo "[..........Cleaning up..........]"
echo
echo -e "${restore}"
clean_all
echo -e "${green}"
echo
echo "[....Building `echo $HC_VER`....]"
echo
echo -e "${restore}"
make_kernel
echo -e "${green}"
echo
echo "[....Make `echo $HC_VER`.zip....]"
echo
echo -e "${restore}"
make_zip
echo -e "${green}"
echo
echo "[.....Moving `echo $HC_VER`.....]"
echo
echo -e "${restore}"
copy_dropbox
break
;;
2 )
echo -e "${green}"
echo
echo "[....Building `echo $HC_VER`....]"
echo
echo -e "${restore}"
make_kernel
echo -e "${green}"
echo
echo "[....Make `echo $HC_VER`.zip....]"
echo
echo -e "${restore}"
make_zip
echo -e "${green}"
echo
echo "[.....Moving `echo $HC_VER`.....]"
echo
echo -e "${restore}"
copy_dropbox
break
;;
3 )
break
;;
* )
echo -e "${red}"
echo
echo "Invalid try again!"
echo
echo -e "${restore}"
;;
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