Merge pull request #802 from darius-bluespec/build-toolchains-arch
Support specifying architecture when building tools.
This commit is contained in:
@@ -21,6 +21,7 @@ usage() {
|
|||||||
echo " --prefix PREFIX : Install destination. If unset, defaults to $(pwd)/riscv-tools-install"
|
echo " --prefix PREFIX : Install destination. If unset, defaults to $(pwd)/riscv-tools-install"
|
||||||
echo " or $(pwd)/esp-tools-install"
|
echo " or $(pwd)/esp-tools-install"
|
||||||
echo " --ignore-qemu : Ignore installing QEMU"
|
echo " --ignore-qemu : Ignore installing QEMU"
|
||||||
|
echo " --arch -a : Architecture (e.g., rv64gc)"
|
||||||
echo " --help -h : Display this message"
|
echo " --help -h : Display this message"
|
||||||
exit "$1"
|
exit "$1"
|
||||||
}
|
}
|
||||||
@@ -37,6 +38,7 @@ TOOLCHAIN="riscv-tools"
|
|||||||
EC2FASTINSTALL="false"
|
EC2FASTINSTALL="false"
|
||||||
IGNOREQEMU=""
|
IGNOREQEMU=""
|
||||||
RISCV=""
|
RISCV=""
|
||||||
|
ARCH=""
|
||||||
|
|
||||||
# getopts does not support long options, and is inflexible
|
# getopts does not support long options, and is inflexible
|
||||||
while [ "$1" != "" ];
|
while [ "$1" != "" ];
|
||||||
@@ -49,6 +51,9 @@ do
|
|||||||
RISCV=$(realpath $1) ;;
|
RISCV=$(realpath $1) ;;
|
||||||
--ignore-qemu )
|
--ignore-qemu )
|
||||||
IGNOREQEMU="true" ;;
|
IGNOREQEMU="true" ;;
|
||||||
|
-a | --arch )
|
||||||
|
shift
|
||||||
|
ARCH=$1 ;;
|
||||||
riscv-tools | esp-tools)
|
riscv-tools | esp-tools)
|
||||||
TOOLCHAIN=$1 ;;
|
TOOLCHAIN=$1 ;;
|
||||||
ec2fast )
|
ec2fast )
|
||||||
@@ -65,6 +70,15 @@ if [ -z "$RISCV" ] ; then
|
|||||||
RISCV="$(pwd)/$INSTALL_DIR"
|
RISCV="$(pwd)/$INSTALL_DIR"
|
||||||
fi
|
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"
|
echo "Installing toolchain to $RISCV"
|
||||||
|
|
||||||
# install risc-v tools
|
# install risc-v tools
|
||||||
@@ -118,7 +132,7 @@ else
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
module_prepare riscv-gnu-toolchain qemu
|
module_prepare riscv-gnu-toolchain qemu
|
||||||
module_build riscv-gnu-toolchain --prefix="${RISCV}" --with-cmodel=medany
|
module_build riscv-gnu-toolchain --prefix="${RISCV}" --with-cmodel=medany ${ARCH:+--with-arch=${ARCH}}
|
||||||
echo '==> Building GNU/Linux toolchain'
|
echo '==> Building GNU/Linux toolchain'
|
||||||
module_make riscv-gnu-toolchain linux
|
module_make riscv-gnu-toolchain linux
|
||||||
fi
|
fi
|
||||||
@@ -129,15 +143,15 @@ echo '==> Installing libfesvr static library'
|
|||||||
module_make riscv-isa-sim libfesvr.a
|
module_make riscv-isa-sim libfesvr.a
|
||||||
cp -p "${SRCDIR}/riscv-isa-sim/build/libfesvr.a" "${RISCV}/lib/"
|
cp -p "${SRCDIR}/riscv-isa-sim/build/libfesvr.a" "${RISCV}/lib/"
|
||||||
|
|
||||||
CC= CXX= module_all riscv-pk --prefix="${RISCV}" --host=riscv64-unknown-elf
|
CC= CXX= module_all riscv-pk --prefix="${RISCV}" --host=riscv${XLEN}-unknown-elf
|
||||||
module_all riscv-tests --prefix="${RISCV}/riscv64-unknown-elf"
|
module_all riscv-tests --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --with-xlen=${XLEN}
|
||||||
|
|
||||||
# Common tools (not in any particular toolchain dir)
|
# Common tools (not in any particular toolchain dir)
|
||||||
|
|
||||||
CC= CXX= SRCDIR="$(pwd)/toolchains" module_all libgloss --prefix="${RISCV}/riscv64-unknown-elf" --host=riscv64-unknown-elf
|
CC= CXX= SRCDIR="$(pwd)/toolchains" module_all libgloss --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --host=riscv${XLEN}-unknown-elf
|
||||||
|
|
||||||
if [ -z "$IGNOREQEMU" ] ; then
|
if [ -z "$IGNOREQEMU" ] ; then
|
||||||
SRCDIR="$(pwd)/toolchains" module_all qemu --prefix="${RISCV}" --target-list=riscv64-softmmu
|
SRCDIR="$(pwd)/toolchains" module_all qemu --prefix="${RISCV}" --target-list=riscv${XLEN}-softmmu
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make Dromajo
|
# make Dromajo
|
||||||
|
|||||||
Reference in New Issue
Block a user