-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathporting.sh
executable file
·363 lines (305 loc) · 9.23 KB
/
porting.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
#!/bin/bash
# var
pwd_path=$(pwd)
uboot_dir=${pwd_path}/u-boot-2019.04
uboot_config=mx6ull_14x14_evk_defconfig
uboot_file=${uboot_dir}/u-boot-dtb.imx
# uboot_file=${uboot_dir}/u-boot.imx
output=output
verbose=2
robe_uboot_config=robe_mys_y6ulx_defconfig
robe_uboot_config_backup=${uboot_dir}/configs/${robe_uboot_config}
boot_script=${uboot_dir}/../boot.script.SDCARD
boot_scr=${uboot_dir}/../boot.scr
robe_output=
robe_verbose=2
sd_dev=/dev/sdb
# linux-4.19.57
linux_dir=${pwd_path}/linux-4.19.57
robe_linux_config=robe_mys_y6ull_defconfig
robe_output1=
robe_verbose1=2
robe_linux_config_backup=${linux_dir}/arch/arm/configs/${robe_linux_config}
robe_linux_image=${linux_dir}/arch/arm/boot/zImage
# env
ARCH=arm
# CROSS_COMPILE=${pwd_path}/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
CROSS_COMPILE=${pwd_path}/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
# CROSS_COMPILE=${pwd_path}/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
export ARCH CROSS_COMPILE
# setting
multi_thread=-j6
# BSP function
# notice
function echo_g()
{
echo -ne "\e[32m"
echo -n $*
echo -e "\e[0m"
}
function echo_r()
{
echo -ne "\e[31m"
echo -n $*
echo -e "\e[0m"
}
function echo_w()
{
echo -ne "\e[0m"
echo -n $*
echo -e "\e[0m"
}
function echo_g_n()
{
echo -ne "\e[32m"
echo -n $*
echo -ne "\e[0m"
}
function echo_r_n()
{
echo -ne "\e[31m"
echo -n $*
echo -ne "\e[0m"
}
function echo_w_n()
{
echo -ne "\e[0m"
echo -n $*
echo -ne "\e[0m"
}
function notice_pause_g()
{
echo_g_n $*
echo_g_n " press ENTER to continue!"
read
}
function notice_pause_r()
{
echo_r_n $*
echo_r_n " press ENTER to continue!"
read
}
function notice_pause_w()
{
echo_w_n $*
echo_w_n " press ENTER to continue!"
read
}
# uboot build
function uboot_distclean()
{
pushd ${uboot_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} distclean
echo_g "uboot distclean OK!"
popd
}
function uboot_build()
{
pushd ${uboot_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${uboot_config}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${multi_thread}
echo_g "build uboot OK!"
popd
}
# uboot test build
function uboot_distclean_output_verbose()
{
pushd ${uboot_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} distclean O=${output} V=${verbose}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} mrproper O=${output} V=${verbose}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} distclean
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} mrproper
echo_g "uboot distclean OK!"
popd
}
function uboot_build_output_verbose()
{
pushd ${uboot_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${uboot_config} O=${output} V=${verbose}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} O=${output} V=${verbose} ${multi_thread}
echo_g "build uboot OK!"
popd
}
# robe porting uboot build =========================================================================
function robe_uboot_clean_output_verbose()
{
pushd ${uboot_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} clean O=${robe_output} V=${robe_verbose}
echo_g "robe uboot clean OK!"
popd
}
function robe_uboot_mrproper_output_verbose()
{
pushd ${uboot_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} mrproper O=${robe_output} V=${robe_verbose}
echo_g "robe uboot mrproper OK!"
popd
}
function robe_uboot_distclean_output_verbose()
{
pushd ${uboot_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} distclean O=${robe_output} V=${robe_verbose}
echo_g "robe uboot distclean OK!"
popd
}
function robe_uboot_config_output_verbose()
{
pushd ${uboot_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${robe_uboot_config} O=${robe_output} V=${robe_verbose} && \
echo_g "robe uboot config OK!"
popd
}
function robe_uboot_menuconfig_output_verbose()
{
pushd ${uboot_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} menuconfig O=${robe_output} V=${robe_verbose} && \
echo_g "robe uboot menuconfig OK!"
rm -rf defconfig
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} savedefconfig O=${robe_output} V=${robe_verbose}
popd
}
function robe_uboot_config_backup_output_verbose()
{
pushd ${uboot_dir}
cp defconfig ${robe_uboot_config_backup} && \
echo_g "robe defconfig backup OK!"
popd
}
function robe_uboot_build_output_verbose()
{
pushd ${uboot_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} O=${robe_output} V=${robe_verbose} ${multi_thread} && \
echo_g "robe uboot build OK!"
popd
}
function robe_uboot_make_boot_scr_output_verbose()
{
${uboot_dir}/tools/mkimage -A arm -T script -O linux -d ${boot_script} ${boot_scr}
echo_g "robe boot.scr make OK!"
}
function robe_sdcard_burn_uboot()
{
sudo dd if=${uboot_file} of=${sd_dev} bs=1k seek=1
}
# robe porting linux build =========================================================================
function robe_linux_distclean_output_verbose()
{
pushd ${linux_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} distclean O=${robe_output1} V=${robe_verbose1}
echo_g "robe linux distclean OK!"
popd
}
function robe_linux_config_output_verbose()
{
pushd ${linux_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${robe_linux_config} O=${robe_output1} V=${robe_verbose1} && \
echo_g "robe linux config OK!"
popd
}
function robe_linux_menuconfig_output_verbose()
{
pushd ${linux_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} menuconfig O=${robe_output1} V=${robe_verbose1} && \
echo_g "robe linux menuconfig OK!"
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} savedefconfig O=${robe_output1} V=${robe_verbose1}
popd
}
function robe_linux_config_backup_output_verbose()
{
pushd ${linux_dir}
cp defconfig ${robe_linux_config_backup} && \
echo_g "robe defconfig backup OK!"
popd
}
function robe_linux_build_output_verbose()
{
pushd ${linux_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} O=${robe_output1} V=${robe_verbose1} ${multi_thread} && \
echo_g "robe linux build OK!"
popd
}
function robe_linux_dts_build_output_verbose()
{
pushd ${linux_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} O=${robe_output1} V=${robe_verbose1} ${multi_thread} dtbs && \
echo_g "robe linux dts build OK!"
popd
}
function robe_linux_modules_build_output_verbose()
{
pushd ${linux_dir}
make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} O=${robe_output1} V=${robe_verbose1} ${multi_thread} modules && \
echo_g "robe linux dts build OK!"
popd
}
# ================
# uboot_distclean
# uboot_build
# uboot_test_distclean
# uboot_test_build
# robe_uboot_clean_output_verbose
# robe_uboot_mrproper_output_verbose
# robe_uboot_distclean_output_verbose
# robe_uboot_config_output_verbose
# robe_uboot_menuconfig_output_verbose
# robe_uboot_config_backup_output_verbose
# robe_uboot_build_output_verbose
# robe_uboot_make_boot_scr_output_verbose
# robe_sdcard_burn_uboot
# robe_linux_distclean_output_verbose
# robe_linux_config_output_verbose
# robe_linux_menuconfig_output_verbose
# robe_linux_config_backup_output_verbose
# robe_linux_build_output_verbose
# robe_linux_dts_build_output_verbose
# =================================================USER INTERFACES
# onekey build menu. CLI UI
function menu()
{
echo_w [1] uboot_distclean
echo_w [2] uboot_build
echo_w [3] uboot_distclean_output_verbose
echo_w [4] uboot_build_output_verbose
echo_w
echo_w [5] robe_uboot_clean_output_verbose
echo_w [6] robe_uboot_mrproper_output_verbose
echo_w [7] robe_uboot_distclean_output_verbose
echo_w [8] robe_uboot_config_output_verbose
echo_w [9] robe_uboot_menuconfig_output_verbose
echo_w [91] robe_uboot_config_backup_output_verbose
echo_w [a] robe_uboot_build_output_verbose
echo_w [a1] robe_uboot_make_boot_scr_output_verbose
echo_w [b] robe_sdcard_burn_uboot
echo_w
echo_w [c] robe_linux_distclean_output_verbose
echo_w [d] robe_linux_config_output_verbose
echo_w [e] robe_linux_menuconfig_output_verbose
echo_w [f] robe_linux_config_backup_output_verbose
echo_w [g] robe_linux_build_output_verbose
echo_w [h] robe_linux_dts_build_output_verbose
}
function do_something()
{
menu
read -p "please select: " ANSWER
if [[ $ANSWER == "1" ]]; then uboot_distclean;fi
if [[ $ANSWER == "2" ]]; then uboot_build;fi
if [[ $ANSWER == "3" ]]; then uboot_distclean_output_verbose;fi
if [[ $ANSWER == "4" ]]; then uboot_build_output_verbose;fi
if [[ $ANSWER == "5" ]]; then robe_uboot_clean_output_verbose;fi
if [[ $ANSWER == "6" ]]; then robe_uboot_mrproper_output_verbose;fi
if [[ $ANSWER == "7" ]]; then robe_uboot_distclean_output_verbose;fi
if [[ $ANSWER == "8" ]]; then robe_uboot_config_output_verbose;fi
if [[ $ANSWER == "9" ]]; then robe_uboot_menuconfig_output_verbose;fi
if [[ $ANSWER == "91" ]]; then robe_uboot_config_backup_output_verbose;fi
if [[ $ANSWER == "a" ]]; then robe_uboot_build_output_verbose;fi
if [[ $ANSWER == "a1" ]]; then robe_uboot_make_boot_scr_output_verbose;fi
if [[ $ANSWER == "b" ]]; then robe_sdcard_burn_uboot;fi
if [[ $ANSWER == "c" ]]; then robe_linux_distclean_output_verbose;fi
if [[ $ANSWER == "d" ]]; then robe_linux_config_output_verbose;fi
if [[ $ANSWER == "e" ]]; then robe_linux_menuconfig_output_verbose;fi
if [[ $ANSWER == "f" ]]; then robe_linux_config_backup_output_verbose;fi
if [[ $ANSWER == "g" ]]; then robe_linux_build_output_verbose;fi
if [[ $ANSWER == "h" ]]; then robe_linux_dts_build_output_verbose;fi
}
do_something