-
Notifications
You must be signed in to change notification settings - Fork 28
/
build_herolte.sh
executable file
·340 lines (312 loc) · 8.87 KB
/
build_herolte.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
#!/bin/bash
# kernel build script by Tkkg1994 v0.6 (optimized from apq8084 kernel source)
export MODEL=herolte
export VARIANT=eur
export ARCH=arm64
export VERSION=V3.1.0
export BUILD_CROSS_COMPILE=../Toolchain/aarch64-linux-android-4.9/bin/aarch64-linux-android-
export BUILD_JOB_NUMBER=`grep processor /proc/cpuinfo|wc -l`
RDIR=$(pwd)
OUTDIR=$RDIR/arch/$ARCH/boot
DTSDIR=$RDIR/arch/$ARCH/boot/dts
DTBDIR=$OUTDIR/dtb
DTCTOOL=$RDIR/scripts/dtc/dtc
INCDIR=$RDIR/include
PAGE_SIZE=2048
DTB_PADDING=0
case $MODEL in
herolte)
case $VARIANT in
can|duos|eur|xx)
KERNEL_DEFCONFIG=SuperKernel-herolte_defconfig
;;
kor|ktt|lgt|skt)
KERNEL_DEFCONFIG=SuperKernel-$MODEL-kor_defconfig
;;
*)
echo "Unknown variant: $VARIANT"
exit 1
;;
esac
;;
hero2lte)
case $VARIANT in
can|duos|eur|xx)
KERNEL_DEFCONFIG=SuperKernel-hero2lte_defconfig
;;
kor|ktt|lgt|skt)
KERNEL_DEFCONFIG=SuperKernel-$MODEL-kor_defconfig
;;
*)
echo "Unknown variant: $VARIANT"
exit 1
;;
esac
;;
*)
echo "Unknown device: $MODEL"
exit 1
;;
esac
FUNC_CLEAN_DTB()
{
if ! [ -d $RDIR/arch/$ARCH/boot/dts ] ; then
echo "no directory : "$RDIR/arch/$ARCH/boot/dts""
else
echo "rm files in : "$RDIR/arch/$ARCH/boot/dts/*.dtb""
rm $RDIR/arch/$ARCH/boot/dts/*.dtb
rm $RDIR/arch/$ARCH/boot/dtb/*.dtb
rm $RDIR/arch/$ARCH/boot/boot.img-dtb
rm $RDIR/arch/$ARCH/boot/boot.img-zImage
fi
}
FUNC_BUILD_DTIMAGE_TARGET()
{
[ -f "$DTCTOOL" ] || {
echo "You need to run ./build.sh first!"
exit 1
}
case $MODEL in
herolte)
case $VARIANT in
can|duos|eur|xx)
DTSFILES="exynos8890-herolte_eur_open_00 exynos8890-herolte_eur_open_01
exynos8890-herolte_eur_open_02 exynos8890-herolte_eur_open_03
exynos8890-herolte_eur_open_04 exynos8890-herolte_eur_open_08
exynos8890-herolte_eur_open_09"
;;
kor|ktt|lgt|skt)
DTSFILES="exynos8890-herolte_kor_all_00 exynos8890-herolte_kor_all_01
exynos8890-herolte_kor_all_02 exynos8890-herolte_kor_all_03
exynos8890-herolte_kor_all_04 exynos8890-herolte_kor_all_08
exynos8890-herolte_kor_all_09"
;;
*)
echo "Unknown variant: $VARIANT"
exit 1
;;
esac
;;
hero2lte)
case $VARIANT in
can|duos|eur|xx)
DTSFILES="exynos8890-hero2lte_eur_open_00 exynos8890-hero2lte_eur_open_01
exynos8890-hero2lte_eur_open_03 exynos8890-hero2lte_eur_open_04
exynos8890-hero2lte_eur_open_08"
;;
kor|ktt|lgt|skt)
DTSFILES="exynos8890-hero2lte_kor_all_00 exynos8890-hero2lte_kor_all_01
exynos8890-hero2lte_kor_all_03 exynos8890-hero2lte_kor_all_04
exynos8890-hero2lte_kor_all_08 exynos8890-hero2lte_kor_all_09"
;;
*)
echo "Unknown variant: $VARIANT"
exit 1
;;
esac
;;
*)
echo "Unknown device: $MODEL"
exit 1
;;
esac
mkdir -p $OUTDIR $DTBDIR
cd $DTBDIR || {
echo "Unable to cd to $DTBDIR!"
exit 1
}
rm -f ./*
echo "Processing dts files..."
for dts in $DTSFILES; do
echo "=> Processing: ${dts}.dts"
${CROSS_COMPILE}cpp -nostdinc -undef -x assembler-with-cpp -I "$INCDIR" "$DTSDIR/${dts}.dts" > "${dts}.dts"
echo "=> Generating: ${dts}.dtb"
$DTCTOOL -p $DTB_PADDING -i "$DTSDIR" -O dtb -o "${dts}.dtb" "${dts}.dts"
done
echo "Generating dtb.img..."
$RDIR/scripts/dtbTool/dtbTool -o "$OUTDIR/dtb.img" -d "$DTBDIR/" -s $PAGE_SIZE
echo "Done."
}
FUNC_BUILD_KERNEL()
{
echo ""
echo "=============================================="
echo "START : FUNC_BUILD_KERNEL"
echo "=============================================="
echo ""
echo "build common config="$KERNEL_DEFCONFIG ""
echo "build model config="$MODEL ""
FUNC_CLEAN_DTB
make -j$BUILD_JOB_NUMBER ARCH=$ARCH \
CROSS_COMPILE=$BUILD_CROSS_COMPILE \
$KERNEL_DEFCONFIG || exit -1
make -j$BUILD_JOB_NUMBER ARCH=$ARCH \
CROSS_COMPILE=$BUILD_CROSS_COMPILE || exit -1
FUNC_BUILD_DTIMAGE_TARGET
echo ""
echo "================================="
echo "END : FUNC_BUILD_KERNEL"
echo "================================="
echo ""
}
FUNC_BUILD_RAMDISK()
{
mv $RDIR/arch/$ARCH/boot/Image $RDIR/arch/$ARCH/boot/boot.img-zImage
mv $RDIR/arch/$ARCH/boot/dtb.img $RDIR/arch/$ARCH/boot/boot.img-dtb
case $MODEL in
herolte)
case $VARIANT in
can|duos|eur|xx)
rm -f $RDIR/ramdisk/SM-G930F/split_img/boot.img-zImage
rm -f $RDIR/ramdisk/SM-G930F/split_img/boot.img-dtb
mv -f $RDIR/arch/$ARCH/boot/boot.img-zImage $RDIR/ramdisk/SM-G930F/split_img/boot.img-zImage
mv -f $RDIR/arch/$ARCH/boot/boot.img-dtb $RDIR/ramdisk/SM-G930F/split_img/boot.img-dtb
cd $RDIR/ramdisk/SM-G930F
./repackimg.sh --nosudo
echo SEANDROIDENFORCE >> image-new.img
;;
ktt)
rm -f $RDIR/ramdisk/SM-G930K/split_img/boot.img-zImage
rm -f $RDIR/ramdisk/SM-G930K/split_img/boot.img-dtb
mv -f $RDIR/arch/$ARCH/boot/boot.img-zImage $RDIR/ramdisk/SM-G930K/split_img/boot.img-zImage
mv -f $RDIR/arch/$ARCH/boot/boot.img-dtb $RDIR/ramdisk/SM-G930K/split_img/boot.img-dtb
cd $RDIR/ramdisk/SM-G930K
./repackimg.sh --nosudo
echo SEANDROIDENFORCE >> image-new.img
;;
lgt)
rm -f $RDIR/ramdisk/SM-G930L/split_img/boot.img-zImage
rm -f $RDIR/ramdisk/SM-G930L/split_img/boot.img-dtb
mv -f $RDIR/arch/$ARCH/boot/boot.img-zImage $RDIR/ramdisk/SM-G930L/split_img/boot.img-zImage
mv -f $RDIR/arch/$ARCH/boot/boot.img-dtb $RDIR/ramdisk/SM-G930L/split_img/boot.img-dtb
cd $RDIR/ramdisk/SM-G930L
./repackimg.sh --nosudo
echo SEANDROIDENFORCE >> image-new.img
;;
skt)
rm -f $RDIR/ramdisk/SM-G930S/split_img/boot.img-zImage
rm -f $RDIR/ramdisk/SM-G930S/split_img/boot.img-dtb
mv -f $RDIR/arch/$ARCH/boot/boot.img-zImage $RDIR/ramdisk/SM-G930S/split_img/boot.img-zImage
mv -f $RDIR/arch/$ARCH/boot/boot.img-dtb $RDIR/ramdisk/SM-G930S/split_img/boot.img-dtb
cd $RDIR/ramdisk/SM-G930S
./repackimg.sh --nosudo
echo SEANDROIDENFORCE >> image-new.img
;;
*)
echo "Unknown variant: $VARIANT"
exit 1
;;
esac
;;
hero2lte)
case $VARIANT in
can|duos|eur|xx)
rm -f $RDIR/ramdisk/SM-G935F/split_img/boot.img-zImage
rm -f $RDIR/ramdisk/SM-G935F/split_img/boot.img-dtb
mv -f $RDIR/arch/$ARCH/boot/boot.img-zImage $RDIR/ramdisk/SM-G935F/split_img/boot.img-zImage
mv -f $RDIR/arch/$ARCH/boot/boot.img-dtb $RDIR/ramdisk/SM-G935F/split_img/boot.img-dtb
cd $RDIR/ramdisk/SM-G935F
./repackimg.sh --nosudo
echo SEANDROIDENFORCE >> image-new.img
;;
ktt)
rm -f $RDIR/ramdisk/SM-G935K/split_img/boot.img-zImage
rm -f $RDIR/ramdisk/SM-G935K/split_img/boot.img-dtb
mv -f $RDIR/arch/$ARCH/boot/boot.img-zImage $RDIR/ramdisk/SM-G935K/split_img/boot.img-zImage
mv -f $RDIR/arch/$ARCH/boot/boot.img-dtb $RDIR/ramdisk/SM-G935K/split_img/boot.img-dtb
cd $RDIR/ramdisk/SM-G935K
./repackimg.sh --nosudo
echo SEANDROIDENFORCE >> image-new.img
;;
lgt)
rm -f $RDIR/ramdisk/SM-G935L/split_img/boot.img-zImage
rm -f $RDIR/ramdisk/SM-G935L/split_img/boot.img-dtb
mv -f $RDIR/arch/$ARCH/boot/boot.img-zImage $RDIR/ramdisk/SM-G935L/split_img/boot.img-zImage
mv -f $RDIR/arch/$ARCH/boot/boot.img-dtb $RDIR/ramdisk/SM-G935L/split_img/boot.img-dtb
cd $RDIR/ramdisk/SM-G935L
./repackimg.sh --nosudo
echo SEANDROIDENFORCE >> image-new.img
;;
skt)
rm -f $RDIR/ramdisk/SM-G935S/split_img/boot.img-zImage
rm -f $RDIR/ramdisk/SM-G935S/split_img/boot.img-dtb
mv -f $RDIR/arch/$ARCH/boot/boot.img-zImage $RDIR/ramdisk/SM-G935S/split_img/boot.img-zImage
mv -f $RDIR/arch/$ARCH/boot/boot.img-dtb $RDIR/ramdisk/SM-G935S/split_img/boot.img-dtb
cd $RDIR/ramdisk/SM-G935S
./repackimg.sh --nosudo
echo SEANDROIDENFORCE >> image-new.img
;;
*)
echo "Unknown variant: $VARIANT"
exit 1
;;
esac
;;
*)
echo "Unknown device: $MODEL"
exit 1
;;
esac
}
FUNC_BUILD_ZIP()
{
cd $RDIR/build
rm $MODEL-$VARIANT.img
case $MODEL in
herolte)
case $VARIANT in
can|duos|eur|xx)
mv -f $RDIR/ramdisk/SM-G930F/image-new.img $RDIR/build/$MODEL-$VARIANT.img
;;
ktt)
mv -f $RDIR/ramdisk/SM-G930K/image-new.img $RDIR/build/$MODEL-$VARIANT.img
;;
lgt)
mv -f $RDIR/ramdisk/SM-G930L/image-new.img $RDIR/build/$MODEL-$VARIANT.img
;;
skt)
mv -f $RDIR/ramdisk/SM-G930S/image-new.img $RDIR/build/$MODEL-$VARIANT.img
;;
*)
echo "Unknown variant: $VARIANT"
exit 1
;;
esac
;;
hero2lte)
case $VARIANT in
can|duos|eur|xx)
mv -f $RDIR/ramdisk/SM-G935F/image-new.img $RDIR/build/$MODEL-$VARIANT.img
;;
ktt)
mv -f $RDIR/ramdisk/SM-G935K/image-new.img $RDIR/build/$MODEL-$VARIANT.img
;;
lgt)
mv -f $RDIR/ramdisk/SM-G935L/image-new.img $RDIR/build/$MODEL-$VARIANT.img
;;
skt)
mv -f $RDIR/ramdisk/SM-G935S/image-new.img $RDIR/build/$MODEL-$VARIANT.img
;;
*)
echo "Unknown variant: $VARIANT"
exit 1
;;
esac
;;
*)
echo "Unknown device: $MODEL"
exit 1
;;
esac
}
# MAIN FUNCTION
rm -rf ./build.log
(
START_TIME=`date +%s`
FUNC_BUILD_KERNEL
FUNC_BUILD_RAMDISK
FUNC_BUILD_ZIP
END_TIME=`date +%s`
let "ELAPSED_TIME=$END_TIME-$START_TIME"
echo "Total compile time was $ELAPSED_TIME seconds"
) 2>&1 | tee -a ./build.log