Merge branch 'main' of https://github.com/ucb-bar/chipyard into openroad
This commit is contained in:
110
scripts/build-toolchain-extra.sh
Executable file
110
scripts/build-toolchain-extra.sh
Executable file
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# exit script if any command fails
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
RDIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
# get helpful utilities
|
||||
source $RDIR/scripts/utils.sh
|
||||
|
||||
common_setup
|
||||
|
||||
# Allow user to override MAKE
|
||||
[ -n "${MAKE:+x}" ] || MAKE=$(command -v gnumake || command -v gmake || command -v make)
|
||||
readonly MAKE
|
||||
|
||||
usage() {
|
||||
echo "usage: ${0} [OPTIONS] [riscv-tools | esp-tools]"
|
||||
echo ""
|
||||
echo "Installation Types"
|
||||
echo " riscv-tools: if set, builds the riscv toolchain (this is also the default)"
|
||||
echo " esp-tools: if set, builds esp-tools toolchain used for the hwacha vector accelerator"
|
||||
echo ""
|
||||
echo "Options"
|
||||
echo " --prefix PREFIX : Install destination. If unset, defaults to $CONDA_PREFIX/riscv-tools"
|
||||
echo " or $CONDA_PREFIX/esp-tools"
|
||||
echo " --clean-after-install : Run make clean in calls to module_make and module_build"
|
||||
echo " --force -f : Skip prompt checking for conda"
|
||||
echo " --skip-validate : DEPRECATED: Same functionality as --force"
|
||||
echo " --help -h : Display this message"
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
TOOLCHAIN="riscv-tools"
|
||||
CLEANAFTERINSTALL=""
|
||||
RISCV=""
|
||||
FORCE=false
|
||||
|
||||
# getopts does not support long options, and is inflexible
|
||||
while [ "$1" != "" ];
|
||||
do
|
||||
case $1 in
|
||||
-h | -H | --help | help )
|
||||
usage 3 ;;
|
||||
-p | --prefix )
|
||||
shift
|
||||
RISCV=$(realpath $1) ;;
|
||||
--clean-after-install )
|
||||
CLEANAFTERINSTALL="true" ;;
|
||||
riscv-tools | esp-tools)
|
||||
TOOLCHAIN=$1 ;;
|
||||
--force | -f | --skip-validate)
|
||||
FORCE=true;
|
||||
;;
|
||||
* )
|
||||
error "invalid option $1"
|
||||
usage 1 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$FORCE" = false ]; then
|
||||
if [ -z ${CONDA_DEFAULT_ENV+x} ]; then
|
||||
error "ERROR: No conda environment detected. Did you activate the conda environment (e.x. 'conda activate chipyard')?"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$RISCV" ] ; then
|
||||
RISCV="$CONDA_PREFIX/$TOOLCHAIN"
|
||||
fi
|
||||
|
||||
XLEN=64
|
||||
|
||||
echo "Installing extra toolchain utilities/tests to $RISCV"
|
||||
|
||||
# install risc-v tools
|
||||
export RISCV="$RISCV"
|
||||
|
||||
cd "${RDIR}"
|
||||
|
||||
SRCDIR="$(pwd)/toolchains/${TOOLCHAIN}"
|
||||
[ -d "${SRCDIR}" ] || die "unsupported toolchain: ${TOOLCHAIN}"
|
||||
. ./scripts/build-util.sh
|
||||
|
||||
echo '==> Installing Spike'
|
||||
# disable boost explicitly for https://github.com/riscv-software-src/riscv-isa-sim/issues/834
|
||||
# since we don't have it in our requirements
|
||||
module_all riscv-isa-sim --prefix="${RISCV}" --with-boost=no --with-boost-asio=no --with-boost-regex=no
|
||||
# build static libfesvr library for linking into firesim driver (or others)
|
||||
echo '==> Installing libfesvr static library'
|
||||
OLDCLEANAFTERINSTALL=$CLEANAFTERINSTALL
|
||||
CLEANAFTERINSTALL=""
|
||||
module_make riscv-isa-sim libfesvr.a
|
||||
cp -p "${SRCDIR}/riscv-isa-sim/build/libfesvr.a" "${RISCV}/lib/"
|
||||
CLEANAFTERINSTALL=$OLDCLEANAFTERINSTALL
|
||||
|
||||
echo '==> Installing Proxy Kernel'
|
||||
CC= CXX= module_all riscv-pk --prefix="${RISCV}" --host=riscv${XLEN}-unknown-elf
|
||||
|
||||
echo '==> Installing RISC-V tests'
|
||||
module_all riscv-tests --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --with-xlen=${XLEN}
|
||||
|
||||
# Common tools (not in any particular toolchain dir)
|
||||
|
||||
echo '==> Installing libgloss'
|
||||
CC= CXX= SRCDIR="$(pwd)/toolchains" module_all libgloss --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --host=riscv${XLEN}-unknown-elf
|
||||
|
||||
echo "Extra Toolchain Utilities/Tests Build Complete!"
|
||||
@@ -1,227 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#this script is based on the firesim build toolchains script
|
||||
|
||||
# exit script if any command fails
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
# On macOS, use GNU readlink from 'coreutils' package in Homebrew/MacPorts
|
||||
if [ "$(uname -s)" = "Darwin" ] ; then
|
||||
READLINK=greadlink
|
||||
else
|
||||
READLINK=readlink
|
||||
fi
|
||||
|
||||
# If BASH_SOURCE is undefined, we may be running under zsh, in that case
|
||||
# provide a zsh-compatible alternative
|
||||
DIR="$(dirname "$($READLINK -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"
|
||||
CHIPYARD_DIR="$(dirname "$DIR")"
|
||||
|
||||
# Allow user to override MAKE
|
||||
[ -n "${MAKE:+x}" ] || MAKE=$(command -v gnumake || command -v gmake || command -v make)
|
||||
readonly MAKE
|
||||
|
||||
usage() {
|
||||
echo "usage: ${0} [OPTIONS] [riscv-tools | esp-tools | ec2fast]"
|
||||
echo ""
|
||||
echo "Installation Types"
|
||||
echo " riscv-tools: if set, builds the riscv toolchain (this is also the default)"
|
||||
echo " esp-tools: if set, builds esp-tools toolchain used for the hwacha vector accelerator"
|
||||
echo " ec2fast: if set, pulls in a pre-compiled RISC-V toolchain for an EC2 manager instance"
|
||||
echo ""
|
||||
echo "Options"
|
||||
echo " --prefix PREFIX : Install destination. If unset, defaults to $(pwd)/riscv-tools-install"
|
||||
echo " or $(pwd)/esp-tools-install"
|
||||
echo " --ignore-qemu : Ignore installing QEMU"
|
||||
echo " --clean-after-install : Run make clean in calls to module_make and module_build"
|
||||
echo " --arch -a : Architecture (e.g., rv64gc)"
|
||||
echo " --help -h : Display this message"
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
error() {
|
||||
echo "${0##*/}: ${1}" >&2
|
||||
}
|
||||
die() {
|
||||
error "$1"
|
||||
exit "${2:--1}"
|
||||
}
|
||||
|
||||
TOOLCHAIN="riscv-tools"
|
||||
EC2FASTINSTALL="false"
|
||||
IGNOREQEMU=""
|
||||
CLEANAFTERINSTALL=""
|
||||
RISCV=""
|
||||
ARCH=""
|
||||
|
||||
# getopts does not support long options, and is inflexible
|
||||
while [ "$1" != "" ];
|
||||
do
|
||||
case $1 in
|
||||
-h | --help | help )
|
||||
usage 3 ;;
|
||||
-p | --prefix )
|
||||
shift
|
||||
RISCV=$(realpath $1) ;;
|
||||
--ignore-qemu )
|
||||
IGNOREQEMU="true" ;;
|
||||
-a | --arch )
|
||||
shift
|
||||
ARCH=$1 ;;
|
||||
--clean-after-install )
|
||||
CLEANAFTERINSTALL="true" ;;
|
||||
riscv-tools | esp-tools)
|
||||
TOOLCHAIN=$1 ;;
|
||||
ec2fast )
|
||||
EC2FASTINSTALL="true" ;;
|
||||
* )
|
||||
error "invalid option $1"
|
||||
usage 1 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "$RISCV" ] ; then
|
||||
INSTALL_DIR="$TOOLCHAIN-install"
|
||||
RISCV="$(pwd)/$INSTALL_DIR"
|
||||
fi
|
||||
|
||||
if [ -z "$ARCH" ] ; then
|
||||
XLEN=64
|
||||
elif [[ "$ARCH" =~ ^rv(32|64)((i?m?a?f?d?|g?)c?)$ ]]; then
|
||||
XLEN=${BASH_REMATCH[1]}
|
||||
else
|
||||
error "invalid arch $ARCH"
|
||||
usage 1
|
||||
fi
|
||||
|
||||
echo "Installing toolchain to $RISCV"
|
||||
|
||||
# install risc-v tools
|
||||
export RISCV="$RISCV"
|
||||
|
||||
cd "${CHIPYARD_DIR}"
|
||||
|
||||
SRCDIR="$(pwd)/toolchains/${TOOLCHAIN}"
|
||||
[ -d "${SRCDIR}" ] || die "unsupported toolchain: ${TOOLCHAIN}"
|
||||
. ./scripts/build-util.sh
|
||||
|
||||
|
||||
if [ "${EC2FASTINSTALL}" = true ] ; then
|
||||
[ "${TOOLCHAIN}" = 'riscv-tools' ] ||
|
||||
die "unsupported precompiled toolchain: ${TOOLCHAIN}"
|
||||
|
||||
echo '=> Fetching pre-built toolchain'
|
||||
module=toolchains/riscv-tools/riscv-gnu-toolchain-prebuilt
|
||||
git config --unset submodule."${module}".update || :
|
||||
git submodule update --init --depth 1 "${module}"
|
||||
|
||||
echo '==> Verifying toolchain version hash'
|
||||
# Find commit hash without initializing the submodule
|
||||
hashsrc="$(git ls-tree -d HEAD "${SRCDIR}/riscv-gnu-toolchain" | {
|
||||
unset IFS && read -r _ type obj _ &&
|
||||
test -n "${obj}" && test "${type}" = 'commit' && echo "${obj}"
|
||||
}; )" ||
|
||||
die 'failed to obtain riscv-gnu-toolchain submodule hash' "$?"
|
||||
|
||||
read -r hashbin < "${module}/HASH" ||
|
||||
die 'failed to obtain riscv-gnu-toolchain-prebuilt hash' "$?"
|
||||
|
||||
echo "==> ${hashsrc}"
|
||||
[ "${hashsrc}" = "${hashbin}" ] ||
|
||||
die "pre-built version mismatch: ${hashbin}"
|
||||
|
||||
echo '==> Installing pre-built toolchain'
|
||||
"${MAKE}" -C "${module}" DESTDIR="${RISCV}" install
|
||||
git submodule deinit "${module}" || :
|
||||
|
||||
else
|
||||
MAKE_VER=$("${MAKE}" --version) || true
|
||||
case ${MAKE_VER} in
|
||||
'GNU Make '[4-9]\.*)
|
||||
;;
|
||||
'GNU Make '[1-9][0-9])
|
||||
;;
|
||||
*)
|
||||
die 'obsolete make version; need GNU make 4.x or later'
|
||||
;;
|
||||
esac
|
||||
|
||||
module_prepare riscv-gnu-toolchain qemu
|
||||
module_build riscv-gnu-toolchain --prefix="${RISCV}" --with-cmodel=medany ${ARCH:+--with-arch=${ARCH}}
|
||||
echo '==> Building GNU/Linux toolchain'
|
||||
module_make riscv-gnu-toolchain linux
|
||||
fi
|
||||
|
||||
# disable boost explicitly for https://github.com/riscv-software-src/riscv-isa-sim/issues/834
|
||||
# since we don't have it in our requirements
|
||||
module_all riscv-isa-sim --prefix="${RISCV}" --with-boost=no --with-boost-asio=no --with-boost-regex=no
|
||||
# build static libfesvr library for linking into firesim driver (or others)
|
||||
echo '==> Installing libfesvr static library'
|
||||
module_make riscv-isa-sim libfesvr.a
|
||||
cp -p "${SRCDIR}/riscv-isa-sim/build/libfesvr.a" "${RISCV}/lib/"
|
||||
|
||||
CC= CXX= module_all riscv-pk --prefix="${RISCV}" --host=riscv${XLEN}-unknown-elf
|
||||
module_all riscv-tests --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --with-xlen=${XLEN}
|
||||
|
||||
# Common tools (not in any particular toolchain dir)
|
||||
|
||||
CC= CXX= SRCDIR="$(pwd)/toolchains" module_all libgloss --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --host=riscv${XLEN}-unknown-elf
|
||||
|
||||
if [ -z "$IGNOREQEMU" ] ; then
|
||||
echo "=> Starting qemu build"
|
||||
dir="$(pwd)/toolchains/qemu"
|
||||
echo "==> Initializing qemu submodule"
|
||||
#since we don't want to use the global config we init passing rewrite config in to the command
|
||||
git -c url.https://github.com/qemu.insteadOf=https://git.qemu.org/git submodule update --init --recursive "$dir"
|
||||
echo "==> Applying url-rewriting to avoid git.qemu.org"
|
||||
# and once the clones exist, we recurse through them and set the rewrite
|
||||
# in the local config so that any further commands by the user have the rewrite. uggh. git, why you so ugly?
|
||||
git -C "$dir" config --local url.https://github.com/qemu.insteadOf https://git.qemu.org/git
|
||||
git -C "$dir" submodule foreach --recursive 'git config --local url.https://github.com/qemu.insteadOf https://git.qemu.org/git'
|
||||
|
||||
# check to see whether the rewrite rules are needed any more
|
||||
# If you find git.qemu.org in any .gitmodules file below qemu, you still need them
|
||||
# the /dev/null redirection in the submodule grepping is to quiet non-existance of further .gitmodules
|
||||
! grep -q 'git\.qemu\.org' "$dir/.gitmodules" && \
|
||||
git -C "$dir" submodule foreach --quiet --recursive '! grep -q "git\.qemu\.org" .gitmodules 2>/dev/null' && \
|
||||
echo "==> PLEASE REMOVE qemu URL-REWRITING from scripts/build-toolchains.sh. It is no longer needed!" && exit 1
|
||||
|
||||
(
|
||||
# newer version of BFD-based ld has made '-no-pie' an error because it renamed to '--no-pie'
|
||||
# meanwhile, ld.gold will still accept '-no-pie'
|
||||
# QEMU 5.0 still uses '-no-pie' in it's linker options
|
||||
|
||||
# default LD to ld if it isn't set
|
||||
if ( set +o pipefail; ${LD:-ld} -no-pie |& grep 'did you mean --no-pie' >/dev/null); then
|
||||
echo "==> LD doesn't like '-no-pie'"
|
||||
# LD has the problem, look for ld.gold
|
||||
if type ld.gold >&/dev/null; then
|
||||
echo "==> Using ld.gold to link QEMU"
|
||||
export LD=ld.gold
|
||||
fi
|
||||
fi
|
||||
|
||||
# now actually do the build
|
||||
SRCDIR="$(pwd)/toolchains" module_build qemu --prefix="${RISCV}" --target-list=riscv${XLEN}-softmmu --disable-werror
|
||||
)
|
||||
fi
|
||||
|
||||
# make Dromajo
|
||||
git submodule update --init $CHIPYARD_DIR/tools/dromajo/dromajo-src
|
||||
make -C $CHIPYARD_DIR/tools/dromajo/dromajo-src/src
|
||||
|
||||
# create specific env.sh
|
||||
cat > "$CHIPYARD_DIR/env-$TOOLCHAIN.sh" <<EOF
|
||||
# auto-generated by build-toolchains.sh
|
||||
export CHIPYARD_TOOLCHAIN_SOURCED=1
|
||||
export RISCV=$(printf '%q' "$RISCV")
|
||||
export PATH=\${RISCV}/bin:\${PATH}
|
||||
export LD_LIBRARY_PATH=\${RISCV}/lib\${LD_LIBRARY_PATH:+":\${LD_LIBRARY_PATH}"}
|
||||
EOF
|
||||
|
||||
# create general env.sh
|
||||
echo "# line auto-generated by build-toolchains.sh" >> env.sh
|
||||
echo "source $(printf '%q' "$CHIPYARD_DIR/env-$TOOLCHAIN.sh")" >> env.sh
|
||||
echo "Toolchain Build Complete!"
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
sudo yum groupinstall -y "Development tools"
|
||||
sudo yum install -y gmp-devel mpfr-devel libmpc-devel zlib-devel vim git java java-devel
|
||||
|
||||
# Install SBT https://www.scala-sbt.org/release/docs/Installing-sbt-on-Linux.html#Red+Hat+Enterprise+Linux+and+other+RPM-based+distributions
|
||||
# sudo rm -f /etc/yum.repos.d/bintray-rpm.repo
|
||||
# Use rm above if sbt installed from bintray before.
|
||||
curl -L https://www.scala-sbt.org/sbt-rpm.repo > sbt-rpm.repo
|
||||
sudo mv sbt-rpm.repo /etc/yum.repos.d/
|
||||
|
||||
sudo yum install -y sbt texinfo gengetopt
|
||||
sudo yum install -y expat-devel libusb1-devel ncurses-devel cmake "perl(ExtUtils::MakeMaker)"
|
||||
# deps for poky
|
||||
sudo yum install -y python38 patch diffstat texi2html texinfo subversion chrpath git wget
|
||||
# deps for qemu
|
||||
sudo yum install -y gtk3-devel
|
||||
# deps for firemarshal
|
||||
sudo yum install -y python38-pip python38-devel rsync libguestfs-tools makeinfo expat ctags
|
||||
# Install GNU make 4.x (needed to cross-compile glibc 2.28+)
|
||||
sudo yum install -y centos-release-scl
|
||||
sudo yum install -y devtoolset-8-make
|
||||
# install DTC
|
||||
sudo yum install -y dtc
|
||||
sudo yum install -y python
|
||||
|
||||
# install verilator
|
||||
git clone http://git.veripool.org/git/verilator
|
||||
cd verilator
|
||||
git checkout v4.034
|
||||
autoconf && ./configure && make -j$(nproc) && sudo make install
|
||||
@@ -7,17 +7,24 @@ AXE_DIR=$(realpath ${SCRIPT_DIR}/../tools/axe)
|
||||
ROCKET_DIR=$(realpath ${SCRIPT_DIR}/../generators/rocket-chip)
|
||||
|
||||
TO_AXE=${ROCKET_DIR}/scripts/toaxe.py
|
||||
TO_AXE_PY3=/tmp/toaxe.py
|
||||
AXE=${AXE_DIR}/src/axe
|
||||
AXE_SHRINK=${AXE_DIR}/src/axe-shrink.py
|
||||
AXE_SHRINK_PY3=/tmp/axe-shrink.py
|
||||
|
||||
# TODO: convert scripts to py3 in src
|
||||
2to3 $TO_AXE -o /tmp -n -w
|
||||
sed -i '30d' $TO_AXE_PY3 # remove import sets
|
||||
2to3 $AXE_SHRINK -o /tmp -n -w
|
||||
|
||||
PATH=$PATH:${AXE_DIR}/src
|
||||
|
||||
grep '.*:.*#.*@' $1 > /tmp/clean-trace.txt
|
||||
python2 "$TO_AXE" /tmp/clean-trace.txt > /tmp/trace.axe
|
||||
python "$TO_AXE_PY3" /tmp/clean-trace.txt > /tmp/trace.axe
|
||||
result=$("$AXE" check wmo /tmp/trace.axe)
|
||||
|
||||
if [ "$result" != OK ]; then
|
||||
"$AXE_SHRINK" wmo /tmp/trace.axe
|
||||
"$AXE_SHRINK_PY3" wmo /tmp/trace.axe
|
||||
else
|
||||
echo OK
|
||||
fi
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
RDIR=$(pwd)
|
||||
scripts_dir="$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" >/dev/null 2>&1 && pwd )"
|
||||
RDIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
cd "${scripts_dir}/.."
|
||||
cd "$RDIR"
|
||||
|
||||
# Reenable the FireSim submodule
|
||||
git config --unset submodule.sims/firesim.update || true
|
||||
cd sims/firesim
|
||||
pushd sims/firesim
|
||||
./build-setup.sh "$@" --library --skip-validate
|
||||
cd "$RDIR"
|
||||
popd
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# exit script if any command fails
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# exit script if any command fails
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
@@ -4,27 +4,35 @@
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
SKIP_VALIDATE=false
|
||||
RDIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
# get helpful utilities
|
||||
source $RDIR/scripts/utils.sh
|
||||
|
||||
common_setup
|
||||
|
||||
function usage
|
||||
{
|
||||
echo "Usage: $0 [--skip-validate]"
|
||||
echo "Usage: $0 [--force]"
|
||||
echo "Initialize Chipyard submodules and setup initial env.sh script."
|
||||
echo ""
|
||||
echo " --skip-validate Skip prompt checking for tagged release"
|
||||
echo " --force -f : Skip prompt checking for tagged release"
|
||||
echo " --skip-validate : DEPRECATED: Same functionality as --force"
|
||||
}
|
||||
|
||||
FORCE=false
|
||||
while test $# -gt 0
|
||||
do
|
||||
case "$1" in
|
||||
--skip-validate)
|
||||
SKIP_VALIDATE=true;
|
||||
--force | -f | --skip-validate)
|
||||
FORCE=true;
|
||||
;;
|
||||
-h | -H | --help)
|
||||
-h | -H | --help | help)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
*) echo "ERROR: bad argument $1"
|
||||
*)
|
||||
echo "ERROR: bad argument $1"
|
||||
usage
|
||||
exit 2
|
||||
;;
|
||||
@@ -32,47 +40,52 @@ do
|
||||
shift
|
||||
done
|
||||
|
||||
# Check that git version is at least 1.7.8
|
||||
# check that git version is at least 1.7.8
|
||||
MYGIT=$(git --version)
|
||||
MYGIT=${MYGIT#'git version '} # Strip prefix
|
||||
case ${MYGIT} in
|
||||
[1-9]*) ;;
|
||||
*) echo 'warning: unknown git version' ;;
|
||||
[1-9]*)
|
||||
;;
|
||||
*)
|
||||
echo "WARNING: unknown git version"
|
||||
;;
|
||||
esac
|
||||
MINGIT="1.8.5"
|
||||
if [ "$MINGIT" != "$(echo -e "$MINGIT\n$MYGIT" | sort -V | head -n1)" ]; then
|
||||
echo "This script requires git version $MINGIT or greater. Exiting."
|
||||
false
|
||||
exit 4
|
||||
fi
|
||||
|
||||
# before doing anything verify that you are on a release branch/tag
|
||||
save_bash_options
|
||||
set +e
|
||||
tag=$(git describe --exact-match --tags)
|
||||
tag_ret_code=$?
|
||||
set -e
|
||||
if [ $tag_ret_code -ne 0 ]; then
|
||||
if [ "$SKIP_VALIDATE" = false ]; then
|
||||
read -p "WARNING: You are not on an official release of Chipyard."$'\n'"Type \"y\" to continue if this is intended, otherwise see https://chipyard.readthedocs.io/en/stable/Chipyard-Basics/Initial-Repo-Setup.html#setting-up-the-chipyard-repo: " validate
|
||||
[[ $validate == [yY] ]] || exit 3
|
||||
echo "Setting up non-official Chipyard release"
|
||||
git_tag=$(git describe --exact-match --tags)
|
||||
git_tag_rc=$?
|
||||
restore_bash_options
|
||||
if [ "$git_tag_rc" -ne 0 ]; then
|
||||
if [ "$FORCE" == false ]; then
|
||||
while true; do
|
||||
read -p "WARNING: You are not on an official release of Chipyard."$'\n'"Type \"y\" to continue if this is intended or \"n\" if not: " validate
|
||||
case "$validate" in
|
||||
y | Y)
|
||||
echo "Continuing on to setting up non-official Chipyard release repository"
|
||||
break
|
||||
;;
|
||||
n | N)
|
||||
error "See https://chipyard.readthedocs.io/en/stable/Chipyard-Basics/Initial-Repo-Setup.html#setting-up-the-chipyard-repo for setting up an official release of Chipyard. "
|
||||
exit 3
|
||||
;;
|
||||
*)
|
||||
error "Invalid response. Please type \"y\" or \"n\""
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
else
|
||||
echo "Setting up official Chipyard release: $tag"
|
||||
echo "Setting up official Chipyard release: $git_tag"
|
||||
fi
|
||||
|
||||
# On macOS, use GNU readlink from 'coreutils' package in Homebrew/MacPorts
|
||||
if [ "$(uname -s)" = "Darwin" ] ; then
|
||||
READLINK=greadlink
|
||||
else
|
||||
READLINK=readlink
|
||||
fi
|
||||
|
||||
# If BASH_SOURCE is undefined we may be running under zsh, in that case
|
||||
# provide a zsh-compatible alternative
|
||||
DIR="$(dirname "$($READLINK -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"
|
||||
CHIPYARD_DIR="$(dirname "$DIR")"
|
||||
|
||||
cd "$CHIPYARD_DIR"
|
||||
cd "$RDIR"
|
||||
|
||||
(
|
||||
# Blocklist of submodules to initially skip:
|
||||
@@ -84,9 +97,8 @@ cd "$CHIPYARD_DIR"
|
||||
# Call the given subcommand (shell function) on each submodule
|
||||
# path to temporarily exclude during the recursive update
|
||||
for name in \
|
||||
toolchains/*-tools/*/ \
|
||||
toolchains/*-tools/* \
|
||||
toolchains/libgloss \
|
||||
toolchains/qemu \
|
||||
generators/sha3 \
|
||||
generators/gemmini \
|
||||
sims/firesim \
|
||||
@@ -107,36 +119,40 @@ cd "$CHIPYARD_DIR"
|
||||
_unskip() { git config --local --unset-all "submodule.${1}.update" || : ; }
|
||||
|
||||
trap 'git_submodule_exclude _unskip' EXIT INT TERM
|
||||
set -x
|
||||
git_submodule_exclude _skip
|
||||
git submodule update --init --recursive #--jobs 8
|
||||
set +x
|
||||
(
|
||||
set -x
|
||||
git_submodule_exclude _skip
|
||||
git submodule update --init --recursive #--jobs 8
|
||||
)
|
||||
)
|
||||
|
||||
set -x
|
||||
(
|
||||
# Non-recursive clone to exclude riscv-linux
|
||||
git submodule update --init generators/sha3
|
||||
|
||||
# Non-recursive clone to exclude riscv-linux
|
||||
git submodule update --init generators/sha3
|
||||
# Non-recursive clone to exclude gemmini-software
|
||||
git submodule update --init generators/gemmini
|
||||
git -C generators/gemmini/ submodule update --init --recursive software/gemmini-rocc-tests
|
||||
|
||||
# Non-recursive clone to exclude gemmini-software
|
||||
git submodule update --init generators/gemmini
|
||||
git -C generators/gemmini/ submodule update --init --recursive software/gemmini-rocc-tests
|
||||
# Minimal non-recursive clone to initialize sbt dependencies
|
||||
git submodule update --init sims/firesim
|
||||
git config --local submodule.sims/firesim.update none
|
||||
|
||||
# Minimal non-recursive clone to initialize sbt dependencies
|
||||
git submodule update --init sims/firesim
|
||||
git config --local submodule.sims/firesim.update none
|
||||
|
||||
# Only shallow clone needed for basic SW tests
|
||||
git submodule update --init software/firemarshal
|
||||
|
||||
set +x
|
||||
# Only shallow clone needed for basic SW tests
|
||||
git submodule update --init software/firemarshal
|
||||
)
|
||||
|
||||
# Configure firemarshal to know where our firesim installation is
|
||||
if [ ! -f ./software/firemarshal/marshal-config.yaml ]; then
|
||||
echo "firesim-dir: '../../sims/firesim/'" > ./software/firemarshal/marshal-config.yaml
|
||||
fi
|
||||
|
||||
echo "# line auto-generated by init-submodules-no-riscv-tools.sh" >> env.sh
|
||||
echo '__DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"' >> env.sh
|
||||
echo "PATH=\$__DIR/bin:\$PATH" >> env.sh
|
||||
echo "PATH=\$__DIR/software/firemarshal:\$PATH" >> env.sh
|
||||
cat << EOT >> env.sh
|
||||
# line auto-generated by init-submodules-no-riscv-tools.sh
|
||||
__DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"
|
||||
PATH=\$__DIR/bin:\$PATH
|
||||
PATH=\$__DIR/software/firemarshal:\$PATH
|
||||
if [ -z \${CONDA_DEFAULT_ENV+x} ]; then
|
||||
echo "WARNING: No conda environment detected. Did you activate the conda environment (e.x. 'conda activate chipyard')?"
|
||||
fi
|
||||
EOT
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# exit script if any command fails
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
@@ -3,19 +3,9 @@
|
||||
set -e
|
||||
|
||||
# this should be run from chipyard repo top
|
||||
TOPDIR=$(pwd)
|
||||
RDIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
cd generators/cva6/src/main/resources/vsrc
|
||||
git submodule deinit cva6
|
||||
|
||||
cd $TOPDIR
|
||||
|
||||
cd toolchains/qemu/roms/
|
||||
git submodule deinit edk2
|
||||
cd ../
|
||||
rm -rf build
|
||||
|
||||
cd ../libgloss
|
||||
cd $RDIR/libgloss
|
||||
rm -rf build.log
|
||||
|
||||
cd ../riscv-tools/riscv-isa-sim/
|
||||
@@ -27,6 +17,5 @@ rm -rf build.log
|
||||
cd ../riscv-tests
|
||||
rm -rf build.log
|
||||
|
||||
cd $TOPDIR
|
||||
cd tools/api-config-chipsalliance
|
||||
cd $RDIR/tools/api-config-chipsalliance
|
||||
git config --local status.showUntrackedFiles no
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -x
|
||||
set -ex
|
||||
|
||||
RDIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
cd $RDIR
|
||||
|
||||
git rm generators/chipyard/src/main/scala/config/RocketSha3Configs.scala
|
||||
git rm -rf generators/sha3
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
sudo apt-get install -y build-essential bison flex software-properties-common curl
|
||||
sudo apt-get install -y libgmp-dev libmpfr-dev libmpc-dev zlib1g-dev vim default-jdk default-jre
|
||||
# install sbt: https://www.scala-sbt.org/release/docs/Installing-sbt-on-Linux.html#Ubuntu+and+other+Debian-based+distributions
|
||||
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
|
||||
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y sbt
|
||||
sudo apt-get install -y texinfo gengetopt
|
||||
sudo apt-get install -y libexpat1-dev libusb-dev libncurses5-dev cmake
|
||||
# deps for poky
|
||||
sudo apt-get install -y python3.8 patch diffstat texi2html texinfo subversion chrpath wget
|
||||
# deps for qemu
|
||||
sudo apt-get install -y libgtk-3-dev gettext
|
||||
# deps for firemarshal
|
||||
sudo apt-get install -y python3-pip python3.8-dev rsync libguestfs-tools expat ctags
|
||||
# install DTC
|
||||
sudo apt-get install -y device-tree-compiler
|
||||
sudo apt-get install -y python
|
||||
# install git >= 2.17
|
||||
sudo add-apt-repository ppa:git-core/ppa -y
|
||||
sudo apt-get update
|
||||
sudo apt-get install git -y
|
||||
|
||||
# install verilator
|
||||
sudo apt-get install -y autoconf
|
||||
git clone http://git.veripool.org/git/verilator
|
||||
cd verilator
|
||||
git checkout v4.034
|
||||
autoconf && ./configure && make -j$(nproc) && sudo make install
|
||||
55
scripts/utils.sh
Normal file
55
scripts/utils.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#/usr/bin/env bash
|
||||
|
||||
#######################################
|
||||
# Common setup. Init MacOS compatibility
|
||||
# variables.
|
||||
# Globals:
|
||||
# READLINK
|
||||
#######################################
|
||||
function common_setup
|
||||
{
|
||||
# On macOS, use GNU readlink from 'coreutils' package in Homebrew/MacPorts
|
||||
if [ "$(uname -s)" = "Darwin" ] ; then
|
||||
READLINK=greadlink
|
||||
else
|
||||
READLINK=readlink
|
||||
fi
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Error echo wrapper
|
||||
#######################################
|
||||
function error
|
||||
{
|
||||
echo "${0##*/}: ${1}" >&2
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Error then exit wrapper
|
||||
# Arguments:
|
||||
# string to print before exit
|
||||
# (optional) int error code
|
||||
#######################################
|
||||
function die
|
||||
{
|
||||
error "$1"
|
||||
exit "${2:--1}"
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Save bash options. Must be called
|
||||
# before a corresponding `restore_bash_options`.
|
||||
#######################################
|
||||
function save_bash_options
|
||||
{
|
||||
OLDSTATE=$(set +o)
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Restore bash options. Must be called
|
||||
# after a corresponding `save_bash_options`.
|
||||
#######################################
|
||||
function restore_bash_options
|
||||
{
|
||||
set +vx; eval "$OLDSTATE"
|
||||
}
|
||||
Reference in New Issue
Block a user