-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_file.sh
executable file
·133 lines (97 loc) · 4.11 KB
/
create_file.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
#!/bin/bash
var=1.92
basedir=$(cd $(dirname $0); pwd)
cd $basedir
rm -rfv file
mkdir file
#######################################################################################################
# Windows
#######################################################################################################
wget --continue https://github.com/ch32-riscv-ug/MounRiver_Studio_Community_miror/releases/download/${var}-toolchain/MRS_Toolchain_Win_V${var}.zip
unzip MRS_Toolchain_Win_V${var}.zip
cd MRS_Toolchain_Win_V${var}/
# beforeinstall
mkdir beforeinstall-win-${var}
touch beforeinstall-win-${var}/dummy.txt
zip -r beforeinstall-win-${var}.zip beforeinstall-win-${var}
# OpenOCD
mv OpenOCD openocd-win-${var}
zip -r openocd-win-${var}.zip openocd-win-${var}
# gcc8
mv "RISC-V Embedded GCC" riscv-none-embed-gcc-8-win-${var}
zip -r riscv-none-embed-gcc-8-win-${var}.zip riscv-none-embed-gcc-8-win-${var}
# gcc12
mv "RISC-V Embedded GCC12" riscv-none-elf-gcc-12-win-${var}
zip -r riscv-none-elf-gcc-12-win-${var}.zip riscv-none-elf-gcc-12-win-${var}
mv *.zip ${basedir}/file
cd ${basedir}
#######################################################################################################
# Linux
#######################################################################################################
wget --continue https://github.com/ch32-riscv-ug/MounRiver_Studio_Community_miror/releases/download/${var}-toolchain/MRS_Toolchain_Linux_x64_V${var}.tar.xz
tar Jxvf MRS_Toolchain_Linux_x64_V${var}.tar.xz
cd MRS_Toolchain_Linux_x64_V${var}/
# beforeinstall
mv beforeinstall/start.sh beforeinstall/post_install.sh
mv beforeinstall beforeinstall-linux-${var}
zip -r beforeinstall-linux-${var}.zip beforeinstall-linux-${var}
# OpenOCD
mv OpenOCD openocd-linux-${var}
zip -r openocd-linux-${var}.zip openocd-linux-${var}
# gcc8
mv RISC-V_Embedded_GCC riscv-none-embed-gcc-8-linux-${var}
zip -r riscv-none-embed-gcc-8-linux-${var}.zip riscv-none-embed-gcc-8-linux-${var}
# gcc12
mv RISC-V_Embedded_GCC12 riscv-none-elf-gcc-12-linux-${var}
zip -r riscv-none-elf-gcc-12-linux-${var}.zip riscv-none-elf-gcc-12-linux-${var}
mv *.zip ${basedir}/file
cd ${basedir}
#######################################################################################################
# Mac
#######################################################################################################
wget --continue https://github.com/ch32-riscv-ug/MounRiver_Studio_Community_miror/releases/download/${var}-toolchain/MRS_Toolchain_Mac_V${var//\./}.zip
unzip MRS_Toolchain_Mac_V${var//\./}.zip -d MRS_Toolchain_Mac
cd MRS_Toolchain_Mac/
# beforeinstall
mkdir beforeinstall-mac-${var}
touch beforeinstall-mac-${var}/dummy.txt
zip -r beforeinstall-mac-${var}.zip beforeinstall-mac-${var}
mv *.zip ${basedir}/file
# OpenOCD
cd MRS_Toolchain_MAC_V*
cd openocd_arm64
mv openocd_arm64 openocd-mac-arm64-${var}
zip -r ../openocd-mac-arm64-${var}.zip openocd-mac-arm64-${var}
cd ..
cd openocd_x86_64
mv openocd_x86_64 openocd-mac-x86_64-${var}
zip -r ../openocd-mac-x86_64-${var}.zip openocd-mac-x86_64-${var}
cd ..
mv *.zip ${basedir}/file
cd ..
rm -rfv MRS_Toolchain_MAC_V*/
## MRS_Toolchain_MAC_V*.pkg
unar MRS_Toolchain_MAC_V*.pkg
cd MRS_Toolchain_MAC_V*/
cd MRS_Toolchain_MAC.pkg/
cat Payload | gunzip -dc |cpio -i
cd Users
cd Shared
cd MRS_Toolchain_MAC_V*/
# gcc8
cp ${basedir}/file/riscv-none-embed-gcc-8-linux* .
unzip riscv-none-embed-gcc-8-linux*.zip
unzip xpack-riscv-none-*-8*.zip
rm -rfv riscv-none-embed-gcc-8-linux*.zip
rm -rfv xpack-riscv-none-*-8*.zip
find ./riscv-none-*-8-*/riscv-none-*/lib/ -type f | grep -v -E 'libprintf' | xargs rm -rfv
find ./riscv-none-*-8-*/riscv-none-*/lib/ -type d -empty -delete
cp -rfvp ./riscv-none-*-8-*/riscv-none-*/lib/* xpack-riscv-none-embed-gcc*/riscv-none-*/lib/
mv xpack-riscv-none-embed-gcc-8*/ riscv-none-embed-gcc-8-mac-${var}
zip -r riscv-none-embed-gcc-8-mac-${var}.zip riscv-none-embed-gcc-8-mac-${var}/
# gcc12
mv xpack-riscv-none-elf-gcc-12*.zip riscv-none-elf-gcc-12-mac-${var}.zip
mv *.zip ${basedir}/file
cd ${basedir}
#######################################################################################################
rm -rfv MRS_Toolchain*