forked from CyanogenMod/android_kernel_oneplus_msm8974
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildscript
executable file
·156 lines (140 loc) · 3.34 KB
/
buildscript
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
#!/bin/bash
echo ' _____ _ ___ '
echo ' |__ __| | |___ | _ | '
echo ' | | | _ | | __| '
echo ' |_| |_| |_| |___| '
echo ' ____ '
echo ' | __| ____ ___ ___ ____ '
echo ' | | __ | ___|| _ || _ || __ | '
echo ' | |_| || | | __|| __|| || | '
echo ' |______||_| |___||___||_||_| '
echo ' ________ '
echo ' | | ______ ____ _ _ ____ ___ '
echo ' | | | || _ || __|| |___ | || __ || __|'
echo ' | | | || |_| || |__ | _ || || || || __|'
echo ' |__|__|__||____|_||____||_| |_||_||_||_||___|'
echo
echo ' Compile Script by YoshiShaPow '
# Tuneables
buildname="TGM-bacon-lollipop-v1.2.0"
defconfig="tgm_bacon_defconfig"
jobs="6"
toolchain="/home/yoshishapow/kernels/toolchains/cortex_a15/bin/arm-cortex_a15-linux-gnueabihf-"
kerneltype="zImage"
output="../out/bacon"
ps=2048
base=0x00000000
ramdisk_offset=0x02000000
tags_offset=0x01e00000
cmdline="console=ttyHSL0,115200,n8 androidboot.hardware=bacon user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 androidboot.selinux=permissive"
# Let's start
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=$toolchain
echo
while read -p "Do you want to make clean (y/n)? " cchoice
do
case "$cchoice" in
y|Y )
make clean && make mrproper
rm -rf ../out/bacon/files && mkdir ../out/bacon/files
rm -rf ozip/boot.img
rm -rf arch/arm/boot/"$kerneltype"
mkdir -p ozip/system/lib/modules
rm -rf out
mkdir out
echo
echo "Done"
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
echo
while read -p "Do you want to make defconfig (y/n)? " cchoice
do
case "$cchoice" in
y|Y )
make $defconfig
echo
echo "Done"
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
echo
DATE_START=$(date +"%s")
while read -p "Do you want to build (y/n)? " cchoice
do
echo
case "$cchoice" in
y|Y )
make -j$jobs
echo
echo "Done"
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 dt.img..."
echo
./dtbToolCM -2 -o out/dt.img -s 2048 -p scripts/dtc/ arch/arm/boot/
./dtbToolCM -2 -o ../out/bacon/files/dtb -s 2048 -p scripts/dtc/ arch/arm/boot/
cp out/dt.img ../out/bacon/files
cp out/"$kerneltype" ../out/bacon/files
echo "dt.img created and files copied..."
else
echo "No build found..."
exit 0;
fi
echo
if [ -f out/"$kerneltype" ]; then
echo "Making boot.img..."
echo
./mkbootimg --kernel out/"$kerneltype" --ramdisk resources/initramfs.img --cmdline "$cmdline" --base $base --pagesize $ps --ramdisk_offset $ramdisk_offset --tags_offset $tags_offset --dt out/dt.img --output ozip/boot.img
cp ozip/boot.img ../out/bacon/files
else
echo "No $kerneltype found..."
exit 0;
fi
if [ -f arch/arm/boot/"$kerneltype" ]; then
rm -rf ozip/system
cd ozip
zip -r ../$buildname.zip .
mv ../$buildname.zip ../$output
cd ..
rm -rf out ozip/system
echo "Done..."
rm -rf ozip/boot.img
else
echo "Can't finish off zip..."
exit 0;
fi
DATE_END=$(date +"%s")
DIFF=$(($DATE_END - $DATE_START))
echo "Time: $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."