mirror of
https://github.com/openhwgroup/cvw.git
synced 2025-06-27 08:50:26 -04:00
Split installation script into individual files for each tool
This commit is contained in:
parent
19a26cfbd0
commit
ded3b251b3
16 changed files with 935 additions and 451 deletions
|
@ -118,16 +118,16 @@ If a user-level installation is desired, the script can instead be run by any us
|
||||||
$ sudo $WALLY/bin/wally-package-install.sh
|
$ sudo $WALLY/bin/wally-package-install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
In either case, the installation directory can be overridden by passing the desired directory as the last argument to the installation script. For example,
|
In either case, the installation directory can be overridden by passing the desired directory as an argument to the installation script. For example,
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo $WALLY/bin/wally-tool-chain-install.sh /home/riscv
|
$ sudo $WALLY/bin/wally-tool-chain-install.sh /home/riscv
|
||||||
```
|
```
|
||||||
|
|
||||||
See `wally-tool-chain-install.sh` for a detailed description of each component, or to issue the commands one at a time to install on the command line.
|
See `wally-tool-chain-install.sh` and the scripts in the `$WALLY/bin/installation` directory for a detailed description of each component, or to issue the commands one at a time to install on the command line.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The complete installation process requires ~55 GB of free space. If the `--clean` flag is passed to the installation script then the final consumed space is only ~26 GB, but upgrading the tools will reinstall everything from scratch.
|
> The complete installation process requires ~55 GB of free space. If the `--clean` flag is passed to the installation script then the final consumed space is only ~26 GB. The `--clean` flag removes source files and build directories.
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
`$WALLY/setup.sh` sources `$RISCV/site-setup.sh`. If the toolchain was installed in either of the default locations (`/opt/riscv` or `~/riscv`), `$RISCV` will automatically be set to the correct path when `setup.sh` is run. If a custom installation directory was used, then `$WALLY/setup.sh` must be modified to set the correct path.
|
`$WALLY/setup.sh` sources `$RISCV/site-setup.sh`. If the toolchain was installed in either of the default locations (`/opt/riscv` or `~/riscv`), `$RISCV` will automatically be set to the correct path when `setup.sh` is run. If a custom installation directory was used, then `$WALLY/setup.sh` must be modified to set the correct path.
|
||||||
|
|
71
bin/installation/activate-tools.sh
Executable file
71
bin/installation/activate-tools.sh
Executable file
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: Activate gcc and python virtual environment
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable newer version of gcc for older distros (required for QEMU/Verilator)
|
||||||
|
if [ "$FAMILY" == rhel ]; then
|
||||||
|
if [ -e /opt/rh/gcc-toolset-13/enable ]; then
|
||||||
|
source /opt/rh/gcc-toolset-13/enable
|
||||||
|
else
|
||||||
|
echo -e "${FAIL_COLOR}GCC toolset 13 not found. Please install it with wally-package-install.sh.${ENDC}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
elif [ "$FAMILY" == suse ]; then
|
||||||
|
if [ ! -e "$RISCV"/gcc-13/bin/gcc ]; then
|
||||||
|
mkdir -p "$RISCV"/gcc-13/bin
|
||||||
|
for f in gcc cpp g++ gcc-ar gcc-nm gcc-ranlib gcov gcov-dump gcov-tool lto-dump; do
|
||||||
|
ln -vsf /usr/bin/$f-13 "$RISCV"/gcc-13/bin/$f
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
export PATH="$RISCV"/gcc-13/bin:$PATH
|
||||||
|
elif (( UBUNTU_VERSION == 20 )); then
|
||||||
|
if [ ! -e "$RISCV"/gcc-10/bin/gcc ]; then
|
||||||
|
mkdir -p "$RISCV"/gcc-10/bin
|
||||||
|
for f in gcc cpp g++ gcc-ar gcc-nm gcc-ranlib gcov gcov-dump gcov-tool lto-dump; do
|
||||||
|
ln -vsf /usr/bin/$f-10 "$RISCV"/gcc-10/bin/$f
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
export PATH="$RISCV"/gcc-10/bin:$PATH
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Activate python virtual environment
|
||||||
|
# Activate riscv-python Virtual Environment
|
||||||
|
if [ -e "$RISCV"/riscv-python/bin/activate ]; then
|
||||||
|
source "$RISCV"/riscv-python/bin/activate
|
||||||
|
else
|
||||||
|
echo -e "${FAIL_COLOR}Python virtual environment not found. Run wally-toolchain-install.sh or python-setup.sh to automatically create it.${ENDC}"
|
||||||
|
return 1
|
||||||
|
fi
|
62
bin/installation/buildroot-install.sh
Executable file
62
bin/installation/buildroot-install.sh
Executable file
|
@ -0,0 +1,62 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: Buildroot and Linux testvector installation script
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Buildroot and Linux testvectors
|
||||||
|
# Buildroot is used to boot a minimal version of Linux on Wally.
|
||||||
|
# Testvectors are generated using QEMU.
|
||||||
|
if [ ! "$no_buidroot" ]; then
|
||||||
|
section_header "Installing Buildroot and Creating Linux testvectors"
|
||||||
|
STATUS="buildroot"
|
||||||
|
if [ -z "$LD_LIBRARY_PATH" ]; then
|
||||||
|
export LD_LIBRARY_PATH=$RISCV/lib:$RISCV/lib64:$RISCV/riscv64-unknown-elf/lib:$RISCV/lib/x86_64-linux-gnu/
|
||||||
|
else
|
||||||
|
export LD_LIBRARY_PATH=$RISCV/lib:$RISCV/lib64:$LD_LIBRARY_PATH:$RISCV/riscv64-unknown-elf/lib:$RISCV/lib/x86_64-linux-gnu/
|
||||||
|
fi
|
||||||
|
cd "$WALLY"/linux
|
||||||
|
if [ ! -e "$RISCV"/buildroot ]; then
|
||||||
|
FORCE_UNSAFE_CONFIGURE=1 make 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ] # FORCE_UNSAFE_CONFIGURE is needed to allow buildroot to compile when run as root
|
||||||
|
echo -e "${SUCCESS_COLOR}Buildroot successfully installed and Linux testvectors created!${ENDC}"
|
||||||
|
elif [ ! -e "$RISCV"/linux-testvectors ]; then
|
||||||
|
echo -e "${OK_COLOR}Buildroot already exists, but Linux testvectors are missing. Generating them now.${ENDC}"
|
||||||
|
make dumptvs 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
echo -e "${SUCCESS_COLOR}Linux testvectors successfully generated!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${OK_COLOR}Buildroot and Linux testvectors already exist.${ENDC}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${OK_COLOR}Skipping Buildroot and Linux testvectors.${ENDC}"
|
||||||
|
fi
|
62
bin/installation/elf2hex-install.sh
Executable file
62
bin/installation/elf2hex-install.sh
Executable file
|
@ -0,0 +1,62 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: elf2hex installation script
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# elf2hex (https://github.com/sifive/elf2hex)
|
||||||
|
# The elf2hex utility to converts executable files into hexadecimal files for Verilog simulation.
|
||||||
|
# Note: The exe2hex utility that comes with Spike doesn’t work for our purposes because it doesn’t
|
||||||
|
# handle programs that start at 0x80000000. The SiFive version above is touchy to install.
|
||||||
|
# For example, if Python version 2.x is in your path, it won’t install correctly.
|
||||||
|
# Also, be sure riscv64-unknown-elf-objcopy shows up in your path in $RISCV/riscv-gnu-toolchain/bin
|
||||||
|
# at the time of compilation, or elf2hex won’t work properly.
|
||||||
|
section_header "Installing/Updating elf2hex"
|
||||||
|
STATUS="elf2hex"
|
||||||
|
cd "$RISCV"
|
||||||
|
if git_check "elf2hex" "https://github.com/sifive/elf2hex.git" "$RISCV/bin/riscv64-unknown-elf-elf2bin"; then
|
||||||
|
cd "$RISCV"/elf2hex
|
||||||
|
git reset --hard && git clean -f && git checkout master && git pull
|
||||||
|
autoreconf -i
|
||||||
|
./configure --target=riscv64-unknown-elf --prefix="$RISCV"
|
||||||
|
make 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
make install 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
if [ "$clean" ]; then
|
||||||
|
cd "$RISCV"
|
||||||
|
rm -rf elf2hex
|
||||||
|
fi
|
||||||
|
echo -e "${SUCCESS_COLOR}elf2hex successfully installed/updated!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${SUCCESS_COLOR}elf2hex already up to date.${ENDC}"
|
||||||
|
fi
|
57
bin/installation/glib-installation.sh
Executable file
57
bin/installation/glib-installation.sh
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: glib installation script
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Newer version of glib required for QEMU.
|
||||||
|
# Anything newer than this won't build on red hat 8
|
||||||
|
STATUS="glib"
|
||||||
|
if [ ! -e "$RISCV"/include/glib-2.0 ]; then
|
||||||
|
section_header "Installing glib"
|
||||||
|
pip install -U meson # Meson is needed to build glib
|
||||||
|
cd "$RISCV"
|
||||||
|
wget -nv --retry-connrefused $retry_on_host_error https://download.gnome.org/sources/glib/2.70/glib-2.70.5.tar.xz
|
||||||
|
tar -xJf glib-2.70.5.tar.xz
|
||||||
|
rm -f glib-2.70.5.tar.xz
|
||||||
|
cd glib-2.70.5
|
||||||
|
meson setup _build --prefix="$RISCV"
|
||||||
|
meson compile -C _build -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
meson install -C _build 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
cd "$RISCV"
|
||||||
|
rm -rf glib-2.70.5
|
||||||
|
echo -e "${SUCCESS_COLOR}glib successfully installed!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${OK_COLOR}glib already installed.${ENDC}"
|
||||||
|
fi
|
57
bin/installation/python-setup.sh
Executable file
57
bin/installation/python-setup.sh
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: WALLY python virtual environment setup script
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create python virtual environment so the python command targets desired version of python
|
||||||
|
# and installed packages are isolated from the rest of the system.
|
||||||
|
section_header "Setting up Python Environment"
|
||||||
|
STATUS="python_virtual_environment"
|
||||||
|
cd "$RISCV"
|
||||||
|
if [ ! -e "$RISCV"/riscv-python/bin/activate ]; then
|
||||||
|
"$PYTHON_VERSION" -m venv riscv-python --prompt cvw
|
||||||
|
echo -e "${OK_COLOR}Python virtual environment created!\nInstalling pip packages.${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${OK_COLOR}Python virtual environment already exists.\nUpdating pip packages.${ENDC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$RISCV"/riscv-python/bin/activate # activate python virtual environment
|
||||||
|
|
||||||
|
# Install python packages, including RISCOF (https://github.com/riscv-software-src/riscof.git)
|
||||||
|
# RISCOF is a RISC-V compliance test framework that is used to run the RISC-V Arch Tests.
|
||||||
|
STATUS="python packages"
|
||||||
|
pip install --upgrade pip && pip install --upgrade -r "$dir"/requirements.txt
|
||||||
|
|
||||||
|
echo -e "${SUCCESS_COLOR}Python environment successfully configured!${ENDC}"
|
56
bin/installation/qemu-install.sh
Executable file
56
bin/installation/qemu-install.sh
Executable file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: QEMU installation script
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# QEMU (https://www.qemu.org/docs/master/system/target-riscv.html)
|
||||||
|
# QEMU is an open source machine emulator and virtualizer capable of emulating RISC-V
|
||||||
|
section_header "Installing/Updating QEMU"
|
||||||
|
STATUS="qemu"
|
||||||
|
cd "$RISCV"
|
||||||
|
if git_check "qemu" "https://github.com/qemu/qemu" "$RISCV/include/qemu-plugin.h"; then
|
||||||
|
cd "$RISCV"/qemu
|
||||||
|
git reset --hard && git clean -f && git checkout master && git pull
|
||||||
|
./configure --target-list=riscv64-softmmu --prefix="$RISCV"
|
||||||
|
make -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
make install 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
if [ "$clean" ]; then
|
||||||
|
cd "$RISCV"
|
||||||
|
rm -rf qemu
|
||||||
|
fi
|
||||||
|
echo -e "${SUCCESS_COLOR}QEMU successfully installed/updated!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${SUCCESS_COLOR}QEMU already up to date.${ENDC}"
|
||||||
|
fi
|
59
bin/installation/riscv-gnu-toolchain-install.sh
Executable file
59
bin/installation/riscv-gnu-toolchain-install.sh
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: QEMU installation script
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# RISC-V GNU Toolchain (https://github.com/riscv-collab/riscv-gnu-toolchain)
|
||||||
|
# The RISC-V GNU Toolchain includes the GNU Compiler Collection (gcc), GNU Binutils, Newlib,
|
||||||
|
# and the GNU Debugger Project (gdb). It is a collection of tools used to compile RISC-V programs.
|
||||||
|
# To install GCC from source can take hours to compile.
|
||||||
|
# This configuration enables multilib to target many flavors of RISC-V.
|
||||||
|
# This book is tested with GCC 13.2.0 and 14.2.0.
|
||||||
|
section_header "Installing/Updating RISC-V GNU Toolchain"
|
||||||
|
STATUS="riscv-gnu-toolchain"
|
||||||
|
cd "$RISCV"
|
||||||
|
if git_check "riscv-gnu-toolchain" "https://github.com/riscv/riscv-gnu-toolchain" "$RISCV/riscv-gnu-toolchain/stamps/build-gcc-newlib-stage2"; then
|
||||||
|
cd "$RISCV"/riscv-gnu-toolchain
|
||||||
|
git reset --hard && git clean -f && git checkout master && git pull && git submodule update
|
||||||
|
./configure --prefix="${RISCV}" --with-multilib-generator="rv32e-ilp32e--;rv32i-ilp32--;rv32im-ilp32--;rv32iac-ilp32--;rv32imac-ilp32--;rv32imafc-ilp32f--;rv32imafdc-ilp32d--;rv64i-lp64--;rv64ic-lp64--;rv64iac-lp64--;rv64imac-lp64--;rv64imafdc-lp64d--;rv64im-lp64--;"
|
||||||
|
make -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
if [ "$clean" ]; then
|
||||||
|
cd "$RISCV"
|
||||||
|
rm -rf riscv-gnu-toolchain
|
||||||
|
fi
|
||||||
|
echo -e "${SUCCESS_COLOR}RISC-V GNU Toolchain successfully installed/updated!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${SUCCESS_COLOR}RISC-V GNU Toolchain already up to date.${ENDC}"
|
||||||
|
fi
|
90
bin/installation/sail-install.sh
Executable file
90
bin/installation/sail-install.sh
Executable file
|
@ -0,0 +1,90 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: QEMU installation script
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sail Compiler (https://github.com/rems-project/sail)
|
||||||
|
# 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.
|
||||||
|
# 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.
|
||||||
|
section_header "Installing/Updating Sail Compiler"
|
||||||
|
STATUS="sail_compiler"
|
||||||
|
cd "$RISCV"
|
||||||
|
wget -nv --retry-connrefused $retry_on_host_error --output-document=sail.tar.gz https://github.com/rems-project/sail/releases/latest/download/sail.tar.gz
|
||||||
|
tar xz --directory="$RISCV" --strip-components=1 -f sail.tar.gz
|
||||||
|
rm -f sail.tar.gz
|
||||||
|
echo -e "${SUCCESS_COLOR}Sail Compiler successfully installed/updated!${ENDC}"
|
||||||
|
|
||||||
|
# Newer version of CMake needed to build sail-riscv model (at least 3.20)
|
||||||
|
if (( UBUNTU_VERSION == 20 || DEBIAN_VERSION == 11 )); then
|
||||||
|
STATUS="cmake"
|
||||||
|
if [ ! -e "$RISCV"/bin/cmake ]; then
|
||||||
|
section_header "Installing cmake"
|
||||||
|
cd "$RISCV"
|
||||||
|
wget -nv --retry-connrefused $retry_on_host_error --output-document=cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.31.5/cmake-3.31.5-linux-x86_64.tar.gz
|
||||||
|
tar xz --directory="$RISCV" --strip-components=1 -f cmake.tar.gz
|
||||||
|
rm -f cmake.tar.gz
|
||||||
|
echo -e "${SUCCESS_COLOR}CMake successfully installed/updated!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${SUCCESS_COLOR}CMake already installed.${ENDC}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Newer version of gmp needed for sail-riscv model on RHEL 8
|
||||||
|
if (( RHEL_VERSION == 8 )); then
|
||||||
|
DOWNLOAD_GMP=TRUE
|
||||||
|
else
|
||||||
|
DOWNLOAD_GMP=FALSE
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
section_header "Installing/Updating RISC-V Sail Model"
|
||||||
|
STATUS="riscv-sail-model"
|
||||||
|
if git_check "sail-riscv" "https://github.com/riscv/sail-riscv.git" "$RISCV/bin/riscv_sim_rv32d"; then
|
||||||
|
cd "$RISCV"/sail-riscv
|
||||||
|
git reset --hard && git clean -f && git checkout master && git pull
|
||||||
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="$RISCV" -DDOWNLOAD_GMP="$DOWNLOAD_GMP" -GNinja 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
cmake --build build 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
cmake --install build 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
if [ "$clean" ]; then
|
||||||
|
cd "$RISCV"
|
||||||
|
rm -rf sail-riscv
|
||||||
|
fi
|
||||||
|
echo -e "${SUCCESS_COLOR}RISC-V Sail Model successfully installed/updated!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${SUCCESS_COLOR}RISC-V Sail Model already up to date.${ENDC}"
|
||||||
|
fi
|
50
bin/installation/skywater-lib-install.sh
Executable file
50
bin/installation/skywater-lib-install.sh
Executable file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: QEMU installation script
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OSU Skywater 130 cell library (https://foss-eda-tools.googlesource.com/skywater-pdk/libs/sky130_osu_sc_t12)
|
||||||
|
# The OSU Skywater 130 cell library is a standard cell library that is used to synthesize Wally.
|
||||||
|
section_header "Installing/Updating OSU Skywater 130 cell library"
|
||||||
|
STATUS="osu_skywater_130_cell_library"
|
||||||
|
mkdir -p "$RISCV"/cad/lib
|
||||||
|
cd "$RISCV"/cad/lib
|
||||||
|
if git_check "sky130_osu_sc_t12" "https://foss-eda-tools.googlesource.com/skywater-pdk/libs/sky130_osu_sc_t12" "$RISCV/cad/lib/sky130_osu_sc_t12" "main"; then
|
||||||
|
cd "$RISCV"/sky130_osu_sc_t12
|
||||||
|
git reset --hard && git clean -f && git checkout main && git pull
|
||||||
|
echo -e "${SUCCESS_COLOR}OSU Skywater library successfully installed!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${SUCCESS_COLOR}OSU Skywater library already up to date.${ENDC}"
|
||||||
|
fi
|
58
bin/installation/spike-install.sh
Executable file
58
bin/installation/spike-install.sh
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: Spike installation script
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Spike (https://github.com/riscv-software-src/riscv-isa-sim)
|
||||||
|
# Spike is a reference model for RISC-V. It is a functional simulator that can be used to run RISC-V programs.
|
||||||
|
section_header "Installing/Updating SPIKE"
|
||||||
|
STATUS="spike"
|
||||||
|
cd "$RISCV"
|
||||||
|
if git_check "riscv-isa-sim" "https://github.com/riscv-software-src/riscv-isa-sim" "$RISCV/lib/pkgconfig/riscv-riscv.pc"; then
|
||||||
|
cd "$RISCV"/riscv-isa-sim
|
||||||
|
git reset --hard && git clean -f && git checkout master && git pull
|
||||||
|
mkdir -p build
|
||||||
|
cd build
|
||||||
|
../configure --prefix="$RISCV"
|
||||||
|
make -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
make install 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
if [ "$clean" ]; then
|
||||||
|
cd "$RISCV"
|
||||||
|
rm -rf riscv-isa-sim
|
||||||
|
fi
|
||||||
|
echo -e "${SUCCESS_COLOR}Spike successfully installed/updated!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${SUCCESS_COLOR}Spike already up to date.${ENDC}"
|
||||||
|
fi
|
82
bin/installation/verilator-install.sh
Executable file
82
bin/installation/verilator-install.sh
Executable file
|
@ -0,0 +1,82 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Tool chain install script.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: Verilator installation script
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
|
if [ -z "$FAMILY" ]; then
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WALLY="$(dirname $(dirname "$dir"))"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/../wally-environment-check.sh "--no-args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Mold needed for Verilator, not available in all package managers.
|
||||||
|
if (( UBUNTU_VERSION == 20 || DEBIAN_VERSION == 11 )) || [ "$FAMILY" == suse ]; then
|
||||||
|
STATUS="mold"
|
||||||
|
if [ ! -e "$RISCV"/bin/mold ]; then
|
||||||
|
section_header "Installing mold"
|
||||||
|
cd "$RISCV"
|
||||||
|
wget -nv --retry-connrefused $retry_on_host_error --output-document=mold.tar.gz https://github.com/rui314/mold/releases/download/v2.34.1/mold-2.34.1-x86_64-linux.tar.gz
|
||||||
|
tar xz --directory="$RISCV" --strip-components=1 -f mold.tar.gz
|
||||||
|
rm -f mold.tar.gz
|
||||||
|
echo -e "${SUCCESS_COLOR}Mold successfully installed/updated!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${SUCCESS_COLOR}Mold already installed.${ENDC}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verilator (https://github.com/verilator/verilator)
|
||||||
|
# Verilator is a fast open-source Verilog simulator that compiles synthesizable Verilog code into C++ code.
|
||||||
|
# It is used for linting and simulation of Wally.
|
||||||
|
# Verilator needs to be built from source to get the latest version (Wally needs 5.021 or later).
|
||||||
|
section_header "Installing/Updating Verilator"
|
||||||
|
STATUS="verilator"
|
||||||
|
if [ "$UBUNTU_VERSION" == 20 ] || [ "$DEBIAN_VERSION" == 11 ]; then
|
||||||
|
# On Ubuntu 20 and Debian 11, the last version of Verilator that build successfully is 5.036.
|
||||||
|
export VERILATOR_VERSION="5.036"
|
||||||
|
else
|
||||||
|
export VERILATOR_VERSION="master"
|
||||||
|
fi
|
||||||
|
cd "$RISCV"
|
||||||
|
if git_check "verilator" "https://github.com/verilator/verilator" "$RISCV/share/pkgconfig/verilator.pc"; then
|
||||||
|
unset VERILATOR_ROOT
|
||||||
|
cd "$RISCV"/verilator
|
||||||
|
git reset --hard && git clean -f && git checkout "$VERILATOR_VERSION" && (git pull || true)
|
||||||
|
autoconf
|
||||||
|
./configure --prefix="$RISCV"
|
||||||
|
make -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
make install 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
if [ "$clean" ]; then
|
||||||
|
cd "$RISCV"
|
||||||
|
rm -rf verilator
|
||||||
|
fi
|
||||||
|
echo -e "${SUCCESS_COLOR}Verilator successfully installed/updated!${ENDC}"
|
||||||
|
else
|
||||||
|
echo -e "${SUCCESS_COLOR}Verilator already up to date.${ENDC}"
|
||||||
|
fi
|
||||||
|
|
106
bin/installation/wally-installation-helper-functions.sh
Executable file
106
bin/installation/wally-installation-helper-functions.sh
Executable file
|
@ -0,0 +1,106 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###########################################
|
||||||
|
## Installation helper functions.
|
||||||
|
##
|
||||||
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
|
## Created: May 30 2025
|
||||||
|
## Modified:
|
||||||
|
##
|
||||||
|
## Purpose: Common functions for toolchain installation scripts
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
## https://github.com/openhwgroup/cvw
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
## Helper functions
|
||||||
|
# Error handler
|
||||||
|
error() {
|
||||||
|
echo -e "${FAIL_COLOR}Error: $STATUS installation failed"
|
||||||
|
echo -e "Error on line ${BASH_LINENO[0]} with command $BASH_COMMAND${ENDC}"
|
||||||
|
if [ -e "$RISCV/logs/$STATUS.log" ]; then
|
||||||
|
echo -e "Please check the log in $RISCV/logs/$STATUS.log for more information."
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if a git repository exists, is up to date, and has been installed
|
||||||
|
# clones the repository if it doesn't exist
|
||||||
|
# $1: repo name
|
||||||
|
# $2: repo url to clone from
|
||||||
|
# $3: file to check if already installed
|
||||||
|
# $4: upstream branch, optional, default is master
|
||||||
|
git_check() {
|
||||||
|
local repo=$1
|
||||||
|
local url=$2
|
||||||
|
local check=$3
|
||||||
|
local branch="${4:-master}"
|
||||||
|
|
||||||
|
# Clone repo if it doesn't exist
|
||||||
|
if [[ ! -e $repo ]]; then
|
||||||
|
for ((i=1; i<=5; i++)); do
|
||||||
|
git clone "$url" && break
|
||||||
|
echo -e "${WARNING_COLOR}Failed to clone $repo. Retrying.${ENDC}"
|
||||||
|
rm -rf "$repo"
|
||||||
|
sleep $i
|
||||||
|
done
|
||||||
|
if [[ ! -e $repo ]]; then
|
||||||
|
echo -e "${ERROR_COLOR}Failed to clone $repo after 5 attempts. Exiting.${ENDC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the current HEAD commit hash and the remote branch commit hash
|
||||||
|
cd "$repo"
|
||||||
|
git fetch
|
||||||
|
local local_head=$(git rev-parse HEAD)
|
||||||
|
local remote_head=$(git rev-parse origin/"$branch")
|
||||||
|
|
||||||
|
# Check if the git repository is not up to date or the specified file does not exist
|
||||||
|
if [[ "$local_head" != "$remote_head" ]]; then
|
||||||
|
echo "$repo is not up to date. Updating now."
|
||||||
|
true
|
||||||
|
elif [[ ! -e $check ]]; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Log output to a file and only print lines with keywords
|
||||||
|
logger() {
|
||||||
|
local log_file="$RISCV/logs/$STATUS.log"
|
||||||
|
local keyword_pattern="(\bwarning|\berror|\bfail|\bsuccess|\bstamp|\bdoesn't work)"
|
||||||
|
local exclude_pattern="(_warning|warning_|_error|error_|-warning|warning-|-error|error-|Werror|error\.o|warning flags)"
|
||||||
|
|
||||||
|
cat < /dev/stdin | tee -a "$log_file" | \
|
||||||
|
(grep -iE --color=never "$keyword_pattern" || true) | \
|
||||||
|
(grep -viE --color=never "$exclude_pattern" || true)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print section header
|
||||||
|
section_header() {
|
||||||
|
if tput cols > /dev/null 2>&1; then
|
||||||
|
printf "${SECTION_COLOR}%$(tput cols)s\n" | tr ' ' '#'
|
||||||
|
printf "%$(tput cols)s\n" | tr ' ' '#'
|
||||||
|
printf "%s\n" "$1"
|
||||||
|
printf "%$(tput cols)s\n" | tr ' ' '#'
|
||||||
|
printf "%$(tput cols)s${ENDC}\n" | tr ' ' '#'
|
||||||
|
else
|
||||||
|
printf "${SECTION_COLOR}%s\n${ENDC}" "$1"
|
||||||
|
fi
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
###########################################
|
###########################################
|
||||||
## Get Linux distro information
|
## Get Linux distro information and check environment
|
||||||
##
|
##
|
||||||
## Written: Jordan Carlin, jcarlin@hmc.edu
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
## Created: 30 June 2024
|
## Created: 30 June 2024
|
||||||
## Modified:
|
## Modified: May 30 2025
|
||||||
##
|
##
|
||||||
## Purpose: Check for compatible Linux distribution and set variables accordingly
|
## Purpose: Check for compatible Linux distribution and set variables accordingly
|
||||||
##
|
##
|
||||||
|
@ -29,31 +29,26 @@
|
||||||
|
|
||||||
set -e # break on error
|
set -e # break on error
|
||||||
|
|
||||||
# Colors
|
### Colors ###
|
||||||
BOLD='\033[1m'
|
BOLD='\033[1m'
|
||||||
UNDERLINE='\033[4m'
|
UNDERLINE='\033[4m'
|
||||||
SECTION_COLOR='\033[95m'$BOLD
|
SECTION_COLOR='\033[95m'$BOLD
|
||||||
OK_COLOR='\033[94m'
|
OK_COLOR='\033[94m'
|
||||||
|
SUCCESS_COLOR='\033[92m'
|
||||||
WARNING_COLOR='\033[93m'
|
WARNING_COLOR='\033[93m'
|
||||||
FAIL_COLOR='\033[91m'
|
FAIL_COLOR='\033[91m'
|
||||||
ENDC='\033[0m' # Reset to default color
|
ENDC='\033[0m' # Reset to default color
|
||||||
|
|
||||||
# Print section header
|
|
||||||
section_header() {
|
### Common functions and error handling ###
|
||||||
if tput cols > /dev/null 2>&1; then
|
source "$WALLY"/bin/installation/wally-installation-helper-functions.sh
|
||||||
printf "${SECTION_COLOR}%$(tput cols)s\n" | tr ' ' '#'
|
trap error ERR # run error handler on error
|
||||||
printf "%$(tput cols)s\n" | tr ' ' '#'
|
STATUS="setup" # keep track of what part of the installation is running for error messages
|
||||||
printf "%s\n" "$1"
|
|
||||||
printf "%$(tput cols)s\n" | tr ' ' '#'
|
|
||||||
printf "%$(tput cols)s${ENDC}\n" | tr ' ' '#'
|
|
||||||
else
|
|
||||||
printf "${SECTION_COLOR}%s\n${ENDC}" "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
section_header "Checking System Requirements and Configuring Installation"
|
section_header "Checking System Requirements and Configuring Installation"
|
||||||
|
|
||||||
# Get distribution information
|
### Get distribution information ###
|
||||||
if [ -f /etc/os-release ]; then
|
if [ -f /etc/os-release ]; then
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
else
|
else
|
||||||
|
@ -131,6 +126,80 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "${OK_COLOR}${UNDERLINE}%s\n${ENDC}" "Detected information"
|
# wget retry on host error flag not available with older wget on RHEL 8
|
||||||
|
if (( RHEL_VERSION != 8 )); then
|
||||||
|
retry_on_host_error="--retry-on-host-error"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
### Configure installation ###
|
||||||
|
# Check flags
|
||||||
|
clean=false
|
||||||
|
no_buidroot=false
|
||||||
|
while [[ "$#" -gt 0 ]]; do
|
||||||
|
case $1 in
|
||||||
|
-c|--clean) clean=true ;;
|
||||||
|
--no-buildroot) no_buidroot=true ;;
|
||||||
|
--no-args) ;; # Ignore this flag, workaround for sourcing this script in other scripts
|
||||||
|
-h|--help)
|
||||||
|
echo -e "Usage: $0 [\$RISCV] [options]"
|
||||||
|
echo -e "${BOLD}Options:${ENDC}"
|
||||||
|
echo -e " -c, --clean Remove build directories after installation"
|
||||||
|
echo -e " --no-buildroot Skip installing Buildroot and Linux testvectors"
|
||||||
|
echo -e " \$RISCV Directory to install RISC-V tools (default: /opt/riscv as root, $HOME/riscv otherwise)"
|
||||||
|
exit 0 ;;
|
||||||
|
*) RISCV="$1" ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check if root
|
||||||
|
ROOT=$( [ "${EUID:=$(id -u)}" == 0 ] && echo true || echo false);
|
||||||
|
|
||||||
|
# Set installation directory based on execution privileges
|
||||||
|
# If the script is run as root, the default installation path is /opt/riscv
|
||||||
|
# If the script is run as a user, the default installation path is ~/riscv
|
||||||
|
# The installation path can be overridden with a positional argument passed to the script.
|
||||||
|
if [ "$ROOT" == true ]; then
|
||||||
|
export RISCV="${RISCV:-/opt/riscv}"
|
||||||
|
else
|
||||||
|
export RISCV="${RISCV:-$HOME/riscv}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
export PATH=$RISCV/bin:$PATH:/usr/bin
|
||||||
|
export PKG_CONFIG_PATH=$RISCV/lib64/pkgconfig:$RISCV/lib/pkgconfig:$RISCV/share/pkgconfig:$RISCV/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
|
||||||
|
|
||||||
|
# Check for incompatible PATH environment variable before proceeding with installation
|
||||||
|
if [[ ":$PATH:" == *::* || ":$PATH:" == *:.:* ]]; then
|
||||||
|
echo -e "${FAIL_COLOR}Error: You seem to have the current working directory in your \$PATH environment variable."
|
||||||
|
echo -e "This won't work. Please update your \$PATH and try again.${ENDC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increasing NUM_THREADS will speed up parallel compilation of the tools
|
||||||
|
NUM_THREADS=$(nproc --ignore 1) # One less than the total number of threads
|
||||||
|
|
||||||
|
# Check available memory
|
||||||
|
total_mem=$(grep MemTotal < /proc/meminfo | awk '{print $2}')
|
||||||
|
total_mem_gb=$((total_mem / 1024 / 1024))
|
||||||
|
|
||||||
|
# Reduce number of threads for systems with less than 8 GB of memory
|
||||||
|
if ((total_mem < 8400000 )) ; then
|
||||||
|
NUM_THREADS=1
|
||||||
|
echo -e "${WARNING_COLOR}Detected less than or equal to 8 GB of memory. Using a single thread for compiling tools. This may take a while.${ENDC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create installation directory
|
||||||
|
mkdir -p "$RISCV"/logs
|
||||||
|
mkdir -p "$RISCV"/versions
|
||||||
|
|
||||||
|
### Print system information ###
|
||||||
|
echo -e "${OK_COLOR}${UNDERLINE}Detected information${ENDC}"
|
||||||
echo "Distribution: $PRETTY_NAME"
|
echo "Distribution: $PRETTY_NAME"
|
||||||
echo "Version: $VERSION"
|
echo "Version: $VERSION"
|
||||||
|
echo "Running as root: $ROOT"
|
||||||
|
echo "Installation path: $RISCV"
|
||||||
|
echo "Number of cores: $(nproc)"
|
||||||
|
echo "Total memory: $total_mem_gb GB"
|
||||||
|
echo "Using $NUM_THREADS thread(s) for compilation"
|
|
@ -4,7 +4,7 @@
|
||||||
##
|
##
|
||||||
## Written: Jordan Carlin, jcarlin@hmc.edu
|
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||||
## Created: 30 June 2024
|
## Created: 30 June 2024
|
||||||
## Modified:
|
## Modified: May 30 2025
|
||||||
##
|
##
|
||||||
## Purpose: Package manager installation for open source tool chain installation script
|
## Purpose: Package manager installation for open source tool chain installation script
|
||||||
##
|
##
|
||||||
|
@ -29,21 +29,16 @@
|
||||||
|
|
||||||
set -e # break on error
|
set -e # break on error
|
||||||
|
|
||||||
# Colors
|
# If run standalone, check environment. Otherwise, use info from main install script
|
||||||
BOLD='\033[1m'
|
|
||||||
SECTION_COLOR='\033[95m'$BOLD
|
|
||||||
SUCCESS_COLOR='\033[92m'
|
|
||||||
FAIL_COLOR='\033[91m'
|
|
||||||
ENDC='\033[0m' # Reset to default color
|
|
||||||
|
|
||||||
# If run standalone, determine distro information. Otherwise, use info from main install script
|
|
||||||
if [ -z "$FAMILY" ]; then
|
if [ -z "$FAMILY" ]; then
|
||||||
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
source "${dir}"/wally-distro-check.sh
|
WALLY="$(dirname "$dir")"
|
||||||
|
export WALLY
|
||||||
|
source "${dir}"/wally-environment-check.sh "--no-args"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Packages are grouped by which tool requires them. If multiple tools need a package, it is included in the first tool only
|
# Packages are grouped by which tool requires them. If multiple tools need a package, it is included in each tool's list.
|
||||||
# Packages that are constant across distros
|
# Packages that are constant across distros
|
||||||
GENERAL_PACKAGES+=(rsync git make cmake curl wget tar unzip bzip2 dialog mutt)
|
GENERAL_PACKAGES+=(rsync git make cmake curl wget tar unzip bzip2 dialog mutt)
|
||||||
GNU_PACKAGES+=(autoconf automake gawk bison flex texinfo gperf libtool patchutils bc gcc)
|
GNU_PACKAGES+=(autoconf automake gawk bison flex texinfo gperf libtool patchutils bc gcc)
|
||||||
|
@ -67,7 +62,7 @@ case "$FAMILY" in
|
||||||
VERILATOR_PACKAGES+=(perl-doc)
|
VERILATOR_PACKAGES+=(perl-doc)
|
||||||
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)
|
GENERAL_PACKAGES+=(gcc-toolset-13)
|
||||||
;;
|
;;
|
||||||
ubuntu | debian)
|
ubuntu | debian)
|
||||||
if (( UBUNTU_VERSION >= 24 )); then
|
if (( UBUNTU_VERSION >= 24 )); then
|
||||||
|
@ -76,7 +71,7 @@ case "$FAMILY" in
|
||||||
PYTHON_VERSION=python3.11
|
PYTHON_VERSION=python3.11
|
||||||
elif (( UBUNTU_VERSION >= 20 )); then
|
elif (( UBUNTU_VERSION >= 20 )); then
|
||||||
PYTHON_VERSION=python3.9
|
PYTHON_VERSION=python3.9
|
||||||
OTHER_PACKAGES+=(gcc-10 g++-10 cpp-10) # Newer version of gcc needed for Verilator
|
GENERAL_PACKAGES+=(gcc-10 g++-10 cpp-10) # Newer version of gcc needed for Verilator
|
||||||
elif (( DEBIAN_VERSION >= 12 )); then
|
elif (( DEBIAN_VERSION >= 12 )); then
|
||||||
PYTHON_VERSION=python3.11
|
PYTHON_VERSION=python3.11
|
||||||
elif (( DEBIAN_VERSION >= 11 )); then
|
elif (( DEBIAN_VERSION >= 11 )); then
|
||||||
|
@ -107,7 +102,7 @@ case "$FAMILY" in
|
||||||
SPIKE_PACKAGES+=(dtc libboost_regex1_75_0-devel libboost_system1_75_0-devel)
|
SPIKE_PACKAGES+=(dtc libboost_regex1_75_0-devel libboost_system1_75_0-devel)
|
||||||
VERILATOR_PACKAGES+=(gperftools perl-doc)
|
VERILATOR_PACKAGES+=(gperftools perl-doc)
|
||||||
BUILDROOT_PACKAGES+=(ncurses-utils ncurses-devel ncurses5-devel gcc-fortran) # gcc-fortran is only needed for compiling spec benchmarks on buildroot linux
|
BUILDROOT_PACKAGES+=(ncurses-utils ncurses-devel ncurses5-devel gcc-fortran) # gcc-fortran is only needed for compiling spec benchmarks on buildroot linux
|
||||||
OTHER_PACKAGES+=(gcc13 gcc13-c++ cpp13) # Newer version of gcc needed for many tools. Default is gcc7
|
GENERAL_PACKAGES+=(gcc13 gcc13-c++ cpp13) # Newer version of gcc needed for many tools. Default is gcc7
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -116,18 +111,18 @@ esac
|
||||||
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 || "$FAMILY" == suse ]]; then
|
if [[ "$FAMILY" == rhel || "$FAMILY" == suse ]]; then
|
||||||
for pack in "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}"; do
|
for pack in "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${BUILDROOT_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 || "$FAMILY" == debian ]]; then
|
elif [[ "$FAMILY" == ubuntu || "$FAMILY" == debian ]]; then
|
||||||
for pack in "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}"; do
|
for pack in "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${BUILDROOT_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
|
||||||
echo -e "${OK_COLOR}All required packages detected.${ENDC}"
|
echo -e "${OK_COLOR}All required packages detected.${ENDC}"
|
||||||
else
|
else
|
||||||
# Check if root, otherwise exit with error message
|
# Check if root, otherwise exit with error message
|
||||||
[ "${EUID:=$(id -u)}" -ne 0 ] && echo -e "\n${FAIL_COLOR}Must be run as root${ENDC}" && exit 1
|
[ "$ROOT" == false ] && echo -e "\n${FAIL_COLOR}Must be run as root${ENDC}" && exit 1
|
||||||
|
|
||||||
section_header "Installing/Updating Dependencies from Package Manager"
|
section_header "Installing/Updating Dependencies from Package Manager"
|
||||||
# Enable extra repos necessary for rhel
|
# Enable extra repos necessary for rhel
|
||||||
|
@ -150,7 +145,7 @@ 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
|
||||||
eval $PACKAGE_MANAGER install "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}" "${VIVADO_PACKAGES[@]}"
|
eval $PACKAGE_MANAGER install "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${VIVADO_PACKAGES[@]}"
|
||||||
|
|
||||||
# Post install steps
|
# Post install steps
|
||||||
# Vivado looks for ncurses5 libraries, but Ubuntu 24.04 only has ncurses6
|
# Vivado looks for ncurses5 libraries, but Ubuntu 24.04 only has ncurses6
|
||||||
|
|
|
@ -3,11 +3,8 @@
|
||||||
## Tool chain install script.
|
## Tool chain install script.
|
||||||
##
|
##
|
||||||
## Written: Rose Thompson rose@rosethompson.net
|
## Written: Rose Thompson rose@rosethompson.net
|
||||||
## Created: 18 January 2023
|
|
||||||
## Modified: 22 January 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
|
## Modified: 30 May 2025
|
||||||
##
|
##
|
||||||
## Purpose: Open source tool chain installation script
|
## Purpose: Open source tool chain installation script
|
||||||
##
|
##
|
||||||
|
@ -30,158 +27,13 @@
|
||||||
## and limitations under the License.
|
## and limitations under the License.
|
||||||
################################################################################################
|
################################################################################################
|
||||||
|
|
||||||
# Increasing NUM_THREADS will speed up parallel compilation of the tools
|
|
||||||
NUM_THREADS=$(nproc --ignore 1) # One less than the total number of threads
|
|
||||||
|
|
||||||
# Colors
|
|
||||||
BOLD='\033[1m'
|
|
||||||
UNDERLINE='\033[4m'
|
|
||||||
SECTION_COLOR='\033[95m'$BOLD
|
|
||||||
OK_COLOR='\033[94m'
|
|
||||||
SUCCESS_COLOR='\033[92m'
|
|
||||||
WARNING_COLOR='\033[93m'
|
|
||||||
FAIL_COLOR='\033[91m'
|
|
||||||
ENDC='\033[0m' # Reset to default color
|
|
||||||
|
|
||||||
## Helper functions
|
|
||||||
# Error handler
|
|
||||||
error() {
|
|
||||||
echo -e "${FAIL_COLOR}Error: $STATUS installation failed"
|
|
||||||
echo -e "Error on line ${BASH_LINENO[0]} with command $BASH_COMMAND${ENDC}"
|
|
||||||
if [ -e "$RISCV/logs/$STATUS.log" ]; then
|
|
||||||
echo -e "Please check the log in $RISCV/logs/$STATUS.log for more information."
|
|
||||||
fi
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check if a git repository exists, is up to date, and has been installed
|
|
||||||
# clones the repository if it doesn't exist
|
|
||||||
# $1: repo name
|
|
||||||
# $2: repo url to clone from
|
|
||||||
# $3: file to check if already installed
|
|
||||||
# $4: upstream branch, optional, default is master
|
|
||||||
git_check() {
|
|
||||||
local repo=$1
|
|
||||||
local url=$2
|
|
||||||
local check=$3
|
|
||||||
local branch="${4:-master}"
|
|
||||||
|
|
||||||
# Clone repo if it doesn't exist
|
|
||||||
if [[ ! -e $repo ]]; then
|
|
||||||
for ((i=1; i<=5; i++)); do
|
|
||||||
git clone "$url" && break
|
|
||||||
echo -e "${WARNING_COLOR}Failed to clone $repo. Retrying.${ENDC}"
|
|
||||||
rm -rf "$repo"
|
|
||||||
sleep $i
|
|
||||||
done
|
|
||||||
if [[ ! -e $repo ]]; then
|
|
||||||
echo -e "${ERROR_COLOR}Failed to clone $repo after 5 attempts. Exiting.${ENDC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the current HEAD commit hash and the remote branch commit hash
|
|
||||||
cd "$repo"
|
|
||||||
git fetch
|
|
||||||
local local_head=$(git rev-parse HEAD)
|
|
||||||
local remote_head=$(git rev-parse origin/"$branch")
|
|
||||||
|
|
||||||
# Check if the git repository is not up to date or the specified file does not exist
|
|
||||||
if [[ "$local_head" != "$remote_head" ]]; then
|
|
||||||
echo "$repo is not up to date. Updating now."
|
|
||||||
true
|
|
||||||
elif [[ ! -e $check ]]; then
|
|
||||||
true
|
|
||||||
else
|
|
||||||
false
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Log output to a file and only print lines with keywords
|
|
||||||
logger() {
|
|
||||||
local log_file="$RISCV/logs/$STATUS.log"
|
|
||||||
local keyword_pattern="(\bwarning|\berror|\bfail|\bsuccess|\bstamp|\bdoesn't work)"
|
|
||||||
local exclude_pattern="(_warning|warning_|_error|error_|-warning|warning-|-error|error-|Werror|error\.o|warning flags)"
|
|
||||||
|
|
||||||
cat < /dev/stdin | tee -a "$log_file" | \
|
|
||||||
(grep -iE --color=never "$keyword_pattern" || true) | \
|
|
||||||
(grep -viE --color=never "$exclude_pattern" || true)
|
|
||||||
}
|
|
||||||
|
|
||||||
set -e # break on error
|
|
||||||
trap error ERR # run error handler on error
|
|
||||||
STATUS="setup" # keep track of what part of the installation is running for error messages
|
|
||||||
|
|
||||||
# Check for clean flag
|
|
||||||
if [ "$1" == "--clean" ] || [ "$2" == "--clean" ]; then
|
|
||||||
clean=true
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for no-buildroot flag
|
|
||||||
if [ "$1" == "--no-buildroot" ] || [ "$2" == "--no-buildroot" ]; then
|
|
||||||
no_buidroot=true
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Determine script directory to locate related scripts
|
# Determine script directory to locate related scripts
|
||||||
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
WALLY=$(dirname "$dir")
|
WALLY=$(dirname "$dir")
|
||||||
export WALLY
|
export WALLY
|
||||||
|
|
||||||
# Get Linux distro and version
|
# Get Linux distro and version
|
||||||
source "${dir}"/wally-distro-check.sh
|
source "${dir}"/wally-environment-check.sh
|
||||||
|
|
||||||
# Check if root
|
|
||||||
ROOT=$( [ "${EUID:=$(id -u)}" == 0 ] && echo true || echo false);
|
|
||||||
|
|
||||||
# Set installation directory based on execution privileges
|
|
||||||
# If the script is run as root, the default installation path is /opt/riscv
|
|
||||||
# If the script is run as a user, the default installation path is ~/riscv
|
|
||||||
# The installation path can be overridden with an argument passed to the script.
|
|
||||||
if [ "$ROOT" == true ]; then
|
|
||||||
export RISCV="${1:-/opt/riscv}"
|
|
||||||
else
|
|
||||||
export RISCV="${1:-$HOME/riscv}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set environment variables
|
|
||||||
export PATH=$PATH:$RISCV/bin:/usr/bin
|
|
||||||
export PKG_CONFIG_PATH=$RISCV/lib64/pkgconfig:$RISCV/lib/pkgconfig:$RISCV/share/pkgconfig:$RISCV/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
|
|
||||||
|
|
||||||
# wget retry on host error flag not available with older wget on RHEL 8
|
|
||||||
if (( RHEL_VERSION != 8 )); then
|
|
||||||
retry_on_host_error="--retry-on-host-error"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for incompatible PATH environment variable before proceeding with installation
|
|
||||||
if [[ ":$PATH:" == *::* || ":$PATH:" == *:.:* ]]; then
|
|
||||||
echo -e "${FAIL_COLOR}Error: You seem to have the current working directory in your \$PATH environment variable."
|
|
||||||
echo -e "This won't work. Please update your \$PATH and try again.${ENDC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check available memory
|
|
||||||
total_mem=$(grep MemTotal < /proc/meminfo | awk '{print $2}')
|
|
||||||
total_mem_gb=$((total_mem / 1024 / 1024))
|
|
||||||
|
|
||||||
# Print system information
|
|
||||||
echo "Running as root: $ROOT"
|
|
||||||
echo "Installation path: $RISCV"
|
|
||||||
echo "Number of cores: $(nproc)"
|
|
||||||
echo "Total memory: $total_mem_gb GB"
|
|
||||||
|
|
||||||
# Reduce number of threads for systems with less than 8 GB of memory
|
|
||||||
if ((total_mem < 8400000 )) ; then
|
|
||||||
NUM_THREADS=1
|
|
||||||
echo -e "${WARNING_COLOR}Detected less than or equal to 8 GB of memory. Using a single thread for compiling tools. This may take a while.${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Print number of threads
|
|
||||||
echo "Using $NUM_THREADS thread(s) for compilation"
|
|
||||||
|
|
||||||
# Create installation directory
|
|
||||||
mkdir -p "$RISCV"/logs
|
|
||||||
|
|
||||||
# Install/update system packages if root. Otherwise, check that packages are already installed.
|
# Install/update system packages if root. Otherwise, check that packages are already installed.
|
||||||
STATUS="system_packages"
|
STATUS="system_packages"
|
||||||
|
@ -191,121 +43,25 @@ else
|
||||||
source "${dir}"/wally-package-install.sh --check
|
source "${dir}"/wally-package-install.sh --check
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Older version of git defaults to protocol version incompatible with riscv-gnu-toolchain
|
|
||||||
if (( UBUNTU_VERSION == 20 )); then
|
|
||||||
git config --global protocol.version 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Enable newer version of gcc for older distros (required for QEMU/Verilator)
|
|
||||||
if [ "$FAMILY" == rhel ]; then
|
|
||||||
source /opt/rh/gcc-toolset-13/enable
|
|
||||||
elif [ "$FAMILY" == suse ]; then
|
|
||||||
mkdir -p "$RISCV"/gcc-13/bin
|
|
||||||
for f in gcc cpp g++ gcc-ar gcc-nm gcc-ranlib gcov gcov-dump gcov-tool lto-dump; do
|
|
||||||
ln -vsf /usr/bin/$f-13 "$RISCV"/gcc-13/bin/$f
|
|
||||||
done
|
|
||||||
export PATH="$RISCV"/gcc-13/bin:$PATH
|
|
||||||
elif (( UBUNTU_VERSION == 20 )); then
|
|
||||||
mkdir -p "$RISCV"/gcc-10/bin
|
|
||||||
for f in gcc cpp g++ gcc-ar gcc-nm gcc-ranlib gcov gcov-dump gcov-tool lto-dump; do
|
|
||||||
ln -vsf /usr/bin/$f-10 "$RISCV"/gcc-10/bin/$f
|
|
||||||
done
|
|
||||||
export PATH="$RISCV"/gcc-10/bin:$PATH
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Create python virtual environment so the python command targets desired version of python
|
# Create python virtual environment so the python command targets desired version of python
|
||||||
# and installed packages are isolated from the rest of the system.
|
# and installed packages are isolated from the rest of the system. Also installs python packages,
|
||||||
section_header "Setting up Python Environment"
|
# including RISCOF (https://github.com/riscv-software-src/riscof.git)
|
||||||
STATUS="python_virtual_environment"
|
|
||||||
cd "$RISCV"
|
|
||||||
if [ ! -e "$RISCV"/riscv-python/bin/activate ]; then
|
|
||||||
"$PYTHON_VERSION" -m venv riscv-python --prompt cvw
|
|
||||||
echo -e "${OK_COLOR}Python virtual environment created!\nInstalling pip packages.${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${OK_COLOR}Python virtual environment already exists.\nUpdating pip packages.${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
source "$RISCV"/riscv-python/bin/activate # activate python virtual environment
|
|
||||||
|
|
||||||
# Install python packages, including RISCOF (https://github.com/riscv-software-src/riscof.git)
|
|
||||||
# RISCOF is a RISC-V compliance test framework that is used to run the RISC-V Arch Tests.
|
# RISCOF is a RISC-V compliance test framework that is used to run the RISC-V Arch Tests.
|
||||||
STATUS="python packages"
|
"$WALLY"/bin/installation/python-setup.sh
|
||||||
pip install --upgrade pip && pip install --upgrade -r "$dir"/requirements.txt
|
|
||||||
|
|
||||||
source "$RISCV"/riscv-python/bin/activate # reload python virtual environment
|
|
||||||
echo -e "${SUCCESS_COLOR}Python environment successfully configured!${ENDC}"
|
|
||||||
|
|
||||||
# Extra dependencies needed for older distros that don't have new enough versions available from package manager
|
# Activate tools (python virtual environment and possibly newer version of gcc)
|
||||||
|
source "${WALLY}"/bin/installation/activate-tools.sh
|
||||||
|
|
||||||
|
|
||||||
|
# Newer version of glib required for QEMU.
|
||||||
|
# Anything newer than this won't build on red hat 8
|
||||||
|
# Used for all installed tools becuase mixing glib versions can cause issues.
|
||||||
if (( RHEL_VERSION == 8 )) || (( UBUNTU_VERSION == 20 )); then
|
if (( RHEL_VERSION == 8 )) || (( UBUNTU_VERSION == 20 )); then
|
||||||
# Newer version of glib required for QEMU.
|
"$WALLY"/bin/installation/glib-installation.sh
|
||||||
# Anything newer than this won't build on red hat 8
|
|
||||||
STATUS="glib"
|
|
||||||
if [ ! -e "$RISCV"/include/glib-2.0 ]; then
|
|
||||||
section_header "Installing glib"
|
|
||||||
pip install -U meson # Meson is needed to build glib
|
|
||||||
cd "$RISCV"
|
|
||||||
wget -nv --retry-connrefused $retry_on_host_error https://download.gnome.org/sources/glib/2.70/glib-2.70.5.tar.xz
|
|
||||||
tar -xJf glib-2.70.5.tar.xz
|
|
||||||
rm -f glib-2.70.5.tar.xz
|
|
||||||
cd glib-2.70.5
|
|
||||||
meson setup _build --prefix="$RISCV"
|
|
||||||
meson compile -C _build -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
meson install -C _build 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
cd "$RISCV"
|
|
||||||
rm -rf glib-2.70.5
|
|
||||||
echo -e "${SUCCESS_COLOR}glib successfully installed!${ENDC}"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Newer version of gmp needed for sail-riscv model
|
|
||||||
if (( RHEL_VERSION == 8 )); then
|
|
||||||
STATUS="gmp"
|
|
||||||
if [ ! -e "$RISCV"/include/gmp.h ]; then
|
|
||||||
section_header "Installing gmp"
|
|
||||||
cd "$RISCV"
|
|
||||||
wget -nv --retry-connrefused $retry_on_host_error https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz
|
|
||||||
tar -xJf gmp-6.3.0.tar.xz
|
|
||||||
rm -f gmp-6.3.0.tar.xz
|
|
||||||
cd gmp-6.3.0
|
|
||||||
./configure --prefix="$RISCV"
|
|
||||||
make -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
make install 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
cd "$RISCV"
|
|
||||||
rm -rf gmp-6.3.0
|
|
||||||
echo -e "${SUCCESS_COLOR}gmp successfully installed!${ENDC}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Mold needed for Verilator
|
|
||||||
if (( UBUNTU_VERSION == 20 || DEBIAN_VERSION == 11 )) || [ "$FAMILY" == suse ]; then
|
|
||||||
STATUS="mold"
|
|
||||||
if [ ! -e "$RISCV"/bin/mold ]; then
|
|
||||||
section_header "Installing mold"
|
|
||||||
cd "$RISCV"
|
|
||||||
wget -nv --retry-connrefused $retry_on_host_error --output-document=mold.tar.gz https://github.com/rui314/mold/releases/download/v2.34.1/mold-2.34.1-x86_64-linux.tar.gz
|
|
||||||
tar xz --directory="$RISCV" --strip-components=1 -f mold.tar.gz
|
|
||||||
rm -f mold.tar.gz
|
|
||||||
echo -e "${SUCCESS_COLOR}Mold successfully installed/updated!${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${SUCCESS_COLOR}Mold already installed.${ENDC}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Newer version of CMake needed to build sail-riscv model (at least 3.20)
|
|
||||||
if (( UBUNTU_VERSION == 20 || DEBIAN_VERSION == 11 )); then
|
|
||||||
STATUS="cmake"
|
|
||||||
if [ ! -e "$RISCV"/bin/cmake ]; then
|
|
||||||
section_header "Installing cmake"
|
|
||||||
cd "$RISCV"
|
|
||||||
wget -nv --retry-connrefused $retry_on_host_error --output-document=cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.31.5/cmake-3.31.5-linux-x86_64.tar.gz
|
|
||||||
tar xz --directory="$RISCV" --strip-components=1 -f cmake.tar.gz
|
|
||||||
rm -f cmake.tar.gz
|
|
||||||
echo -e "${SUCCESS_COLOR}CMake successfully installed/updated!${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${SUCCESS_COLOR}CMake already installed.${ENDC}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# RISC-V GNU Toolchain (https://github.com/riscv-collab/riscv-gnu-toolchain)
|
# RISC-V GNU Toolchain (https://github.com/riscv-collab/riscv-gnu-toolchain)
|
||||||
# The RISC-V GNU Toolchain includes the GNU Compiler Collection (gcc), GNU Binutils, Newlib,
|
# The RISC-V GNU Toolchain includes the GNU Compiler Collection (gcc), GNU Binutils, Newlib,
|
||||||
|
@ -313,22 +69,7 @@ fi
|
||||||
# To install GCC from source can take hours to compile.
|
# To install GCC from source can take hours to compile.
|
||||||
# This configuration enables multilib to target many flavors of RISC-V.
|
# This configuration enables multilib to target many flavors of RISC-V.
|
||||||
# This book is tested with GCC 13.2.0 and 14.2.0.
|
# This book is tested with GCC 13.2.0 and 14.2.0.
|
||||||
section_header "Installing/Updating RISC-V GNU Toolchain"
|
"$WALLY"/bin/installation/riscv-gnu-toolchain-install.sh
|
||||||
STATUS="riscv-gnu-toolchain"
|
|
||||||
cd "$RISCV"
|
|
||||||
if git_check "riscv-gnu-toolchain" "https://github.com/riscv/riscv-gnu-toolchain" "$RISCV/riscv-gnu-toolchain/stamps/build-gcc-newlib-stage2"; then
|
|
||||||
cd "$RISCV"/riscv-gnu-toolchain
|
|
||||||
git reset --hard && git clean -f && git checkout master && git pull && git submodule update
|
|
||||||
./configure --prefix="${RISCV}" --with-multilib-generator="rv32e-ilp32e--;rv32i-ilp32--;rv32im-ilp32--;rv32iac-ilp32--;rv32imac-ilp32--;rv32imafc-ilp32f--;rv32imafdc-ilp32d--;rv64i-lp64--;rv64ic-lp64--;rv64iac-lp64--;rv64imac-lp64--;rv64imafdc-lp64d--;rv64im-lp64--;"
|
|
||||||
make -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
if [ "$clean" ]; then
|
|
||||||
cd "$RISCV"
|
|
||||||
rm -rf riscv-gnu-toolchain
|
|
||||||
fi
|
|
||||||
echo -e "${SUCCESS_COLOR}RISC-V GNU Toolchain successfully installed/updated!${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${SUCCESS_COLOR}RISC-V GNU Toolchain already up to date.${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# elf2hex (https://github.com/sifive/elf2hex)
|
# elf2hex (https://github.com/sifive/elf2hex)
|
||||||
|
@ -338,175 +79,44 @@ fi
|
||||||
# For example, if Python version 2.x is in your path, it won’t install correctly.
|
# For example, if Python version 2.x is in your path, it won’t install correctly.
|
||||||
# Also, be sure riscv64-unknown-elf-objcopy shows up in your path in $RISCV/riscv-gnu-toolchain/bin
|
# Also, be sure riscv64-unknown-elf-objcopy shows up in your path in $RISCV/riscv-gnu-toolchain/bin
|
||||||
# at the time of compilation, or elf2hex won’t work properly.
|
# at the time of compilation, or elf2hex won’t work properly.
|
||||||
section_header "Installing/Updating elf2hex"
|
"$WALLY"/bin/installation/elf2hex-install.sh
|
||||||
STATUS="elf2hex"
|
|
||||||
cd "$RISCV"
|
|
||||||
export PATH=$RISCV/bin:$PATH
|
|
||||||
if git_check "elf2hex" "https://github.com/sifive/elf2hex.git" "$RISCV/bin/riscv64-unknown-elf-elf2bin"; then
|
|
||||||
cd "$RISCV"/elf2hex
|
|
||||||
git reset --hard && git clean -f && git checkout master && git pull
|
|
||||||
autoreconf -i
|
|
||||||
./configure --target=riscv64-unknown-elf --prefix="$RISCV"
|
|
||||||
make 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
make install 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
if [ "$clean" ]; then
|
|
||||||
cd "$RISCV"
|
|
||||||
rm -rf elf2hex
|
|
||||||
fi
|
|
||||||
echo -e "${SUCCESS_COLOR}elf2hex successfully installed/updated!${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${SUCCESS_COLOR}elf2hex already up to date.${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# QEMU (https://www.qemu.org/docs/master/system/target-riscv.html)
|
# QEMU (https://www.qemu.org/docs/master/system/target-riscv.html)
|
||||||
# QEMU is an open source machine emulator and virtualizer capable of emulating RISC-V
|
# QEMU is an open source machine emulator and virtualizer capable of emulating RISC-V
|
||||||
section_header "Installing/Updating QEMU"
|
"$WALLY"/bin/installation/qemu-install.sh
|
||||||
STATUS="qemu"
|
|
||||||
cd "$RISCV"
|
|
||||||
if git_check "qemu" "https://github.com/qemu/qemu" "$RISCV/include/qemu-plugin.h"; then
|
|
||||||
cd "$RISCV"/qemu
|
|
||||||
git reset --hard && git clean -f && git checkout master && git pull
|
|
||||||
./configure --target-list=riscv64-softmmu --prefix="$RISCV"
|
|
||||||
make -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
make install 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
if [ "$clean" ]; then
|
|
||||||
cd "$RISCV"
|
|
||||||
rm -rf qemu
|
|
||||||
fi
|
|
||||||
echo -e "${SUCCESS_COLOR}QEMU successfully installed/updated!${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${SUCCESS_COLOR}QEMU already up to date.${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Spike (https://github.com/riscv-software-src/riscv-isa-sim)
|
# Spike (https://github.com/riscv-software-src/riscv-isa-sim)
|
||||||
# Spike is a reference model for RISC-V. It is a functional simulator that can be used to run RISC-V programs.
|
# Spike is a reference model for RISC-V. It is a functional simulator that can be used to run RISC-V programs.
|
||||||
section_header "Installing/Updating SPIKE"
|
"$WALLY"/bin/installation/spike-install.sh
|
||||||
STATUS="spike"
|
|
||||||
cd "$RISCV"
|
|
||||||
if git_check "riscv-isa-sim" "https://github.com/riscv-software-src/riscv-isa-sim" "$RISCV/lib/pkgconfig/riscv-riscv.pc"; then
|
|
||||||
cd "$RISCV"/riscv-isa-sim
|
|
||||||
git reset --hard && git clean -f && git checkout master && git pull
|
|
||||||
mkdir -p build
|
|
||||||
cd build
|
|
||||||
../configure --prefix="$RISCV"
|
|
||||||
make -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
make install 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
if [ "$clean" ]; then
|
|
||||||
cd "$RISCV"
|
|
||||||
rm -rf riscv-isa-sim
|
|
||||||
fi
|
|
||||||
echo -e "${SUCCESS_COLOR}Spike successfully installed/updated!${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${SUCCESS_COLOR}Spike already up to date.${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Verilator (https://github.com/verilator/verilator)
|
# Verilator (https://github.com/verilator/verilator)
|
||||||
# Verilator is a fast open-source Verilog simulator that compiles synthesizable Verilog code into C++ code.
|
# Verilator is a fast open-source Verilog simulator that compiles synthesizable Verilog code into C++ code.
|
||||||
# It is used for linting and simulation of Wally.
|
# It is used for linting and simulation of Wally.
|
||||||
# Verilator needs to be built from source to get the latest version (Wally needs 5.021 or later).
|
# Verilator needs to be built from source to get the latest version (Wally needs 5.021 or later).
|
||||||
section_header "Installing/Updating Verilator"
|
"$WALLY"/bin/installation/verilator-install.sh
|
||||||
STATUS="verilator"
|
|
||||||
if [ "$UBUNTU_VERSION" == 20 ] || [ "$DEBIAN_VERSION" == 11 ]; then
|
|
||||||
# On Ubuntu 20 and Debian 11, the last version of Verilator that build successfully is 5.036.
|
|
||||||
export VERILATOR_VERSION="5.036"
|
|
||||||
else
|
|
||||||
export VERILATOR_VERSION="master"
|
|
||||||
fi
|
|
||||||
cd "$RISCV"
|
|
||||||
if git_check "verilator" "https://github.com/verilator/verilator" "$RISCV/share/pkgconfig/verilator.pc"; then
|
|
||||||
unset VERILATOR_ROOT
|
|
||||||
cd "$RISCV"/verilator
|
|
||||||
git reset --hard && git clean -f && git checkout "$VERILATOR_VERSION" && (git pull || true)
|
|
||||||
autoconf
|
|
||||||
./configure --prefix="$RISCV"
|
|
||||||
make -j "${NUM_THREADS}" 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
make install 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
if [ "$clean" ]; then
|
|
||||||
cd "$RISCV"
|
|
||||||
rm -rf verilator
|
|
||||||
fi
|
|
||||||
echo -e "${SUCCESS_COLOR}Verilator successfully installed/updated!${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${SUCCESS_COLOR}Verilator already up to date.${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Sail Compiler (https://github.com/rems-project/sail)
|
# 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.
|
||||||
# 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.
|
# is a functional programming language suited to formal verification.
|
||||||
section_header "Installing/Updating Sail Compiler"
|
"$WALLY"/bin/installation/sail-install.sh
|
||||||
STATUS="sail_compiler"
|
|
||||||
cd "$RISCV"
|
|
||||||
wget -nv --retry-connrefused $retry_on_host_error --output-document=sail.tar.gz https://github.com/rems-project/sail/releases/latest/download/sail.tar.gz
|
|
||||||
tar xz --directory="$RISCV" --strip-components=1 -f sail.tar.gz
|
|
||||||
rm -f sail.tar.gz
|
|
||||||
echo -e "${SUCCESS_COLOR}Sail Compiler successfully installed/updated!${ENDC}"
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
section_header "Installing/Updating RISC-V Sail Model"
|
|
||||||
STATUS="riscv-sail-model"
|
|
||||||
if git_check "sail-riscv" "https://github.com/riscv/sail-riscv.git" "$RISCV/bin/riscv_sim_rv32d"; then
|
|
||||||
cd "$RISCV"/sail-riscv
|
|
||||||
git reset --hard && git clean -f && git checkout master && git pull
|
|
||||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="$RISCV" -GNinja 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
cmake --build build 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
cmake --install build 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
if [ "$clean" ]; then
|
|
||||||
cd "$RISCV"
|
|
||||||
rm -rf sail-riscv
|
|
||||||
fi
|
|
||||||
echo -e "${SUCCESS_COLOR}RISC-V Sail Model successfully installed/updated!${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${SUCCESS_COLOR}RISC-V Sail Model already up to date.${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# OSU Skywater 130 cell library (https://foss-eda-tools.googlesource.com/skywater-pdk/libs/sky130_osu_sc_t12)
|
# OSU Skywater 130 cell library (https://foss-eda-tools.googlesource.com/skywater-pdk/libs/sky130_osu_sc_t12)
|
||||||
# The OSU Skywater 130 cell library is a standard cell library that is used to synthesize Wally.
|
# The OSU Skywater 130 cell library is a standard cell library that is used to synthesize Wally.
|
||||||
section_header "Installing/Updating OSU Skywater 130 cell library"
|
"$WALLY"/bin/installation/skywater-lib-install.sh
|
||||||
STATUS="osu_skywater_130_cell_library"
|
|
||||||
mkdir -p "$RISCV"/cad/lib
|
|
||||||
cd "$RISCV"/cad/lib
|
|
||||||
if git_check "sky130_osu_sc_t12" "https://foss-eda-tools.googlesource.com/skywater-pdk/libs/sky130_osu_sc_t12" "$RISCV/cad/lib/sky130_osu_sc_t12" "main"; then
|
|
||||||
cd "$RISCV"/sky130_osu_sc_t12
|
|
||||||
git reset --hard && git clean -f && git checkout main && git pull
|
|
||||||
echo -e "${SUCCESS_COLOR}OSU Skywater library successfully installed!${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${SUCCESS_COLOR}OSU Skywater library already up to date.${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Buildroot and Linux testvectors
|
# Buildroot and Linux testvectors
|
||||||
# Buildroot is used to boot a minimal version of Linux on Wally.
|
# Buildroot is used to boot a minimal version of Linux on Wally.
|
||||||
# Testvectors are generated using QEMU.
|
# Testvectors are generated using QEMU.
|
||||||
if [ ! "$no_buidroot" ]; then
|
"$WALLY"/bin/installation/buildroot-install.sh
|
||||||
section_header "Installing Buildroot and Creating Linux testvectors"
|
|
||||||
STATUS="buildroot"
|
|
||||||
if [ -z "$LD_LIBRARY_PATH" ]; then
|
|
||||||
export LD_LIBRARY_PATH=$RISCV/lib:$RISCV/lib64:$RISCV/riscv64-unknown-elf/lib:$RISCV/lib/x86_64-linux-gnu/
|
|
||||||
else
|
|
||||||
export LD_LIBRARY_PATH=$RISCV/lib:$RISCV/lib64:$LD_LIBRARY_PATH:$RISCV/riscv64-unknown-elf/lib:$RISCV/lib/x86_64-linux-gnu/
|
|
||||||
fi
|
|
||||||
cd "$dir"/../linux
|
|
||||||
if [ ! -e "$RISCV"/buildroot ]; then
|
|
||||||
FORCE_UNSAFE_CONFIGURE=1 make 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ] # FORCE_UNSAFE_CONFIGURE is needed to allow buildroot to compile when run as root
|
|
||||||
echo -e "${SUCCESS_COLOR}Buildroot successfully installed and Linux testvectors created!${ENDC}"
|
|
||||||
elif [ ! -e "$RISCV"/linux-testvectors ]; then
|
|
||||||
echo -e "${OK_COLOR}Buildroot already exists, but Linux testvectors are missing. Generating them now.${ENDC}"
|
|
||||||
make dumptvs 2>&1 | logger; [ "${PIPESTATUS[0]}" == 0 ]
|
|
||||||
echo -e "${SUCCESS_COLOR}Linux testvectors successfully generated!${ENDC}"
|
|
||||||
else
|
|
||||||
echo -e "${OK_COLOR}Buildroot and Linux testvectors already exist.${ENDC}"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "${OK_COLOR}Skipping Buildroot and Linux testvectors.${ENDC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Download site-setup scripts
|
# Download site-setup scripts
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue