-
Notifications
You must be signed in to change notification settings - Fork 2
/
build
executable file
·152 lines (133 loc) · 3.16 KB
/
build
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
#!/bin/bash
echo "OK Kernel Buildscript"
echo
# Tuneables Here
toolchain_path="/home/olokos/toolchains/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-"
name_of_your_kernel="OK-Kernel-V8.4"
defconfig="rhine_lp_honami_moj_defconfig"
cpu_jobs="12"
kerneltype="zImage"
cmdline="androidboot.hardware=qcom user_debug=31 maxcpus=4 msm_rtb.filter=0x3F ehci-hcd.park=3 msm_rtb.enable=0 lpj=192598 dwc3.maximum_speed=high dwc3_msm.prop_chg_detect=Y androidboot.selinux=permissive enforcing=0"
ps=2048
base=0x00000000
ramdisk_offset=0x02000000
tags_offset=0x01E00000
export ARCH=arm
export CROSS_COMPILE=$toolchain_path
export LOCALVERSION=-`echo $name_of_your_kernel`
# Go to kernel root
cd /home/olokos/OK-Kernel-Z1-LP/
while read -p "Do you want to make clean (y/n)? " cchoice
do
case "$cchoice" in
y|Y )
rm -rf out
make clean -j$cpu_jobs
rm -rf arch/arm/boot/"$kerneltype"
echo "Also make clean packed ramdisk"
cd ramdisk-custom/ramdisk-complete/sbin
rm ramdisk.cpio
rm ramdisk-recovery.cpio
cd ../..
rm ramdisk.cpio.gz
cd ..
echo "Done"
echo
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
while read -p "Do you want to make defconfig (y/n)? " cchoice
do
case "$cchoice" in
y|Y )
make $defconfig -j$cpu_jobs
echo
echo "Done"
echo
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
while read -p "Do you want to build (y/n)? " cchoice
do
echo
case "$cchoice" in
y|Y )
mkdir out
#ramdisk packing begins here
echo "Packing base device ramdisk..."
cd ramdisk-custom/ramdisk-device
find . | cpio -o -H newc > ../ramdisk-complete/sbin/ramdisk.cpio
echo "Packing recovery ramdisk..."
cd ..
cd ramdisk-recovery
find . | cpio -o -H newc > ../ramdisk-complete/sbin/ramdisk-recovery.cpio
echo "Both recovery and device ramdisk packed!"
echo " "
echo "Begin packing complete ramdisk"
cd ../ramdisk-complete
echo "Packing complete ramdisk..."
find . | cpio -o -H newc | gzip > ../ramdisk.cpio.gz
echo "Move packed ramdisk to /out"
cp ../ramdisk.cpio.gz ../../out
echo "Back out into kernel source directory"
cd ../..
#ramdisk packing ends here
echo "Ramdisk packing finished!"
echo " "
echo "Start building OK Kernel..."
make -j$cpu_jobs > kernel-build-log.txt
echo
echo "Done"
echo
cp arch/arm/boot/"$kerneltype" out
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
if [ -f out/"$kerneltype" ]; then
echo "Making boot.img..."
echo
./mkqcdtbootimg --kernel arch/arm/boot/"$kerneltype" --ramdisk out/ramdisk.cpio.gz --cmdline "$cmdline" --base $base --pagesize $ps --ramdisk_offset $ramdisk_offset --tags_offset $tags_offset --dt_dir arch/arm/boot/ --output out/boot.img
else
echo "No $kerneltype found..."
fi
echo "cd'ing to /out and flashing kernel..."
cd out
adb reboot bootloader
echo
#sudo not needed for fastboot if udev rules are set like so:
#https://wiki.cyanogenmod.org/w/UDEV
#but with mode 0666
fastboot flash boot boot.img
echo "Kernel successfuly flashed!"
echo
fastboot reboot
echo
exit 0;
# (c) 2015, YoshiShaPow <[email protected]>