-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Docker][CI][RISC-V] Build riscv-isa-sim (spike) in ci_riscv Docker image to enable RISC-V unit testing #12534
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f99385c
Remove CSI-NN from ci_cortexm docker image
PhilippvK f13a37f
[Docker] [RISC-V] Split up CSI-NN2 installation script into several f…
PhilippvK 828aac1
use updated version of qemu
PhilippvK 589d809
[Docker] [RISC-V] Install newlib (baremetal) gcc toolchain
PhilippvK 0b2b2b4
[Docker] [RISC-V] Install spike simulator
PhilippvK f17e2b4
[Docker] move initialization of timezone and DEBIAN_FRONTEND to ubunt…
PhilippvK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slight pref for nproc - 1, in case you're locally building.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I forgot to fix this... sorry for that, we can change it in a later commit.