mirror of
https://github.com/openhwgroup/cvw.git
synced 2025-06-27 08:50:26 -04:00
Fix a few more issues with new installation method
This commit is contained in:
parent
12b203032f
commit
03bf608a0c
3 changed files with 51 additions and 46 deletions
4
.github/workflows/install.yml
vendored
4
.github/workflows/install.yml
vendored
|
@ -149,7 +149,7 @@ jobs:
|
||||||
# Update setup.sh if using a custom $RISCV path
|
# Update setup.sh if using a custom $RISCV path
|
||||||
- name: Update setup.sh
|
- name: Update setup.sh
|
||||||
if: ${{ matrix.riscv_path != null }}
|
if: ${{ matrix.riscv_path != null }}
|
||||||
run: sed -i 's,/opt/riscv,${{ matrix.riscv_path }},g' setup.sh
|
run: sed -i 's,~/riscv,${{ matrix.riscv_path }},g' setup.sh
|
||||||
# Upload installation logs for debugging
|
# Upload installation logs for debugging
|
||||||
- name: Upload Installation Logs
|
- name: Upload Installation Logs
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
@ -168,7 +168,7 @@ jobs:
|
||||||
- name: make tests
|
- name: make tests
|
||||||
run: |
|
run: |
|
||||||
source setup.sh
|
source setup.sh
|
||||||
make riscof zsbl deriv --jobs $(nproc --ignore 1)
|
make riscof zsbl deriv coverage --jobs $(nproc --ignore 1)
|
||||||
# Run standard regression, skipping distros that are known to be broken with Verilator
|
# Run standard regression, skipping distros that are known to be broken with Verilator
|
||||||
- name: Regression
|
- name: Regression
|
||||||
if: ${{ matrix.regressionFail != true }}
|
if: ${{ matrix.regressionFail != true }}
|
||||||
|
|
|
@ -141,11 +141,12 @@ fi
|
||||||
# Check flags
|
# Check flags
|
||||||
clean=false
|
clean=false
|
||||||
no_buildroot=false
|
no_buildroot=false
|
||||||
|
packages_only=false
|
||||||
while [[ "$#" -gt 0 ]]; do
|
while [[ "$#" -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-c|--clean) clean=true ;;
|
-c|--clean) clean=true ;;
|
||||||
--no-buildroot) no_buildroot=true ;;
|
--no-buildroot) no_buildroot=true ;;
|
||||||
--no-args) ;; # Ignore this flag, workaround for sourcing this script in other scripts
|
--packages-only) packages_only=true;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
echo -e "Usage: $0 [\$RISCV] [options]"
|
echo -e "Usage: $0 [\$RISCV] [options]"
|
||||||
echo -e "${BOLD}Options:${ENDC}"
|
echo -e "${BOLD}Options:${ENDC}"
|
||||||
|
@ -161,50 +162,54 @@ done
|
||||||
# Check if root
|
# Check if root
|
||||||
ROOT=$( [ "${EUID:=$(id -u)}" == 0 ] && echo true || echo false);
|
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:+:${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 ###
|
### Print system information ###
|
||||||
echo -e "${OK_COLOR}${UNDERLINE}Detected information${ENDC}"
|
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 "Running as root: $ROOT"
|
||||||
echo "Installation path: $RISCV"
|
|
||||||
echo "Number of cores: $(nproc)"
|
if [ $packages_only != true ]; then
|
||||||
echo "Total memory: $total_mem_gb GB"
|
# Set installation directory based on execution privileges
|
||||||
echo "Using $NUM_THREADS thread(s) for compilation"
|
# 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:+:${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 more system information
|
||||||
|
echo "Installation path: $RISCV"
|
||||||
|
echo "Number of cores: $(nproc)"
|
||||||
|
echo "Total memory: $total_mem_gb GB"
|
||||||
|
echo "Using $NUM_THREADS thread(s) for compilation"
|
||||||
|
fi
|
||||||
|
|
|
@ -36,7 +36,7 @@ if [ -z "$FAMILY" ]; then
|
||||||
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
WALLY="$(dirname "$dir")"
|
WALLY="$(dirname "$dir")"
|
||||||
export WALLY
|
export WALLY
|
||||||
source "${dir}"/wally-environment-check.sh "--no-args"
|
source "${dir}"/wally-environment-check.sh "--packages-only"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue