-
Notifications
You must be signed in to change notification settings - Fork 1
/
cronos.sh
executable file
·244 lines (239 loc) · 8.43 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
#!/bin/bash
#
# Cronos Build Script V3.1
# For Exynos7420
# 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-4.9.4-aarch64-linux/bin/aarch64-linux-gnu-
# Define proper arch and dir for dts files
CR_DTS=arch/arm64/boot/dts
# Define boot.img out dir
CR_OUT=$CR_DIR/Vega/Out
# Presistant A.I.K Location
CR_AIK=$CR_DIR/Vega/A.I.K
# Main Ramdisk Location
CR_RAMDISK=$CR_DIR/Vega/ramdisk
# 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=V1.0
CR_NAME=VegaPie_Kernel
# Thread count
CR_JOBS=5
# Target android version and platform (7/n/8/o/9/p)
CR_ANDROID=o
CR_PLATFORM=8.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
##########################################
# Device specific Variables [SM-N920CIGSLK]
CR_DTSFILES_N920C="exynos7420-noblelte_eur_open_00.dtb exynos7420-noblelte_eur_open_01.dtb exynos7420-noblelte_eur_open_02.dtb exynos7420-noblelte_eur_open_03.dtb exynos7420-noblelte_eur_open_04.dtb exynos7420-noblelte_eur_open_05.dtb exynos7420-noblelte_eur_open_06.dtb exynos7420-noblelte_eur_open_08.dtb exynos7420-noblelte_eur_open_09.dtb"
CR_CONFG_N920C=noblelte_defconfig
CR_VARIANT_N920C=N920C
# Device specific Variables [SM-G920X]
CR_DTSFILES_G920X="exynos7420-zeroflte_eur_open_00.dtb exynos7420-zeroflte_eur_open_01.dtb exynos7420-zeroflte_eur_open_02.dtb exynos7420-zeroflte_eur_open_03.dtb exynos7420-zeroflte_eur_open_04.dtb exynos7420-zeroflte_eur_open_05.dtb exynos7420-zeroflte_eur_open_06.dtb exynos7420-zeroflte_eur_open_07.dtb"
CR_CONFG_G920X=zeroflte_defconfig
CR_VARIANT_G920X=G920X
# Device specific Variables [SM-G925X]
CR_DTSFILES_G925X="exynos7420-zerolte_eur_open_01.dtb exynos7420-zerolte_eur_open_02.dtb exynos7420-zerolte_eur_open_03.dtb exynos7420-zerolte_eur_open_04.dtb exynos7420-zerolte_eur_open_05.dtb exynos7420-zerolte_eur_open_06.dtb exynos7420-zerolte_eur_open_07.dtb exynos7420-zerolte_eur_open_08.dtb"
CR_CONFG_G925X=zerolte_defconfig
CR_VARIANT_G925X=G925X
# Device specific Variables [SM-G928X]
CR_DTSFILES_G928X="exynos7420-zenlte_eur_open_00.dtb exynos7420-zenlte_eur_open_09.dtb"
CR_CONFG_G928X=zenlte_defconfig
CR_VARIANT_G928X=G928X
#####################################################
# Script functions
read -p "Clean source (y/n) > " yn
if [ "$yn" = "Y" -o "$yn" = "y" ]; then
echo "Clean Build"
make clean && make mrproper
rm -r -f $CR_DTB
rm -rf $CR_DTS/.*.tmp
rm -rf $CR_DTS/.*.cmd
rm -rf $CR_DTS/*.dtb
else
echo "Dirty Build"
rm -r -f $CR_DTB
rm -rf $CR_DTS/.*.tmp
rm -rf $CR_DTS/.*.cmd
rm -rf $CR_DTS/*.dtb
fi
BUILD_ZIMAGE()
{
echo "----------------------------------------------"
echo " "
echo "Building zImage for $CR_VARIANT"
export LOCALVERSION=-$CR_NAME-$CR_VERSION-$CR_VARIANT-$CR_DATE
make $CR_CONFG
make -j$CR_JOBS
if [ ! -e ./arch/arm64/boot/Image ]; then
exit 0;
echo "zImage Failed to Compile"
echo " Abort "
fi
echo " "
echo "----------------------------------------------"
}
BUILD_DTB()
{
echo "----------------------------------------------"
echo " "
echo "Building DTB for $CR_VARIANT"
# Use the DTS list provided in the build script.
# This source does not compile dtbs while doing Image
make $CR_DTSFILES
./scripts/dtbTool/dtbTool -o ./boot.img-dtb -d $CR_DTS/ -s 2048
du -k "./boot.img-dtb" | cut -f1 >dtbsz
dtbsz=$(head -n 1 dtbsz)
rm -rf dtbsz
echo "Combined DTB Size = $dtbsz Kb"
rm -rf $CR_DTS/.*.tmp
rm -rf $CR_DTS/.*.cmd
rm -rf $CR_DTS/*.dtb
echo " "
echo "----------------------------------------------"
}
PACK_BOOT_IMG()
{
echo "----------------------------------------------"
echo " "
echo "Building Boot.img for $CR_VARIANT"
cp -rf $CR_RAMDISK/* $CR_AIK
# 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
# Calculate Boot.img Size
du -k "$CR_AIK/image-new.img" | cut -f1 >bootsz
bootsz=$(head -n 1 bootsz)
rm -rf bootsz
# Move boot.img to out dir
mv $CR_AIK/image-new.img $CR_OUT/$CR_NAME-$CR_VERSION-$CR_DATE-$CR_VARIANT.img
echo " "
$CR_AIK/cleanup.sh
}
# Main Menu
clear
echo "----------------------------------------------"
echo "$CR_NAME $CR_VERSION Build Script"
echo "----------------------------------------------"
PS3='Please select your option (1-5): '
menuvar=("SM-N920C" "SM-G920X" "SM-G925X" "SM-G928X" "Exit")
select menuvar in "${menuvar[@]}"
do
case $menuvar in
"SM-N920C")
clear
echo "Starting $CR_VARIANT_N920C kernel build..."
CR_VARIANT=$CR_VARIANT_N920C
CR_CONFG=$CR_CONFG_N920C
CR_DTSFILES=$CR_DTSFILES_N920C
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
echo " "
echo "----------------------------------------------"
echo "$CR_VARIANT kernel build finished."
echo "$CR_VARIANT Ready at $CR_OUT"
echo "Combined DTB Size = $dtbsz Kb"
echo "Combined BOOT Size = $bootsz Kb"
echo "Press Any key to end the script"
echo "----------------------------------------------"
read -n1 -r key
break
;;
"SM-G920X")
clear
echo "Starting $CR_VARIANT_G920X kernel build..."
CR_VARIANT=$CR_VARIANT_G920X
CR_CONFG=$CR_CONFG_G920X
CR_DTSFILES=$CR_DTSFILES_G920X
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
echo " "
echo "----------------------------------------------"
echo "$CR_VARIANT kernel build finished."
echo "$CR_VARIANT Ready at $CR_OUT"
echo "Combined DTB Size = $dtbsz Kb"
echo "Combined BOOT Size = $bootsz Kb"
echo "Press Any key to end the script"
echo "----------------------------------------------"
read -n1 -r key
break
;;
"SM-G925X")
clear
echo "Starting $CR_VARIANT_G925X kernel build..."
CR_VARIANT=$CR_VARIANT_G925X
CR_CONFG=$CR_CONFG_G925X
CR_DTSFILES=$CR_DTSFILES_G925X
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
echo " "
echo "----------------------------------------------"
echo "$CR_VARIANT kernel build finished."
echo "$CR_VARIANT Ready at $CR_OUT"
echo "Combined DTB Size = $dtbsz Kb"
echo "Combined BOOT Size = $bootsz Kb"
echo "Press Any key to end the script"
echo "----------------------------------------------"
read -n1 -r key
break
;;
"SM-G928X")
clear
echo "Starting $CR_VARIANT_G928X kernel build..."
CR_VARIANT=$CR_VARIANT_G928X
CR_CONFG=$CR_CONFG_G928X
CR_DTSFILES=$CR_DTSFILES_G928X
BUILD_ZIMAGE
BUILD_DTB
PACK_BOOT_IMG
echo " "
echo "----------------------------------------------"
echo "$CR_VARIANT kernel build finished."
echo "$CR_VARIANT Ready at $CR_OUT"
echo "Combined DTB Size = $dtbsz Kb"
echo "Combined BOOT Size = $bootsz Kb"
echo "Press Any key to end the script"
echo "----------------------------------------------"
read -n1 -r key
break
;;
"Exit")
break
;;
*) echo Invalid option.;;
esac
done