forked from trizet/android_kernel_lenovo_P70
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzImage.sh
More file actions
executable file
·252 lines (237 loc) · 4.92 KB
/
zImage.sh
File metadata and controls
executable file
·252 lines (237 loc) · 4.92 KB
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
#!/bin/bash
CONFIG_1=P70_defconfig #No OC
CONFIG_2=P70_GC_defconfig #OC CPU & GPU
CONFIG_3=P70_G_defconfig #OC only GPU
CONFIG_4=P70_C_defconfig #OC only CPU
KERNEL_DIR=~/kernel-3.10
CROSS_COMPILE=~/gcc/gcc-linaro-5.2-aarch64-linux-gnu/bin/aarch64-linux-gnu-
OUT=out
VERSION=$(cat $KERNEL_DIR/arch/arm64/configs/P70_defconfig | grep CONFIG_LOCALVERSION= | cut -d '-' -f5 | sed 's/.$//')
make_aosp_kernel() {
if cd $KERNEL_DIR
then
if [ ! -d "$OUT" ]
then
mkdir $OUT
fi
if make O=$OUT ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE $1
then
if make -j2 O=$OUT ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE
then
if cp out/arch/arm64/boot/Image.gz-dtb unpack/boot_aosp/boot.img-kernel
then
if cd unpack/boot_aosp
then
if ./repack.sh
then
if mv boot.img ../boot_aosp.img
then
if rm -f boot.img-kernel
then
cd $KERNEL_DIR
fi
fi
fi
fi
fi
fi
fi
fi
}
make_vdt_kernel() {
if cd $KERNEL_DIR
then
if [ ! -d "$OUT" ]
then
mkdir $OUT
fi
if make O=$OUT ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE $1
then
if make -j2 O=$OUT ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE
then
if cp out/arch/arm64/boot/Image.gz-dtb unpack/boot_vdt/boot.img-kernel
then
if cd unpack/boot_vdt
then
if mkdir -p ramdisk/data ramdisk/dev ramdisk/proc ramdisk/sys ramdisk/system
then
if ./repack.sh
then
if mv boot.img ../boot_vdt.img
then
if rm -f boot.img-kernel
then
cd $KERNEL_DIR
fi
fi
fi
fi
fi
fi
fi
fi
fi
}
make_cm_kernel() {
if cd $KERNEL_DIR
then
if [ ! -d "$OUT" ]
then
mkdir $OUT
fi
if make O=$OUT ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE $1
then
if make -j2 O=$OUT ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE
then
if cp out/arch/arm64/boot/Image.gz-dtb unpack/boot_cm/boot.img-kernel
then
if cd unpack/boot_cm
then
if ./repack.sh
then
if mv boot.img ../boot_cm.img
then
if rm -f boot.img-kernel
then
cd $KERNEL_DIR
fi
fi
fi
fi
fi
fi
fi
fi
}
make_aicp_kernel() {
if cd $KERNEL_DIR
then
if [ ! -d "$OUT" ]
then
mkdir $OUT
fi
if make O=$OUT ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE $1
then
if make -j2 O=$OUT ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE
then
if cp out/arch/arm64/boot/Image.gz-dtb unpack/boot_aicp/boot.img-kernel
then
if cd unpack/boot_aicp
then
if ./repack.sh
then
if mv boot.img ../boot_aicp.img
then
if rm -f boot.img-kernel
then
cd $KERNEL_DIR
fi
fi
fi
fi
fi
fi
fi
fi
}
make_cm_zormax_kernel() {
if cd $KERNEL_DIR
then
if [ ! -d "$OUT" ]
then
mkdir $OUT
fi
if make O=$OUT ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE $1
then
if make -j2 O=$OUT ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE
then
if cp out/arch/arm64/boot/Image.gz-dtb unpack/boot_cm_zormax/boot.img-kernel
then
if cd unpack/boot_cm_zormax
then
if ./repack.sh
then
if mv boot.img ../boot_cm_zormax.img
then
if rm -f boot.img-kernel
then
cd $KERNEL_DIR
fi
fi
fi
fi
fi
fi
fi
fi
}
make_zip() {
if cd $KERNEL_DIR/unpack
then
if [ "$1" == "$CONFIG_1" ]
then
zip -r -1 Boot_P70_$VERSION.zip META-INF system boot_aosp.img boot_vdt.img boot_cm.img boot_aicp.img boot_cm_zormax.img
elif [ "$1" == "$CONFIG_2" ]
then
zip -r -1 Boot_P70_GC_$VERSION.zip META-INF system boot_aosp.img boot_vdt.img boot_cm.img boot_aicp.img boot_cm_zormax.img
elif [ "$1" == "$CONFIG_3" ]
then
zip -r -1 Boot_P70_G_$VERSION.zip META-INF system boot_aosp.img boot_vdt.img boot_cm.img boot_aicp.img boot_cm_zormax.img
elif [ "$1" == "$CONFIG_4" ]
then
zip -r -1 Boot_P70_C_$VERSION.zip META-INF system boot_aosp.img boot_vdt.img boot_cm.img boot_aicp.img boot_cm_zormax.img
fi
if rm -f boot_aosp.img
then
if rm -f boot_vdt.img
then
if rm -f boot_cm.img
then
if rm -f boot_aicp.img
then
if rm -f boot_cm_zormax.img
then
cd $KERNEL_DIR
fi
fi
fi
fi
fi
fi
}
boot_p70() {
make_aosp_kernel "$CONFIG_1"
make_vdt_kernel "$CONFIG_1"
make_cm_kernel "$CONFIG_1"
make_aicp_kernel "$CONFIG_1"
make_cm_zormax_kernel "$CONFIG_1"
make_zip "$CONFIG_1"
}
boot_p70_gc() {
make_aosp_kernel "$CONFIG_2"
make_vdt_kernel "$CONFIG_2"
make_cm_kernel "$CONFIG_2"
make_aicp_kernel "$CONFIG_2"
make_cm_zormax_kernel "$CONFIG_2"
make_zip "$CONFIG_2"
}
boot_p70_g() {
make_aosp_kernel "$CONFIG_3"
make_vdt_kernel "$CONFIG_3"
make_cm_kernel "$CONFIG_3"
make_aicp_kernel "$CONFIG_3"
make_cm_zormax_kernel "$CONFIG_3"
make_zip "$CONFIG_3"
}
boot_p70_c() {
make_aosp_kernel "$CONFIG_4"
make_vdt_kernel "$CONFIG_4"
make_cm_kernel "$CONFIG_4"
make_aicp_kernel "$CONFIG_4"
make_cm_zormax_kernel "$CONFIG_4"
make_zip "$CONFIG_4"
}
boot_p70
boot_p70_gc
boot_p70_g
boot_p70_c