-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Docker][CI][RISC-V] Build riscv-isa-sim (spike) in ci_riscv Docker i…
…mage to enable RISC-V unit testing (#12534) * Remove CSI-NN from ci_cortexm docker image * [Docker] [RISC-V] Split up CSI-NN2 installation script into several files [Docker] [RISC-V] move gcc toolchain installation out of csi-nn2 script [Docker] [RISC-V] move qemu installation out of csi-nn2 script * use updated version of qemu * [Docker] [RISC-V] Install newlib (baremetal) gcc toolchain * [Docker] [RISC-V] Install spike simulator * [Docker] move initialization of timezone and DEBIAN_FRONTEND to ubuntu_install_core.sh script
- Loading branch information
Showing
10 changed files
with
288 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
ubuntu_install_spike_sim.sh | ||
|
||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software 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. | ||
|
||
set -e | ||
set -u | ||
set -o pipefail | ||
|
||
function show_usage() { | ||
cat <<EOF | ||
Usage: docker/install/ubuntu_download_xuantie_gcc_linux.sh <INSTALLATION_PATH> | ||
INSTALLATION_PATH is the installation path for the toolchain. | ||
EOF | ||
} | ||
|
||
if [ "$#" -lt 1 -o "$1" == "--help" -o "$1" == "-h" ]; then | ||
show_usage | ||
exit 1 | ||
fi | ||
|
||
INSTALLATION_PATH=$1 | ||
shift | ||
|
||
# Create installation path directory | ||
mkdir -p "${INSTALLATION_PATH}" | ||
|
||
# Download and extract RISC-V gcc | ||
RISCV_GCC_VERSION="2.6.0" | ||
RISCV_GCC_ID="1659325511536" | ||
RISCV_GCC_KERNEL_VERSION="5.10.4" | ||
RISCV_GCC_DATE="20220715" | ||
RISCV_GCC_ARCH="x86_64" | ||
RISCV_GCC_BASE="Xuantie-900-gcc-linux-${RISCV_GCC_KERNEL_VERSION}-glibc-${RISCV_GCC_ARCH}-V${RISCV_GCC_VERSION}-${RISCV_GCC_DATE}" | ||
RISCV_GCC_EXT="tar.gz" | ||
RISCV_GCC_URL="https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//${RISCV_GCC_ID}/${RISCV_GCC_BASE}.${RISCV_GCC_EXT}" | ||
DOWNLOAD_PATH="/tmp/${RISCV_GCC_BASE}.${RISCV_GCC_EXT}" | ||
|
||
wget ${RISCV_GCC_URL} -O "${DOWNLOAD_PATH}" | ||
tar -xf "${DOWNLOAD_PATH}" -C "${INSTALLATION_PATH}" --strip-components=1 | ||
rm $DOWNLOAD_PATH | ||
echo "SUCCESS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
ubuntu_install_spike_sim.sh | ||
|
||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software 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. | ||
|
||
set -e | ||
set -u | ||
set -o pipefail | ||
|
||
function show_usage() { | ||
cat <<EOF | ||
Usage: docker/install/ubuntu_download_xuantie_gcc_newlib.sh <INSTALLATION_PATH> | ||
INSTALLATION_PATH is the installation path for the toolchain. | ||
EOF | ||
} | ||
|
||
if [ "$#" -lt 1 -o "$1" == "--help" -o "$1" == "-h" ]; then | ||
show_usage | ||
exit 1 | ||
fi | ||
|
||
INSTALLATION_PATH=$1 | ||
shift | ||
|
||
# Create installation path directory | ||
mkdir -p "${INSTALLATION_PATH}" | ||
|
||
# Download and extract RISC-V gcc | ||
RISCV_GCC_VERSION="2.6.0" | ||
RISCV_GCC_ID="1659318201401" | ||
RISCV_GCC_DATE="20220715" | ||
RISCV_GCC_ARCH="x86_64" | ||
RISCV_GCC_BASE="Xuantie-900-gcc-elf-newlib-${RISCV_GCC_ARCH}-V${RISCV_GCC_VERSION}-${RISCV_GCC_DATE}" | ||
RISCV_GCC_EXT="tar.gz" | ||
# extra forward slash is required somehow | ||
RISCV_GCC_URL="https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//${RISCV_GCC_ID}/${RISCV_GCC_BASE}.${RISCV_GCC_EXT}" | ||
DOWNLOAD_PATH="/tmp/${RISCV_GCC_BASE}.${RISCV_GCC_EXT}" | ||
|
||
wget ${RISCV_GCC_URL} -O "${DOWNLOAD_PATH}" | ||
tar -xf "${DOWNLOAD_PATH}" -C "${INSTALLATION_PATH}" --strip-components=1 | ||
rm $DOWNLOAD_PATH | ||
echo "SUCCESS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software 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. | ||
|
||
set -e | ||
set -u | ||
set -o pipefail | ||
|
||
function show_usage() { | ||
cat <<EOF | ||
Usage: docker/install/ubuntu_download_xuantie_qemu.sh <INSTALLATION_PATH> | ||
INSTALLATION_PATH is the installation path for the tool. | ||
EOF | ||
} | ||
|
||
if [ "$#" -lt 1 -o "$1" == "--help" -o "$1" == "-h" ]; then | ||
show_usage | ||
exit 1 | ||
fi | ||
|
||
INSTALLATION_PATH=$1 | ||
|
||
# Create installation path directory | ||
mkdir -p "${INSTALLATION_PATH}" | ||
|
||
QEMU_DATE="20220623-0307" | ||
QEMU_SOURCE_ID="1655972947885" | ||
QEMU_ARCH="x86_64-Ubuntu-18.04" | ||
QEMU_BASE="xuantie-qemu-${QEMU_ARCH}-${QEMU_DATE}" | ||
QEMU_EXT="tar.gz" | ||
QEMU_URL="https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//${QEMU_SOURCE_ID}/${QEMU_BASE}.${QEMU_EXT}" | ||
DOWNLOAD_PATH="/tmp/${QEMU_BASE}.${QEMU_EXT}" | ||
|
||
wget ${QEMU_URL} -O "${DOWNLOAD_PATH}" | ||
tar -xf "${DOWNLOAD_PATH}" -C "${INSTALLATION_PATH}" --strip-components=1 | ||
rm $DOWNLOAD_PATH | ||
|
||
# Remove non riscv64 binaries? (TODO) | ||
# ls $INSTALLATION_PATH/bin | grep -v qemu-riscv64 | xargs -i rm -rf $INSTALLATION_PATH/bin/{} | ||
# ls $INSTALLATION_PATH | grep -v bin | xargs -i rm -rf $INSTALLATION_PATH/{} | ||
|
||
echo "SUCCESS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
ubuntu_install_spike_sim.sh | ||
|
||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software 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. | ||
|
||
set -e | ||
set -u | ||
set -o pipefail | ||
set -x | ||
|
||
function show_usage() { | ||
cat <<EOF | ||
Usage: docker/install/ubuntu_install_spike_sim.sh <RISCV_PATH> | ||
RISCV_PATH is the installation path of the risc-v gcc. | ||
EOF | ||
} | ||
|
||
if [ "$#" -lt 1 -o "$1" == "--help" -o "$1" == "-h" ]; then | ||
show_usage | ||
exit -1 | ||
fi | ||
|
||
export RISCV=$1 | ||
export PATH=$RISCV/bin:$PATH | ||
shift | ||
|
||
sudo apt-install-and-clear -y --no-install-recommends device-tree-compiler | ||
|
||
# Install spike | ||
mkdir /tmp/spike | ||
cd /tmp/spike | ||
# TODO: freeze version? | ||
git clone https://github.com/riscv/riscv-isa-sim.git | ||
pushd riscv-isa-sim | ||
mkdir build | ||
cd build | ||
../configure --prefix=$RISCV --with-isa=RV32IMAC | ||
make -j`nproc` | ||
make install | ||
popd | ||
|
||
# Install pk | ||
git clone https://github.com/riscv/riscv-pk.git | ||
pushd riscv-pk | ||
|
||
# rv32imac | ||
mkdir build | ||
pushd build | ||
../configure --prefix=`pwd`/install --host=riscv64-unknown-elf --with-arch=rv32imac | ||
make -j`nproc` | ||
make install | ||
cp ./pk $RISCV/riscv64-unknown-elf/bin/pk | ||
popd | ||
|
||
git status | ||
|
||
# rv64imac | ||
mkdir build64 | ||
pushd build64 | ||
../configure --prefix=`pwd`/install --host=riscv64-unknown-elf --with-arch=rv64imac | ||
make -j`nproc` | ||
make install | ||
cp ./pk $RISCV/riscv64-unknown-elf/bin/pk64 | ||
|
||
# cleanup | ||
rm -rf /tmp/spike |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters