-
Notifications
You must be signed in to change notification settings - Fork 1
/
fast-setup.sh
executable file
·44 lines (36 loc) · 1.19 KB
/
fast-setup.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
#!/bin/bash
set -e
echo "Starting..."
if ( $(command -v riscv64-unknown-linux-gnu-gcc > /dev/null) &&
$(command -v riscv64-unknown-elf-gcc > /dev/null) )
then
echo "RISCV tools are already installed"
else
echo "Downloading Prebuilt RISC-V Toolchain... "
# The 1.0 version expected libmpfr.so.4, modern Ubuntu has .6
TOOL_VER=1.0
if [[ $(ldconfig -p | grep "libmpfr.so.6") ]]; then
echo "Downloading tools v2.0 (support for libmpfr.so.6)"
TOOL_VER=2.0
fi
export RISCV=$(pwd)/riscv
export PATH=$PATH:$RISCV/bin
if [ ! -r ${TOOL_VER}.tar.gz ]; then
wget https://keystone-enclave.eecs.berkeley.edu/files/${TOOL_VER}.tar.gz
# Check tool integrity
echo "Verifying prebuilt toolchain integrity..."
sha256sum -c .prebuilt_tools_shasums --status --ignore-missing
if [[ $? != 0 ]]
then
echo "Toolchain binary download incomplete or corrupted. You can build the toolchain locally or try again."
exit 1
fi
fi
tar -xzvf ${TOOL_VER}.tar.gz
cd firesim-riscv-tools-prebuilt-${TOOL_VER}
./installrelease.sh > riscv-tools-install.log
mv distrib riscv
cp -R riscv ../
cd ..
echo "Toolchain has been installed in $RISCV"
fi