-
Notifications
You must be signed in to change notification settings - Fork 34
/
cronos.sh
executable file
·772 lines (758 loc) · 25.6 KB
/
cronos.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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
#!/bin/bash
#
# Cronos Build Script V4.1
# For Exynos7870
# Coded by BlackMesa/AnanJaser1211 @2019
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Main Dir
CR_DIR=$(pwd)
# Define toolchan path
CR_TC=~/Android/Toolchains/linaro-7.4.1-aarch64-linux/bin/aarch64-linux-gnu-
# Define proper arch and dir for dts files
CR_DTS=arch/arm64/boot/dts
CR_DTS_TREBLE=arch/arm64/boot/exynos7870_Treble.dtsi
CR_DTS_ONEUI=arch/arm64/boot/exynos7870_Oneui.dtsi
CR_DTS_X6LTE=arch/arm64/boot/exynos7870_x6lte.dtsi
# Define boot.img out dir
CR_OUT=$CR_DIR/Cronos/Out
CR_PRODUCT=$CR_DIR/Cronos/Product
# Presistant A.I.K Location
CR_AIK=$CR_DIR/Cronos/A.I.K
# Main Ramdisk Location
CR_RAMDISK_ONEUI=$CR_DIR/Cronos/Oneui
CR_RAMDISK_PORT=$CR_DIR/Cronos/Treble_unofficial
CR_RAMDISK_TREBLE=$CR_DIR/Cronos/Treble_official
# Compiled image name and location (Image/zImage)
CR_KERNEL=$CR_DIR/arch/arm64/boot/Image
# Compiled dtb by dtbtool
CR_DTB=$CR_DIR/boot.img-dtb
# Kernel Name and Version
CR_VERSION=V5.0
CR_NAME=CronosKernel
# Thread count
CR_JOBS=$(nproc --all)
# Target android version and platform (7/n/8/o/9/p)
CR_ANDROID=p
CR_PLATFORM=9.0.0
# Target ARCH
CR_ARCH=arm64
# Current Date
CR_DATE=$(date +%Y%m%d)
# Init build
export CROSS_COMPILE=$CR_TC
# General init
export ANDROID_MAJOR_VERSION=$CR_ANDROID
export PLATFORM_VERSION=$CR_PLATFORM
export $CR_ARCH
# J710X Specific
CR_ANDROID_J710X=n
CR_PLATFORM_J710X=7.0.0
##########################################
# Device specific Variables [SM-J530_2GB (F/G/S/L/K)]
CR_DTSFILES_J530X="exynos7870-j5y17lte_eur_open_00.dtb exynos7870-j5y17lte_eur_open_01.dtb exynos7870-j5y17lte_eur_open_02.dtb exynos7870-j5y17lte_eur_open_03.dtb exynos7870-j5y17lte_eur_open_05.dtb exynos7870-j5y17lte_eur_open_07.dtb"
CR_CONFG_J530X=j5y17lte_defconfig
CR_VARIANT_J530X=J530X
# Device specific Variables [SM-J530_3GB (Y/YM/FM/GM)]
CR_DTSFILES_J530M="exynos7870-j5y17lte_sea_openm_03.dtb exynos7870-j5y17lte_sea_openm_05.dtb exynos7870-j5y17lte_sea_openm_07.dtb"
CR_CONFG_J530M=j5y17lte_defconfig
CR_VARIANT_J530M=J530Y
# Device specific Variables [SM-J730X]
CR_DTSFILES_J730X="exynos7870-j7y17lte_eur_open_00.dtb exynos7870-j7y17lte_eur_open_01.dtb exynos7870-j7y17lte_eur_open_02.dtb exynos7870-j7y17lte_eur_open_03.dtb exynos7870-j7y17lte_eur_open_04.dtb exynos7870-j7y17lte_eur_open_05.dtb exynos7870-j7y17lte_eur_open_06.dtb exynos7870-j7y17lte_eur_open_07.dtb"
CR_CONFG_J730X=j7y17lte_defconfig
CR_VARIANT_J730X=J730X
# Device specific Variables [SM-J710X]
CR_DTSFILES_J710X="exynos7870-j7xelte_eur_open_00.dtb exynos7870-j7xelte_eur_open_01.dtb exynos7870-j7xelte_eur_open_02.dtb exynos7870-j7xelte_eur_open_03.dtb exynos7870-j7xelte_eur_open_04.dtb"
CR_CONFG_J710X=j7xelte_defconfig
CR_VARIANT_J710X=J710X
# Device specific Variables [SM-J701X]
CR_DTSFILES_J701X="exynos7870-j7velte_sea_open_00.dtb exynos7870-j7velte_sea_open_01.dtb exynos7870-j7velte_sea_open_03.dtb"
CR_CONFG_J701X=j7veltesea_defconfig
CR_VARIANT_J701X=J701X
# Device specific Variables [SM-G610X]
CR_DTSFILES_G610X="exynos7870-on7xelte_swa_open_00.dtb exynos7870-on7xelte_swa_open_01.dtb exynos7870-on7xelte_swa_open_02.dtb"
CR_CONFG_G610X=on7xelteswa_defconfig
CR_VARIANT_G610X=G610X
# Device specific Variables [SM-J600X]
CR_DTSFILES_J600X="exynos7870-j6lte_ltn_00.dtb exynos7870-j6lte_ltn_02.dtb"
CR_CONFG_J600X=j6lte_defconfig
CR_VARIANT_J600X=J600X
# Device specific Variables [SM-A600X]
CR_DTSFILES_A600X="exynos7870-a6lte_eur_open_00.dtb exynos7870-a6lte_eur_open_01.dtb exynos7870-a6lte_eur_open_02.dtb exynos7870-a6lte_eur_open_03.dtb"
CR_CONFG_A600X=a6lte_defconfig
CR_VARIANT_A600X=A600X
# Common configs
CR_CONFIG_TREBLE=treble_defconfig
CR_CONFIG_ONEUI=oneui_defconfig
CR_CONFIG_SPLIT=NULL
CR_CONFIG_HELIOS=helios_defconfig
# Flashable Variables
FL_MODEL=NULL
FL_VARIANT=NULL
FL_DIR=$CR_DIR/Cronos/Flashable
FL_EXPORT=$CR_DIR/Cronos/Flashable_OUT
FL_MAGISK=$FL_EXPORT/Helios/magisk/magisk.zip
FL_SCRIPT=$FL_EXPORT/META-INF/com/google/android/updater-script
#####################################################
# Script functions
read -p "Clean source (y/n) > " yn
if [ "$yn" = "Y" -o "$yn" = "y" ]; then
echo "Clean Build"
CR_CLEAN="1"
else
echo "Dirty Build"
CR_CLEAN="0"
fi
# Treble / OneUI
read -p "Variant? (1 (oneUI) | 2 (Treble) > " aud
if [ "$aud" = "Treble" -o "$aud" = "2" ]; then
echo "Build Treble Variant"
CR_MODE="2"
else
echo "Build OneUI Variant"
CR_MODE="1"
fi
BUILD_CLEAN()
{
if [ $CR_CLEAN = 1 ]; then
echo " "
echo " Cleaning build dir"
make clean && make mrproper
rm -r -f $CR_DTB
rm -rf $CR_DTS/.*.tmp
rm -rf $CR_DTS/.*.cmd
rm -rf $CR_DTS/*.dtb
rm -rf $CR_DIR/.config
rm -rf $CR_DTS/exynos7870.dtsi
rm -rf $CR_OUT/*.img
rm -rf $CR_OUT/*.zip
fi
if [ $CR_CLEAN = 0 ]; then
echo " "
echo " Skip Full cleaning"
rm -r -f $CR_DTB
rm -rf $CR_DTS/.*.tmp
rm -rf $CR_DTS/.*.cmd
rm -rf $CR_DTS/*.dtb
rm -rf $CR_DIR/.config
rm -rf $CR_DTS/exynos7870.dtsi
fi
}
BUILD_IMAGE_NAME()
{
CR_IMAGE_NAME=$CR_NAME-$CR_VERSION-$CR_VARIANT-$CR_DATE
# Flashable_script
if [ $CR_VARIANT = $CR_VARIANT_J530X-TREBLE ]; then
FL_VARIANT="J530X-Treble"
FL_MODEL=j5y17lte
fi
if [ $CR_VARIANT = $CR_VARIANT_J530X-ONEUI ]; then
FL_VARIANT="J530X-OneUI"
FL_MODEL=j5y17lte
fi
if [ $CR_VARIANT = $CR_VARIANT_J730X-TREBLE ]; then
FL_VARIANT="J730X-Treble"
FL_MODEL=j7y17lte
fi
if [ $CR_VARIANT = $CR_VARIANT_J730X-ONEUI ]; then
FL_VARIANT="J730X-OneUI"
FL_MODEL=j7y17lte
fi
if [ $CR_VARIANT = $CR_VARIANT_J710X-TREBLE ]; then
FL_VARIANT="J710X-Treble"
FL_MODEL=j7xelte
fi
if [ $CR_VARIANT = $CR_VARIANT_J710X-ONEUI ]; then
FL_VARIANT="J710X-OneUI"
FL_MODEL=j7xelte
fi
if [ $CR_VARIANT = $CR_VARIANT_J701X-TREBLE ]; then
FL_VARIANT="J701X-Treble"
FL_MODEL=j7velte
fi
if [ $CR_VARIANT = $CR_VARIANT_J701X-ONEUI ]; then
FL_VARIANT="J701X-OneUI"
FL_MODEL=j7velte
fi
if [ $CR_VARIANT = $CR_VARIANT_G610X-TREBLE ]; then
FL_VARIANT="G610X-Treble"
FL_MODEL=on7xelte
fi
if [ $CR_VARIANT = $CR_VARIANT_G610X-ONEUI ]; then
FL_VARIANT="G610X-OneUI"
FL_MODEL=on7xelte
fi
if [ $CR_VARIANT = $CR_VARIANT_J600X-TREBLE ]; then
FL_VARIANT="J600X-Treble"
FL_MODEL=j6lte
fi
if [ $CR_VARIANT = $CR_VARIANT_J600X-ONEUI ]; then
FL_VARIANT="J600X-OneUI"
FL_MODEL=j6lte
fi
if [ $CR_VARIANT = $CR_VARIANT_A600X-TREBLE ]; then
FL_VARIANT="A600X-Treble"
FL_MODEL=a6lte
fi
if [ $CR_VARIANT = $CR_VARIANT_A600X-ONEUI ]; then
FL_VARIANT="A600X-OneUI"
FL_MODEL=a6lte
fi
}
BUILD_GENERATE_CONFIG()
{
# Only use for devices that are unified with 2 or more configs
echo "----------------------------------------------"
echo " "
echo "Building defconfig for $CR_VARIANT"
echo " "
# Respect CLEAN build rules
BUILD_CLEAN
if [ -e $CR_DIR/arch/$CR_ARCH/configs/tmp_defconfig ]; then
echo " cleanup old configs "
rm -rf $CR_DIR/arch/$CR_ARCH/configs/tmp_defconfig
fi
echo " Copy $CR_CONFIG "
cp -f $CR_DIR/arch/$CR_ARCH/configs/$CR_CONFIG $CR_DIR/arch/$CR_ARCH/configs/tmp_defconfig
if [ $CR_CONFIG_SPLIT = NULL ]; then
echo " No split config support! "
else
echo " Copy $CR_CONFIG_SPLIT "
cat $CR_DIR/arch/$CR_ARCH/configs/$CR_CONFIG_SPLIT >> $CR_DIR/arch/$CR_ARCH/configs/tmp_defconfig
fi
if [ $CR_MODE = 2 ]; then
echo " Copy $CR_CONFIG_USB "
cat $CR_DIR/arch/$CR_ARCH/configs/$CR_CONFIG_USB >> $CR_DIR/arch/$CR_ARCH/configs/tmp_defconfig
fi
if [ $CR_MODE = 1 ]; then
echo " Copy $CR_CONFIG_USB "
cat $CR_DIR/arch/$CR_ARCH/configs/$CR_CONFIG_USB >> $CR_DIR/arch/$CR_ARCH/configs/tmp_defconfig
fi
echo " Copy $CR_CONFIG_HELIOS "
cat $CR_DIR/arch/$CR_ARCH/configs/$CR_CONFIG_HELIOS >> $CR_DIR/arch/$CR_ARCH/configs/tmp_defconfig
echo " Set $CR_VARIANT to generated config "
CR_CONFIG=tmp_defconfig
}
BUILD_OUT()
{
echo " "
echo "----------------------------------------------"
echo "$CR_VARIANT kernel build finished."
echo "Compiled DTB Size = $sizdT Kb"
echo "Kernel Image Size = $sizT Kb"
echo "Boot Image Size = $sizkT Kb"
echo "Image Generated at $CR_PRODUCT/$CR_IMAGE_NAME.img"
echo "Zip Generated at $CR_PRODUCT/$CR_NAME-$CR_VERSION-$FL_VARIANT-$CR_DATE.zip"
echo "Press Any key to end the script"
echo "----------------------------------------------"
}
BUILD_ZIMAGE()
{
echo "----------------------------------------------"
echo " "
echo "Building zImage for $CR_VARIANT"
export LOCALVERSION=-$CR_IMAGE_NAME
cp $CR_DTB_MOUNT $CR_DTS/exynos7870.dtsi
echo "Make $CR_CONFIG"
make $CR_CONFIG
make -j$CR_JOBS
if [ ! -e $CR_KERNEL ]; then
exit 0;
echo "Image Failed to Compile"
echo " Abort "
fi
du -k "$CR_KERNEL" | cut -f1 >sizT
sizT=$(head -n 1 sizT)
rm -rf sizT
echo " "
echo "----------------------------------------------"
}
BUILD_DTB()
{
echo "----------------------------------------------"
echo " "
echo "Building DTB for $CR_VARIANT"
# This source compiles dtbs while doing Image
./scripts/dtbTool/dtbTool -o $CR_DTB -d $CR_DTS/ -s 2048
if [ ! -e $CR_DTB ]; then
exit 0;
echo "DTB Failed to Compile"
echo " Abort "
fi
rm -rf $CR_DTS/.*.tmp
rm -rf $CR_DTS/.*.cmd
rm -rf $CR_DTS/*.dtb
rm -rf $CR_DTS/exynos7870.dtsi
du -k "$CR_DTB" | cut -f1 >sizdT
sizdT=$(head -n 1 sizdT)
rm -rf sizdT
echo " "
echo "----------------------------------------------"
}
PACK_BOOT_IMG()
{
echo "----------------------------------------------"
echo " "
echo "Building Boot.img for $CR_VARIANT"
# Copy Ramdisk
cp -rf $CR_RAMDISK/* $CR_AIK
# Move Compiled kernel and dtb to A.I.K Folder
mv $CR_KERNEL $CR_AIK/split_img/boot.img-zImage
mv $CR_DTB $CR_AIK/split_img/boot.img-dtb
# Create boot.img
$CR_AIK/repackimg.sh
# Remove red warning at boot
echo -n "SEANDROIDENFORCE" » $CR_AIK/image-new.img
# Copy boot.img to Production folder
cp $CR_AIK/image-new.img $CR_PRODUCT/$CR_IMAGE_NAME.img
# Move boot.img to out dir
mv $CR_AIK/image-new.img $CR_OUT/$CR_IMAGE_NAME.img
du -k "$CR_OUT/$CR_IMAGE_NAME.img" | cut -f1 >sizkT
sizkT=$(head -n 1 sizkT)
rm -rf sizkT
echo " "
$CR_AIK/cleanup.sh
}
PACK_FLASHABLE()
{
echo "----------------------------------------------"
echo "$CR_NAME $CR_VERSION Flashable Generator"
echo "----------------------------------------------"
echo " "
echo " Target device : $CR_VARIANT "
echo " Target image $CR_OUT/$CR_IMAGE_NAME.img "
echo " Prepare Temporary Dirs"
FL_DEVICE=$FL_EXPORT/Helios/device/$FL_MODEL/boot.img
echo " Copy $FL_DIR to $FL_EXPORT"
rm -rf $FL_EXPORT
mkdir $FL_EXPORT
cp -rf $FL_DIR/* $FL_EXPORT
echo " Generate updater for $FL_VARIANT"
sed -i 's/FL_NAME/ui_print("* '$CR_NAME'");/g' $FL_SCRIPT
sed -i 's/FL_VERSION/ui_print("* '$CR_VERSION'");/g' $FL_SCRIPT
sed -i 's/FL_VARIANT/ui_print("* For '$FL_VARIANT' ");/g' $FL_SCRIPT
sed -i 's/FL_DATE/ui_print("* Compiled at '$CR_DATE'");/g' $FL_SCRIPT
echo " Copy Image to $FL_DEVICE"
cp $CR_OUT/$CR_IMAGE_NAME.img $FL_DEVICE
echo " Packing zip"
# TODO: FInd a better way to zip
# TODO: support multi-compile
# TODO: Conditional
cd $FL_EXPORT
zip -r $CR_OUT/$CR_NAME-$CR_VERSION-$FL_VARIANT-$CR_DATE.zip .
cd $CR_DIR
rm -rf $FL_EXPORT
# Copy zip to production
cp $CR_OUT/$CR_NAME-$CR_VERSION-$FL_VARIANT-$CR_DATE.zip $CR_PRODUCT
# Move out dir to BUILD_OUT
# Respect CLEAN build rules
BUILD_CLEAN
}
# Main Menu
clear
echo "----------------------------------------------"
echo "$CR_NAME $CR_VERSION Build Script"
echo "----------------------------------------------"
PS3='Please select your option (1-9): '
menuvar=("SM-J530X" "SM-J730X" "SM-J710X" "SM-J701X" "SM-G610X" "SM-J600X" "SM-A600X" "Build_All" "Exit")
select menuvar in "${menuvar[@]}"
do
case $menuvar in
"SM-J530X")
clear
echo "Starting $CR_VARIANT_J530X kernel build..."
CR_CONFIG=$CR_CONFG_J530X
CR_DTSFILES=$CR_DTSFILES_J530X
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_J530X-TREBLE
CR_RAMDISK=$CR_RAMDISK_PORT
CR_DTB_MOUNT=$CR_DTS_TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_J530X-ONEUI
CR_DTB_MOUNT=$CR_DTS_ONEUI
CR_RAMDISK=$CR_RAMDISK_ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
read -n1 -r key
break
;;
"SM-J730X")
clear
echo "Starting $CR_VARIANT_J730X kernel build..."
CR_VARIANT=$CR_VARIANT_J730X
CR_CONFIG=$CR_CONFG_J730X
CR_DTSFILES=$CR_DTSFILES_J730X
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_J730X-TREBLE
CR_RAMDISK=$CR_RAMDISK_PORT
CR_DTB_MOUNT=$CR_DTS_TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_J730X-ONEUI
CR_DTB_MOUNT=$CR_DTS_ONEUI
CR_RAMDISK=$CR_RAMDISK_ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
read -n1 -r key
break
;;
"SM-J710X")
clear
echo "Starting $CR_VARIANT_J710X kernel build..."
export ANDROID_MAJOR_VERSION=$CR_ANDROID_J710X
export PLATFORM_VERSION=$CR_PLATFORM_J710X
CR_CONFIG=$CR_CONFG_J710X
CR_DTSFILES=$CR_DTSFILES_J710X
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_J710X-TREBLE
CR_RAMDISK=$CR_RAMDISK_PORT
CR_DTB_MOUNT=$CR_DTS_TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_J710X-ONEUI
CR_DTB_MOUNT=$CR_DTS_ONEUI
CR_RAMDISK=$CR_RAMDISK_ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
read -n1 -r key
break
;;
"SM-J701X")
clear
echo "Starting $CR_VARIANT_J701X kernel build..."
CR_CONFIG=$CR_CONFG_J701X
CR_DTSFILES=$CR_DTSFILES_J701X
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_J701X-TREBLE
CR_RAMDISK=$CR_RAMDISK_PORT
CR_DTB_MOUNT=$CR_DTS_TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_J701X-ONEUI
CR_DTB_MOUNT=$CR_DTS_ONEUI
CR_RAMDISK=$CR_RAMDISK_ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
read -n1 -r key
break
;;
"SM-G610X")
clear
echo "Starting $CR_VARIANT_G610X kernel build..."
CR_CONFIG=$CR_CONFG_G610X
CR_DTSFILES=$CR_DTSFILES_G610X
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_G610X-TREBLE
CR_RAMDISK=$CR_RAMDISK_PORT
CR_DTB_MOUNT=$CR_DTS_TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_G610X-ONEUI
CR_DTB_MOUNT=$CR_DTS_ONEUI
CR_RAMDISK=$CR_RAMDISK_ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
read -n1 -r key
break
;;
"SM-J600X")
clear
echo "Starting $CR_VARIANT_J600X kernel build..."
CR_DTSFILES=$CR_DTSFILES_J600X
CR_RAMDISK=$CR_RAMDISK_TREBLE
CR_CONFIG=$CR_CONFG_J600X
CR_DTB_MOUNT=$CR_DTS_X6LTE
export ANDROID_MAJOR_VERSION=$CR_ANDROID
export PLATFORM_VERSION=$CR_PLATFORM
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_J600X-TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_J600X-ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
read -n1 -r key
break
;;
"SM-A600X")
clear
echo "Starting $CR_VARIANT_A600X kernel build..."
CR_DTSFILES=$CR_DTSFILES_A600X
CR_RAMDISK=$CR_RAMDISK_TREBLE
CR_CONFIG=$CR_CONFG_A600X
CR_DTB_MOUNT=$CR_DTS_X6LTE
export ANDROID_MAJOR_VERSION=$CR_ANDROID
export PLATFORM_VERSION=$CR_PLATFORM
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_A600X-TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_A600X-ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
read -n1 -r key
break
;;
"Build_All")
echo "Starting $CR_VARIANT_J530X kernel build..."
CR_CONFIG=$CR_CONFG_J530X
CR_DTSFILES=$CR_DTSFILES_J530X
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_J530X-TREBLE
CR_RAMDISK=$CR_RAMDISK_PORT
CR_DTB_MOUNT=$CR_DTS_TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_J530X-ONEUI
CR_DTB_MOUNT=$CR_DTS_ONEUI
CR_RAMDISK=$CR_RAMDISK_ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
echo "Starting $CR_VARIANT_J730X kernel build..."
CR_VARIANT=$CR_VARIANT_J730X
CR_CONFIG=$CR_CONFG_J730X
CR_DTSFILES=$CR_DTSFILES_J730X
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_J730X-TREBLE
CR_RAMDISK=$CR_RAMDISK_PORT
CR_DTB_MOUNT=$CR_DTS_TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_J730X-ONEUI
CR_DTB_MOUNT=$CR_DTS_ONEUI
CR_RAMDISK=$CR_RAMDISK_ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
echo "Starting $CR_VARIANT_J710X kernel build..."
# Build Nougat WiFi HAL
export ANDROID_MAJOR_VERSION=$CR_ANDROID_J710X
export PLATFORM_VERSION=$CR_PLATFORM_J710X
CR_CONFIG=$CR_CONFG_J710X
CR_DTSFILES=$CR_DTSFILES_J710X
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_J710X-TREBLE
CR_RAMDISK=$CR_RAMDISK_PORT
CR_DTB_MOUNT=$CR_DTS_TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_J710X-ONEUI
CR_DTB_MOUNT=$CR_DTS_ONEUI
CR_RAMDISK=$CR_RAMDISK_ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
echo "Starting $CR_VARIANT_J701X kernel build..."
CR_CONFIG=$CR_CONFG_J701X
CR_DTSFILES=$CR_DTSFILES_J701X
# Build Oreo WiFi HAL
export ANDROID_MAJOR_VERSION=$CR_ANDROID
export PLATFORM_VERSION=$CR_PLATFORM
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_J701X-TREBLE
CR_RAMDISK=$CR_RAMDISK_PORT
CR_DTB_MOUNT=$CR_DTS_TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_J701X-ONEUI
CR_DTB_MOUNT=$CR_DTS_ONEUI
CR_RAMDISK=$CR_RAMDISK_ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
echo "Starting $CR_VARIANT_G610X kernel build..."
CR_CONFIG=$CR_CONFG_G610X
CR_DTSFILES=$CR_DTSFILES_G610X
# Build Oreo WiFi HAL
export ANDROID_MAJOR_VERSION=$CR_ANDROID
export PLATFORM_VERSION=$CR_PLATFORM
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_G610X-TREBLE
CR_RAMDISK=$CR_RAMDISK_PORT
CR_DTB_MOUNT=$CR_DTS_TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_G610X-ONEUI
CR_DTB_MOUNT=$CR_DTS_ONEUI
CR_RAMDISK=$CR_RAMDISK_ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
echo "Starting $CR_VARIANT_J600X kernel build..."
CR_DTSFILES=$CR_DTSFILES_J600X
CR_RAMDISK=$CR_RAMDISK_TREBLE
CR_CONFIG=$CR_CONFG_J600X
CR_DTB_MOUNT=$CR_DTS_X6LTE
# Build Oreo WiFi HAL
export ANDROID_MAJOR_VERSION=$CR_ANDROID
export PLATFORM_VERSION=$CR_PLATFORM
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_J600X-TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_J600X-ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
echo "Starting $CR_VARIANT_A600X kernel build..."
CR_DTSFILES=$CR_DTSFILES_A600X
CR_RAMDISK=$CR_RAMDISK_TREBLE
CR_CONFIG=$CR_CONFG_A600X
CR_DTB_MOUNT=$CR_DTS_X6LTE
# Build Oreo WiFi HAL
export ANDROID_MAJOR_VERSION=$CR_ANDROID
export PLATFORM_VERSION=$CR_PLATFORM
if [ $CR_MODE = "2" ]; then
echo " Building Treble variant "
CR_CONFIG_USB=$CR_CONFIG_TREBLE
CR_VARIANT=$CR_VARIANT_A600X-TREBLE
else
echo " Building OneUI variant "
CR_CONFIG_USB=$CR_CONFIG_ONEUI
CR_VARIANT=$CR_VARIANT_A600X-ONEUI
fi
BUILD_IMAGE_NAME
BUILD_GENERATE_CONFIG
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
PACK_FLASHABLE
BUILD_OUT
echo " "
echo " "
echo " compilation finished "
echo " Targets at $CR_OUT"
echo " "
echo "Press Any key to end the script"
echo "----------------------------------------------"
read -n1 -r key
break
;;
"Exit")
break
;;
*) echo Invalid option.;;
esac
done