-
Notifications
You must be signed in to change notification settings - Fork 16
/
install_gcc.sh
51 lines (35 loc) · 1.38 KB
/
install_gcc.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
#!/bin/bash
RET_VALUE=$?
RED='\033[0;31m'
NC='\033[0m' # No Color
apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev libslirp-dev
if [ $RET_VALUE != 0 ]; then
echo "${RED}Instalation failed!${NC}"
exit 1
fi
mkdir -p /opt/riscv/gcc14-rp2350-no-zcmp
chown -R "$(whoami)" /opt/riscv/gcc14-rp2350-no-zcmp
git clone --depth 1 https://github.com/riscv/riscv-gnu-toolchain /home/riscv-gnu-toolchain
if [ $RET_VALUE != 0 ]; then
echo "${RED}Cloning RISC-V repo failed!${NC}"
exit 1
fi
cd /home/riscv-gnu-toolchain || exit
git clone --depth 1 https://github.com/gcc-mirror/gcc gcc-14 -b releases/gcc-14
if [ $RET_VALUE != 0 ]; then
echo "${RED}Cloning GCC repo failed!${NC}"
exit 1
fi
./configure --prefix=/opt/riscv/gcc14-rp2350-no-zcmp \
--with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb --with-abi=ilp32 \
--with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" \
--with-gcc-src=`pwd`/gcc-14
if [ $RET_VALUE != 0 ]; then
echo "${RED}Configure failed!${NC}"
exit 1
fi
make -j$(nproc)
cd /home || exit
rm -rf /home/riscv-gnu-toolchain