-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtargets_collect_6.6.sh
More file actions
executable file
·466 lines (444 loc) · 15.1 KB
/
targets_collect_6.6.sh
File metadata and controls
executable file
·466 lines (444 loc) · 15.1 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
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
#!/bin/bash
set -ex
ROOT_PATH=`pwd`
TOOLS_PATH="tools/bin2ext4"
DEB_PATH=${ROOT_PATH}"/../tmp-glibc/deploy/deb"
IMAGE_k230=${ROOT_PATH}"/../../../meta-k230/images/prebuit_20240828"
OPENTEE_BRINGUP_64k6_PATH=${ROOT_PATH}"/../tmp-glibc/work/riscv64_k6.6ry_kcdebug_tcxt-oe-linux/trusted-firmware-a/2.3-r0/git/build/qemu_xuantie/debug"
OPENTEE_TEEOS_64k6_PATH=${ROOT_PATH}"/../tmp-glibc/work/riscv64_k6.6ry_kcdebug_tcxt-oe-linux/trusted-firmware-a/2.3-r0/recipe-sysroot/usr/lib/optee-os/out/riscv/core"
IMAGE_PATH_64k6_DEBUG=${ROOT_PATH}"/../tmp-glibc/deploy/images/riscv64-k6.6ry-kcdebug-tcxt"
IMAGE_PATH_64k6_DEFAULT=${ROOT_PATH}"/../tmp-glibc/deploy/images/riscv64-k6.6ry-kcdefault-tcxt"
IMAGE_PATH_32k6_DEBUG=${ROOT_PATH}"/../tmp-glibc/deploy/images/riscv32-k6.6ry-kcdebug-tcxt"
IMAGE_PATH_32k6_DEFAULT=${ROOT_PATH}"/../tmp-glibc/deploy/images/riscv32-k6.6ry-kcdefault-tcxt"
IMAGE_PATH_64QEMU_UBOOT=${ROOT_PATH}"/../tmp-glibc/work/riscv64_k6.6ry_kcdebug_tcxt-oe-linux/u-boot/1_2024.10-r0/build/qemu-riscv64_smode_defconfig"
IMAGE_PATH_64FPGA_UBOOT=${ROOT_PATH}"/../tmp-glibc/work/riscv64_k6.6ry_kcdebug_tcxt-oe-linux/u-boot-fpga/1_2024.10-r0/build/fpga_xuantie_riscv64_smode_defconfig"
IMAGE_PATH_32QEMU_UBOOT=${ROOT_PATH}"/../tmp-glibc/work/riscv32_k6.6ry_kcdebug_tcxt-oe-linux/u-boot/1_2024.10-r0/build/qemu-riscv32_smode_defconfig"
IMAGE_PATH_32FPGA_UBOOT=${ROOT_PATH}"/../tmp-glibc/work/riscv32_k6.6ry_kcdebug_tcxt-oe-linux/u-boot-fpga/1_2024.10-r0/build/fpga_xuantie_riscv32_smode_defconfig"
print_help(){
echo -e "\033[32m ===\t\t This is a script used to generate Linux SDK \t\t\t==\033[0m"
echo -e "\033[32m ** it will get MACHINE and IMAGE information from file build-id.txt saved in buildhistory** ==\033[0m"
}
do_copy_opensbi(){
echo -e "\033[32m === copy opensbi image ==\033[0m"
set -x
mkdir -p archived/images/opensbi/
cp ${IMAGE_PATH_64k6_DEBUG}/fw_dynamic.elf archived/images/opensbi/fw_dynamic-v1.3-rv64.elf
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64k6_DEBUG}/fw_dynamic.bin archived/images/opensbi/fw_dynamic-v1.3-rv64.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32k6_DEBUG}/fw_dynamic.bin archived/images/opensbi/fw_dynamic-v1.3-rv32.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32k6_DEBUG}/fw_dynamic.elf archived/images/opensbi/fw_dynamic-v1.3-rv32.elf
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
}
do_copy_optee(){
echo -e "\033[32m === copy optee image ==\033[0m"
set -x
mkdir -p archived/images/optee/kernel6.6-rv64-fpga/bringup
mkdir -p archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/bl1.bin archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/bl2.bin archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/bl31.bin archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/fip.bin archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/nt_fw_content.crt archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/nt_fw_key.crt archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/soc_fw_content.crt archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/soc_fw_key.crt archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/tb_fw.crt archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/tos_fw_content.crt archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/tos_fw_key.crt archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_BRINGUP_64k6_PATH}/trusted_key.crt archived/images/optee/kernel6.6-rv64-qemu/bringup
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
mkdir -p archived/images/optee/kernel6.6-rv64-qemu/tee-os
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_TEEOS_64k6_PATH}/tee-header_v2.bin archived/images/optee/kernel6.6-rv64-qemu/tee-os/bl32.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_TEEOS_64k6_PATH}/tee-pager_v2.bin archived/images/optee/kernel6.6-rv64-qemu/tee-os/bl32_extra1.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${OPENTEE_TEEOS_64k6_PATH}/tee-pageable_v2.bin archived/images/optee/kernel6.6-rv64-qemu/tee-os/bl32_extra2.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${ROOT_PATH}/../tmp-glibc/work/riscv64_k6.6ry_kcdebug_tcxt-oe-linux/optee-os-fpga/3.15-r0/build/out/riscv/core/tee-pager_v2.bin archived/images/optee/kernel6.6-rv64-fpga/bringup
cp ${ROOT_PATH}/../tmp-glibc/work/riscv64_k6.6ry_kcdebug_tcxt-oe-linux/trusted-firmware-a-fpga/2.3-r0/git/build/xiaohui/debug/bl31.bin archived/images/optee/kernel6.6-rv64-fpga/bringup
set +x
}
do_copy_kernel(){
echo -e "\033[32m === copy kernel6.6 image ==\033[0m"
set -x
mkdir -p archived/images/kernel
cp ${IMAGE_PATH_64k6_DEBUG}/Image archived/images/kernel/Image-6.6-rv64-kcdebug
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64k6_DEBUG}/vmlinux archived/images/kernel/vmlinux-6.6-rv64-kcdebug
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64k6_DEFAULT}/Image archived/images/kernel/Image-6.6-rv64-kcdefault
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64k6_DEFAULT}/vmlinux archived/images/kernel/vmlinux-6.6-rv64-kcdefault
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32k6_DEBUG}/Image archived/images/kernel/Image-6.6-rv32-kcdebug
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32k6_DEBUG}/vmlinux archived/images/kernel/vmlinux-6.6-rv32-kcdebug
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32k6_DEFAULT}/Image archived/images/kernel/Image-6.6-rv32-kcdefault
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32k6_DEFAULT}/vmlinux archived/images/kernel/vmlinux-6.6-rv32-kcdefault
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
}
do_copy_uboot (){
echo -e "\033[32m === copy u-boot image ==\033[0m"
set -x
mkdir -p archived/images/u-boot/
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64QEMU_UBOOT}/u-boot archived/images/u-boot/u-boot-qemu-rv64.elf
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64QEMU_UBOOT}/u-boot.bin archived/images/u-boot/u-boot-qemu-rv64.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64FPGA_UBOOT}/u-boot archived/images/u-boot/u-boot-fpga-rv64.elf
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64FPGA_UBOOT}/u-boot.bin archived/images/u-boot/u-boot-fpga-rv64.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32QEMU_UBOOT}/u-boot.bin archived/images/u-boot/u-boot-qemu-rv32.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32QEMU_UBOOT}/u-boot archived/images/u-boot/u-boot-qemu-rv32.elf
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32FPGA_UBOOT}/u-boot.bin archived/images/u-boot/u-boot-fpga-rv32.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32FPGA_UBOOT}/u-boot archived/images/u-boot/u-boot-fpga-rv32.elf
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
}
#cp k230 image
do_copy_k230(){
mkdir -p archived/k230
cp -r ${IMAGE_k230}/* archived/k230 && rm -rf archived/k230/post-image.sh
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
}
do_copy_uboot (){
echo -e "\033[32m === copy u-boot image ==\033[0m"
set -x
mkdir -p archived/images/u-boot/
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64QEMU_UBOOT}/u-boot archived/images/u-boot/u-boot-qemu-rv64.elf
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64QEMU_UBOOT}/u-boot.bin archived/images/u-boot/u-boot-qemu-rv64.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64FPGA_UBOOT}/u-boot archived/images/u-boot/u-boot-fpga-rv64.elf
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64FPGA_UBOOT}/u-boot.bin archived/images/u-boot/u-boot-fpga-rv64.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32QEMU_UBOOT}/u-boot.bin archived/images/u-boot/u-boot-qemu-rv32.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32QEMU_UBOOT}/u-boot archived/images/u-boot/u-boot-qemu-rv32.elf
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32FPGA_UBOOT}/u-boot.bin archived/images/u-boot/u-boot-fpga-rv32.bin
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32FPGA_UBOOT}/u-boot archived/images/u-boot/u-boot-fpga-rv32.elf
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
}
# copy rootfs,if more than one rootfs have been compiled, all of them will be copied
do_copy_rootfs(){
echo -e "\033[32m === copy rootfs,if more than one rootfs have been compiled, all of them will be copied ==\033[0m"
set -x
mkdir -p archived/images/rootfs
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64k6_DEBUG}/${IMAGE}-riscv64-k6.6ry-kcdebug-tcxt.ext4 archived/images/rootfs/rootfs.xuantie-image-rv64-6.6-lite.ext4
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_64k6_DEBUG}/${IMAGE}-riscv64-k6.6ry-kcdebug-tcxt.cpio.gz archived/images/rootfs/rootfs.xuantie-image-rv64-6.6-lite.cpio.gz
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32k6_DEBUG}/${IMAGE}-riscv32-k6.6ry-kcdebug-tcxt.ext4 archived/images/rootfs/rootfs.xuantie-image-rv32-6.6-lite.ext4
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ${IMAGE_PATH_32k6_DEBUG}/${IMAGE}-riscv32-k6.6ry-kcdebug-tcxt.cpio.gz archived/images/rootfs/rootfs.xuantie-image-rv32-6.6-lite.cpio.gz
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp -r ${ROOT_PATH}"/../../../meta-xuantie/recipes-bsp/hw-c9xx/files/fpga" archived/
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
#cp -r ${ROOT_PATH}"/../../../meta-xuantie/recipes-bsp/hw-c9xx/files/qemu" archived/
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
#cp -r ${ROOT_PATH}"/../../../meta-xuantie/recipes-bsp/hw-c9xx/files/qemu" archived/
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp -r ${ROOT_PATH}"/../../../riscv-toolchain/bin/riscv64-unknown-linux-gnu-gdb" archived/fpga/riscv64-linux-gdb
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
set +x
}
do_copy_zsb(){
echo -e "\033[32m === copy zsb, all of them will be copied ==\033[0m"
set -x
mkdir -p archived/images/zsb
cp ${IMAGE_PATH_64k6_DEBUG}/zero_stage_boot.bin archived/images/zsb/zero_stage_boot-rv64.bin
cp ${IMAGE_PATH_64k6_DEBUG}/zero_stage_boot.elf archived/images/zsb/zero_stage_boot-rv64.elf
cp ${IMAGE_PATH_32k6_DEBUG}/zero_stage_boot.bin archived/images/zsb/zero_stage_boot-rv32.bin
cp ${IMAGE_PATH_32k6_DEBUG}/zero_stage_boot.elf archived/images/zsb/zero_stage_boot-rv32.elf
}
# copy deb
do_copy_deb(){
cmd_args=$*
for item in $cmd_args; do
if [ "$item" = "no-deb" ]; then
echo "do_copy_deb() does not executed"
return 0
fi
done
echo -e "\033[32m === copy deb ==\033[0m"
set -x
cp -r ${DEB_PATH} ./
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
set +x
}
do_tarball(){
cmd_args=$*
version=$1
if [ -z "$version" ]; then
echo "请输入 version number"
return 1
fi
for item in $cmd_args; do
if [ "$item" = "no-tarball" ]; then
echo "do_tarball() does not executed"
return 0
fi
done
echo -e "\033[32m === build tarball for ${MACHINE} ==\033[0m"
set -x
mkdir -p tarball
rm -rf ./tmp/sdk_tarball
mkdir -p ./tmp/sdk_tarball/
cp -r archived ./tmp/sdk_tarball/
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cd ./tmp/sdk_tarball/ && tar -zcvf xuantie-linux-${version}_6.6.tar.gz archived && cd -
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
cp ./tmp/sdk_tarball/xuantie-linux-${version}_6.6.tar.gz ./tarball/
if [ $? -ne 0 ]; then
echo "failed"
exit -1
fi
rm -rf ./tmp
set +x
}
do_work(){
cmd_args=$*
echo -e "\033[32m === copy images, go through every MACHINE and copy target images ==\033[0m"
BUILD_INFO_FILE=`find ${ROOT_PATH}/../buildhistory/ -name build-id.txt`
echo "BUILD_INFO_FILE="${BUILD_INFO_FILE}
for file in ${BUILD_INFO_FILE}
do
info=`cat ${file} |head -n 1`
echo ${info}
MACHINE=`echo ${info} |cut -d \: -f 1`
#echo "MACHINE="${MACHINE}
IMAGE=`echo ${info} | cut -d \: -f 2 |cut -d ' ' -f 2`
echo "----------IMAGE="${IMAGE}
#IMAGE_PATH=${ROOT_PATH}"/../tmp-glibc/deploy/images/"${MACHINE}
#TARGET=`echo ${IMAGE##*-}`
#echo "TARGET="${TARGET}
#echo "create images/"${MACHINE}
#mkdir -p images/${MACHINE}
echo -e "\033[36m copy ${MACHINE} images\033[0m"
do_copy_opensbi
do_copy_rootfs
#do_copy_optee
do_copy_uboot
do_copy_kernel
do_copy_zsb
do_copy_k230
do_tarball $cmd_args
#break
done
do_copy_deb $cmd_args
}
finish(){
echo -e -e "\033[32m Done \033[0m"
}
# start from here
cmd_args=$*
print_help
do_work $cmd_args
finish
echo "All done, SUCCESS!"