Skip to content

Commit de32558

Browse files
committed
[Docker] [RISC-V] Install spike simulator
1 parent db51e51 commit de32558

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

docker/Dockerfile.ci_riscv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ RUN bash /install/ubuntu_download_xuantie_gcc_newlib.sh /opt/riscv/riscv64-unkno
9696
COPY install/ubuntu_download_csinn2_compute_lib.sh /install/ubuntu_download_csinn2_compute_lib.sh
9797
RUN bash /install/ubuntu_download_csinn2_compute_lib.sh
9898

99+
# Build spike (riscv-isa-sim) and proxy kernel (pk)
100+
COPY install/ubuntu_install_spike_sim.sh /install/ubuntu_install_spike_sim.sh
101+
RUN bash /install/ubuntu_install_spike_sim.sh /opt/riscv/riscv64-unknown-elf/
102+
99103
# Update PATH
100104
ENV PATH /opt/csi-nn2/tools/qemu/bin:$PATH
101105
ENV PATH /opt/riscv/riscv64-unknown-linux-gnu/bin:$PATH
102106
ENV PATH /opt/riscv/riscv64-unknown-elf/bin:$PATH
107+
ENV PATH /opt/riscv/spike/bin:$PATH
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/bin/bash
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
ubuntu_install_spike_sim.sh
6+
7+
# regarding copyright ownership. The ASF licenses this file
8+
# to you under the Apache License, Version 2.0 (the
9+
# "License"); you may not use this file except in compliance
10+
# with the License. You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing,
15+
# software distributed under the License is distributed on an
16+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
# KIND, either express or implied. See the License for the
18+
# specific language governing permissions and limitations
19+
# under the License.
20+
21+
set -e
22+
set -u
23+
set -o pipefail
24+
set -x
25+
26+
function show_usage() {
27+
cat <<EOF
28+
Usage: docker/install/ubuntu_install_spike_sim.sh <RISCV_PATH>
29+
RISCV_PATH is the installation path of the risc-v gcc.
30+
EOF
31+
}
32+
33+
if [ "$#" -lt 1 -o "$1" == "--help" -o "$1" == "-h" ]; then
34+
show_usage
35+
exit -1
36+
fi
37+
38+
export RISCV=$1
39+
export PATH=$RISCV/bin:$PATH
40+
shift
41+
42+
export DEBIAN_FRONTEND=noninteractive
43+
export TZ=Etc/UTC
44+
sudo ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
45+
echo $TZ > /etc/timezone
46+
47+
sudo apt-install-and-clear -y --no-install-recommends device-tree-compiler
48+
49+
# Install spike
50+
mkdir /tmp/spike
51+
cd /tmp/spike
52+
# TODO: freeze version?
53+
git clone https://github.com/riscv/riscv-isa-sim.git
54+
pushd riscv-isa-sim
55+
mkdir build
56+
cd build
57+
../configure --prefix=$RISCV --with-isa=RV32IMAC
58+
make -j`nproc`
59+
make install
60+
popd
61+
62+
# Install pk
63+
git clone https://github.com/riscv/riscv-pk.git
64+
pushd riscv-pk
65+
66+
# rv32imac
67+
mkdir build
68+
pushd build
69+
../configure --prefix=`pwd`/install --host=riscv64-unknown-elf --with-arch=rv32imac
70+
make -j`nproc`
71+
make install
72+
cp ./pk $RISCV/riscv64-unknown-elf/bin/pk
73+
popd
74+
75+
git status
76+
77+
# rv64imac
78+
mkdir build64
79+
pushd build64
80+
../configure --prefix=`pwd`/install --host=riscv64-unknown-elf --with-arch=rv64imac
81+
make -j`nproc`
82+
make install
83+
cp ./pk $RISCV/riscv64-unknown-elf/bin/pk64
84+
85+
# cleanup
86+
rm -rf /tmp/spike

0 commit comments

Comments
 (0)