mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-02 17:55:19 +00:00
Merge pull request #977 from jordancarlin/sail-binary
Install Sail from binary (No more Opam!)
This commit is contained in:
commit
c78a1f3353
@ -55,10 +55,9 @@ if [ "$FAMILY" == rhel ]; then
|
|||||||
SPIKE_PACKAGES+=(dtc boost-regex boost-system)
|
SPIKE_PACKAGES+=(dtc boost-regex boost-system)
|
||||||
VERILATOR_PACKAGES+=(help2man perl clang ccache gperftools numactl mold)
|
VERILATOR_PACKAGES+=(help2man perl clang ccache gperftools numactl mold)
|
||||||
BUILDROOT_PACKAGES+=(ncurses-base ncurses ncurses-libs ncurses-devel gcc-gfortran cpio) # gcc-gfortran is only needed for compiling spec benchmarks on buildroot linux
|
BUILDROOT_PACKAGES+=(ncurses-base ncurses ncurses-libs ncurses-devel gcc-gfortran cpio) # gcc-gfortran is only needed for compiling spec benchmarks on buildroot linux
|
||||||
# Extra packages not availale in rhel8, nice for Verilator and needed for sail respectively
|
# Extra packages not availale in rhel8, nice for Verilator
|
||||||
if (( RHEL_VERSION >= 9 )); then
|
if (( RHEL_VERSION >= 9 )); then
|
||||||
VERILATOR_PACKAGES+=(perl-doc)
|
VERILATOR_PACKAGES+=(perl-doc)
|
||||||
SAIL_PACKAGES=(z3)
|
|
||||||
fi
|
fi
|
||||||
# A newer version of gcc is required for qemu
|
# A newer version of gcc is required for qemu
|
||||||
OTHER_PACKAGES=(gcc-toolset-13)
|
OTHER_PACKAGES=(gcc-toolset-13)
|
||||||
@ -80,7 +79,6 @@ elif [ "$FAMILY" == ubuntu ]; then
|
|||||||
QEMU_PACKAGES+=(libfdt-dev libpixman-1-dev)
|
QEMU_PACKAGES+=(libfdt-dev libpixman-1-dev)
|
||||||
SPIKE_PACKAGES+=(device-tree-compiler libboost-regex-dev libboost-system-dev)
|
SPIKE_PACKAGES+=(device-tree-compiler libboost-regex-dev libboost-system-dev)
|
||||||
VERILATOR_PACKAGES+=(help2man perl g++ clang ccache libunwind-dev libgoogle-perftools-dev numactl perl-doc libfl2 libfl-dev zlib1g)
|
VERILATOR_PACKAGES+=(help2man perl g++ clang ccache libunwind-dev libgoogle-perftools-dev numactl perl-doc libfl2 libfl-dev zlib1g)
|
||||||
SAIL_PACKAGES+=(opam z3)
|
|
||||||
BUILDROOT_PACKAGES+=(ncurses-base ncurses-bin libncurses-dev gfortran cpio) # gfortran is only needed for compiling spec benchmarks on buildroot linux
|
BUILDROOT_PACKAGES+=(ncurses-base ncurses-bin libncurses-dev gfortran cpio) # gfortran is only needed for compiling spec benchmarks on buildroot linux
|
||||||
VIVADO_PACKAGES+=(libncurses*) # Vivado hangs on the third stage of installation without this
|
VIVADO_PACKAGES+=(libncurses*) # Vivado hangs on the third stage of installation without this
|
||||||
fi
|
fi
|
||||||
@ -90,11 +88,11 @@ fi
|
|||||||
if [ "${1}" == "--check" ]; then
|
if [ "${1}" == "--check" ]; then
|
||||||
section_header "Checking Dependencies from Package Manager"
|
section_header "Checking Dependencies from Package Manager"
|
||||||
if [ "$FAMILY" == rhel ]; then
|
if [ "$FAMILY" == rhel ]; then
|
||||||
for pack in "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${SAIL_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}"; do
|
for pack in "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}"; do
|
||||||
rpm -q "$pack" > /dev/null || (echo -e "${FAIL_COLOR}Missing packages detected (${WARNING_COLOR}$pack${FAIL_COLOR}). Run as root to auto-install or run wally-package-install.sh first.${ENDC}" && exit 1)
|
rpm -q "$pack" > /dev/null || (echo -e "${FAIL_COLOR}Missing packages detected (${WARNING_COLOR}$pack${FAIL_COLOR}). Run as root to auto-install or run wally-package-install.sh first.${ENDC}" && exit 1)
|
||||||
done
|
done
|
||||||
elif [ "$FAMILY" == ubuntu ]; then
|
elif [ "$FAMILY" == ubuntu ]; then
|
||||||
for pack in "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${SAIL_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}"; do
|
for pack in "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}"; do
|
||||||
dpkg -l "$pack" | grep "ii" > /dev/null || (echo -e "${FAIL_COLOR}Missing packages detected (${WARNING_COLOR}$pack${FAIL_COLOR}). Run as root to auto-install or run wally-package-install.sh first." && exit 1)
|
dpkg -l "$pack" | grep "ii" > /dev/null || (echo -e "${FAIL_COLOR}Missing packages detected (${WARNING_COLOR}$pack${FAIL_COLOR}). Run as root to auto-install or run wally-package-install.sh first." && exit 1)
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -124,6 +122,6 @@ else
|
|||||||
# Update and Upgrade tools
|
# Update and Upgrade tools
|
||||||
eval "$UPDATE_COMMAND"
|
eval "$UPDATE_COMMAND"
|
||||||
# Install packages listed above using appropriate package manager
|
# Install packages listed above using appropriate package manager
|
||||||
sudo $PACKAGE_MANAGER install -y "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${SAIL_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}" "${VIVADO_PACKAGES[@]}"
|
sudo $PACKAGE_MANAGER install -y "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}" "${VIVADO_PACKAGES[@]}"
|
||||||
echo -e "${SUCCESS_COLOR}Packages successfully installed.${ENDC}"
|
echo -e "${SUCCESS_COLOR}Packages successfully installed.${ENDC}"
|
||||||
fi
|
fi
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
## Modified: 22 January 2023
|
## Modified: 22 January 2023
|
||||||
## Modified: 23 March 2023
|
## Modified: 23 March 2023
|
||||||
## Modified: 30 June 2024, Jordan Carlin jcarlin@hmc.edu
|
## Modified: 30 June 2024, Jordan Carlin jcarlin@hmc.edu
|
||||||
|
## Modified: 1 September 2024
|
||||||
##
|
##
|
||||||
## Purpose: Open source tool chain installation script
|
## Purpose: Open source tool chain installation script
|
||||||
##
|
##
|
||||||
@ -148,11 +149,6 @@ source "$RISCV"/riscv-python/bin/activate # activate python virtual environment
|
|||||||
STATUS="python packages"
|
STATUS="python packages"
|
||||||
pip install --upgrade pip && pip install -r "$dir"/requirements.txt
|
pip install --upgrade pip && pip install -r "$dir"/requirements.txt
|
||||||
|
|
||||||
# z3 is needed for sail and not availabe from dnf for rhel 8
|
|
||||||
if (( RHEL_VERSION == 8 )); then
|
|
||||||
pip install -U z3-solver
|
|
||||||
fi
|
|
||||||
|
|
||||||
source "$RISCV"/riscv-python/bin/activate # reload python virtual environment
|
source "$RISCV"/riscv-python/bin/activate # reload python virtual environment
|
||||||
echo -e "${SUCCESS_COLOR}Python environment successfully configured!${ENDC}"
|
echo -e "${SUCCESS_COLOR}Python environment successfully configured!${ENDC}"
|
||||||
|
|
||||||
@ -166,9 +162,7 @@ if (( RHEL_VERSION == 8 )) || (( UBUNTU_VERSION == 20 )); then
|
|||||||
section_header "Installing glib"
|
section_header "Installing glib"
|
||||||
pip install -U meson # Meson is needed to build glib
|
pip install -U meson # Meson is needed to build glib
|
||||||
cd "$RISCV"
|
cd "$RISCV"
|
||||||
wget https://download.gnome.org/sources/glib/2.70/glib-2.70.5.tar.xz
|
curl --location https://download.gnome.org/sources/glib/2.70/glib-2.70.5.tar.xz | tar xJ
|
||||||
tar -xJf glib-2.70.5.tar.xz
|
|
||||||
rm glib-2.70.5.tar.xz
|
|
||||||
cd glib-2.70.5
|
cd glib-2.70.5
|
||||||
meson setup _build --prefix="$RISCV"
|
meson setup _build --prefix="$RISCV"
|
||||||
meson compile -C _build
|
meson compile -C _build
|
||||||
@ -185,9 +179,7 @@ if (( RHEL_VERSION == 8 )); then
|
|||||||
if [ ! -e "$RISCV"/include/gmp.h ]; then
|
if [ ! -e "$RISCV"/include/gmp.h ]; then
|
||||||
section_header "Installing gmp"
|
section_header "Installing gmp"
|
||||||
cd "$RISCV"
|
cd "$RISCV"
|
||||||
wget https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz
|
curl --location https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz | tar xJ
|
||||||
tar -xJf gmp-6.3.0.tar.xz
|
|
||||||
rm gmp-6.3.0.tar.xz
|
|
||||||
cd gmp-6.3.0
|
cd gmp-6.3.0
|
||||||
./configure --prefix="$RISCV"
|
./configure --prefix="$RISCV"
|
||||||
make -j "${NUM_THREADS}"
|
make -j "${NUM_THREADS}"
|
||||||
@ -322,40 +314,20 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Install opam from binary disribution on rhel as it is not available from dnf
|
|
||||||
# Opam is needed to install the sail compiler
|
|
||||||
if [ "$FAMILY" == rhel ]; then
|
|
||||||
section_header "Installing/Updating Opam"
|
|
||||||
STATUS="Opam"
|
|
||||||
export OPAMROOTISOK=1 # Silence warnings about running opam as root
|
|
||||||
cd "$RISCV"
|
|
||||||
mkdir -p opam
|
|
||||||
cd opam
|
|
||||||
wget https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh
|
|
||||||
printf '%s\n' "$RISCV"/bin Y | sh install.sh # the print command provides $RISCV/bin as the installation path when prompted
|
|
||||||
cd "$RISCV"
|
|
||||||
rm -rf opam
|
|
||||||
echo -e "${SUCCESS_COLOR}Opam successfully installed/updated!${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Sail Compiler (https://github.com/rems-project/sail)
|
# Sail Compiler (https://github.com/rems-project/sail)
|
||||||
# Sail is a formal specification language designed for describing the semantics of an ISA.
|
# Sail is a formal specification language designed for describing the semantics of an ISA.
|
||||||
# It is used to generate the RISC-V Sail Model, which is the golden reference model for RISC-V.
|
# It is used to generate the RISC-V Sail Model, which is the golden reference model for RISC-V.
|
||||||
# The Sail Compiler is written in OCaml, which is an object-oriented extension of ML, which in turn
|
# The Sail Compiler is written in OCaml, which is an object-oriented extension of ML, which in turn
|
||||||
# is a functional programming language suited to formal verification. The Sail compiler is installed
|
# is a functional programming language suited to formal verification.
|
||||||
# with the opam OCaml package manager. It has so many dependencies that it can be difficult to install,
|
|
||||||
# but a binary release of it should be available soon, removing the need to use opam.
|
|
||||||
section_header "Installing/Updating Sail Compiler"
|
section_header "Installing/Updating Sail Compiler"
|
||||||
STATUS="Sail Compiler"
|
STATUS="Sail Compiler"
|
||||||
export OPAMROOTISOK=1 # Silence warnings about running opam as root
|
if [ ! -e "$RISCV"/bin/sail ]; then
|
||||||
export OPAMROOT="$RISCV"/opam
|
cd "$RISCV"
|
||||||
cd "$RISCV"
|
curl --location https://github.com/rems-project/sail/releases/latest/download/sail.tar.gz | tar xvz --directory="$RISCV" --strip-components=1
|
||||||
opam init -y --disable-sandboxing --no-setup --compiler=5.1.0
|
echo -e "${SUCCESS_COLOR}Sail Compiler successfully installed/updated!${ENDC}"
|
||||||
eval "$(opam config env)"
|
else
|
||||||
opam update -y
|
echo -e "${SUCCESS_COLOR}Sail Compiler already installed.${ENDC}"
|
||||||
opam upgrade -y
|
fi
|
||||||
opam install sail -y
|
|
||||||
echo -e "${SUCCESS_COLOR}Sail Compiler successfully installed/updated!${ENDC}"
|
|
||||||
|
|
||||||
# RISC-V Sail Model (https://github.com/riscv/sail-riscv)
|
# RISC-V Sail Model (https://github.com/riscv/sail-riscv)
|
||||||
# The RISC-V Sail Model is the golden reference model for RISC-V. It is written in Sail (described above)
|
# The RISC-V Sail Model is the golden reference model for RISC-V. It is written in Sail (described above)
|
||||||
@ -364,7 +336,6 @@ STATUS="RISC-V Sail Model"
|
|||||||
if git_check "sail-riscv" "https://github.com/riscv/sail-riscv.git" "$RISCV/bin/riscv_sim_RV32"; then
|
if git_check "sail-riscv" "https://github.com/riscv/sail-riscv.git" "$RISCV/bin/riscv_sim_RV32"; then
|
||||||
cd sail-riscv
|
cd sail-riscv
|
||||||
git reset --hard && git clean -f && git checkout master && git pull
|
git reset --hard && git clean -f && git checkout master && git pull
|
||||||
export OPAMCLI=2.0 # Sail is not compatible with opam 2.1 as of 4/16/24
|
|
||||||
ARCH=RV64 make -j "${NUM_THREADS}" c_emulator/riscv_sim_RV64 2>&1 | logger sailModel; [ "${PIPESTATUS[0]}" == 0 ]
|
ARCH=RV64 make -j "${NUM_THREADS}" c_emulator/riscv_sim_RV64 2>&1 | logger sailModel; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
ARCH=RV32 make -j "${NUM_THREADS}" c_emulator/riscv_sim_RV32 2>&1 | logger sailModel; [ "${PIPESTATUS[0]}" == 0 ]
|
ARCH=RV32 make -j "${NUM_THREADS}" c_emulator/riscv_sim_RV32 2>&1 | logger sailModel; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
cp -f c_emulator/riscv_sim_RV64 "$RISCV"/bin/riscv_sim_RV64
|
cp -f c_emulator/riscv_sim_RV64 "$RISCV"/bin/riscv_sim_RV64
|
||||||
@ -372,7 +343,6 @@ if git_check "sail-riscv" "https://github.com/riscv/sail-riscv.git" "$RISCV/bin/
|
|||||||
if [ "$clean" ]; then
|
if [ "$clean" ]; then
|
||||||
cd "$RISCV"
|
cd "$RISCV"
|
||||||
rm -rf sail-riscv
|
rm -rf sail-riscv
|
||||||
rm -rf opam
|
|
||||||
fi
|
fi
|
||||||
echo -e "${SUCCESS_COLOR}RISC-V Sail Model successfully installed/updated!${ENDC}"
|
echo -e "${SUCCESS_COLOR}RISC-V Sail Model successfully installed/updated!${ENDC}"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user