forked from Github_Repos/cvw
		
	Merge remote-tracking branch 'upstream/main'
This commit is contained in:
		
						commit
						e6e4c7957c
					
				@ -67,9 +67,9 @@ The script installs the open source tools to /opt/riscv by default.  This can be
 | 
			
		||||
 | 
			
		||||
	$ sudo wally-tool-chain-install.sh <optional, install directory, defaults to /opt/riscv>
 | 
			
		||||
 | 
			
		||||
## Detailed Tool-chain Install Guide
 | 
			
		||||
## Detailed Toolchain Install Guide
 | 
			
		||||
 | 
			
		||||
   Section 2.1 described Wally platform requirements and Section 2.2 describes how a user gets started using Wally on a Linux server.  This appendix describes how the system administrator installs RISC-V tools.  Superuser privileges are necessary for many of the tools. Setting up all of the tools can be time-consuming and fussy, so this appendix also describes a fallback flow with Docker and Podman.  
 | 
			
		||||
This section describes how to install the tools needed for CORE-V-Wally. Superuser privileges are necessary for many of the tools. Setting up all of the tools can be time-consuming and fussy, so Appendix D also describes an option with a Docker container.  
 | 
			
		||||
 | 
			
		||||
### Open Source Software Installation
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										107
									
								
								addins/docker/Dockerfile
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										107
									
								
								addins/docker/Dockerfile
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,107 @@
 | 
			
		||||
# Compliance Development Environment Image
 | 
			
		||||
FROM debian
 | 
			
		||||
 | 
			
		||||
# UPDATE / UPGRADE
 | 
			
		||||
RUN apt update
 | 
			
		||||
 | 
			
		||||
# INSTALL
 | 
			
		||||
RUN apt install -y git gawk make texinfo bison flex build-essential python libz-dev libexpat-dev autoconf device-tree-compiler ninja-build libpixman-1-dev build-essential ncurses-base ncurses-bin libncurses5-dev dialog curl wget ftp libgmp-dev python3-pip pkg-config libglib2.0-dev opam  build-essential z3 pkg-config zlib1g-dev verilator cpio bc vim emacs gedit nano
 | 
			
		||||
 | 
			
		||||
RUN pip3 install chardet==3.0.4
 | 
			
		||||
RUN pip3 install urllib3==1.22
 | 
			
		||||
RUN pip3 install testresources
 | 
			
		||||
RUN pip3 install riscof --ignore-installed PyYAML
 | 
			
		||||
RUN echo "root:wally" | chpasswd
 | 
			
		||||
 | 
			
		||||
# ADD RISCV
 | 
			
		||||
WORKDIR /opt/riscv
 | 
			
		||||
 | 
			
		||||
# Create a user group 'xyzgroup'
 | 
			
		||||
ARG USERNAME=cad
 | 
			
		||||
ARG USER_UID=1000
 | 
			
		||||
ARG USER_GID=$USER_UID
 | 
			
		||||
 | 
			
		||||
# Create the user
 | 
			
		||||
RUN groupadd --gid $USER_GID $USERNAME \
 | 
			
		||||
    && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
 | 
			
		||||
    # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
 | 
			
		||||
    && apt-get update \
 | 
			
		||||
    && apt-get install -y sudo \
 | 
			
		||||
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
 | 
			
		||||
    && chmod 0440 /etc/sudoers.d/$USERNAME
 | 
			
		||||
 | 
			
		||||
# Change RISCV user
 | 
			
		||||
run chown -Rf cad:cad /opt
 | 
			
		||||
 | 
			
		||||
# Add cad user
 | 
			
		||||
USER $USERNAME
 | 
			
		||||
 | 
			
		||||
# SET ENVIRONMENT VARIABLES
 | 
			
		||||
ENV RISCV=/opt/riscv
 | 
			
		||||
ENV PATH=$PATH:$RISCV/bin
 | 
			
		||||
 | 
			
		||||
# TOOLCHAIN
 | 
			
		||||
RUN git clone https://github.com/riscv/riscv-gnu-toolchain && \
 | 
			
		||||
    cd riscv-gnu-toolchain && \
 | 
			
		||||
    ./configure --prefix=${RISCV} --enable-multilib --with-multilib-generator="rv32e-ilp32e--;rv32i-ilp32--;rv32im-ilp32--;rv32iac-ilp32--;rv32imac-ilp32--;rv32imafc-ilp32f--;rv32imafdc-ilp32d--;rv64i-lp64--;rv64ic-lp64--;rv64iac-lp64--;rv64imac-lp64--;rv64imafdc-lp64d--;rv64im-lp64--;" && \
 | 
			
		||||
    make --jobs && \
 | 
			
		||||
    make install
 | 
			
		||||
 | 
			
		||||
# elf2hex
 | 
			
		||||
ENV PATH=$RISCV/riscv-gnu-toolchain/bin:$PATH
 | 
			
		||||
WORKDIR /opt/riscv
 | 
			
		||||
RUN git clone https://github.com/sifive/elf2hex.git && \
 | 
			
		||||
  cd elf2hex && \
 | 
			
		||||
  autoreconf -i && \
 | 
			
		||||
  ./configure --target=riscv64-unknown-elf --prefix=$RISCV && \
 | 
			
		||||
  make && \
 | 
			
		||||
  make install
 | 
			
		||||
 | 
			
		||||
# QEMU
 | 
			
		||||
WORKDIR /opt/riscv
 | 
			
		||||
RUN git clone --recurse-submodules https://github.com/qemu/qemu && \
 | 
			
		||||
  cd qemu && \
 | 
			
		||||
  ./configure --target-list=riscv64-softmmu --prefix=$RISCV  && \
 | 
			
		||||
  make --jobs && \
 | 
			
		||||
  make install
 | 
			
		||||
 | 
			
		||||
# Spike
 | 
			
		||||
WORKDIR /opt/riscv
 | 
			
		||||
RUN git clone https://github.com/riscv-software-src/riscv-isa-sim && \
 | 
			
		||||
  mkdir riscv-isa-sim/build && \
 | 
			
		||||
  cd riscv-isa-sim/build && \
 | 
			
		||||
  ../configure --prefix=$RISCV --enable-commitlog && \
 | 
			
		||||
  make --jobs && \
 | 
			
		||||
  make install  && \
 | 
			
		||||
  cd ../arch_test_target/spike/device && \
 | 
			
		||||
  sed -i 's/--isa=rv32ic/--isa=rv32iac/' rv32i_m/privilege/Makefile.include && \
 | 
			
		||||
  sed -i 's/--isa=rv64ic/--isa=rv64iac/' rv64i_m/privilege/Makefile.include
 | 
			
		||||
 | 
			
		||||
# SAIL
 | 
			
		||||
WORKDIR /opt/riscv
 | 
			
		||||
RUN opam init -y --disable-sandboxing
 | 
			
		||||
RUN opam switch create ocaml-base-compiler.4.06.1
 | 
			
		||||
RUN opam install sail -y
 | 
			
		||||
RUN eval $(opam config env) && \
 | 
			
		||||
 cd $RISCV && \
 | 
			
		||||
 git clone https://github.com/riscv/sail-riscv.git && \
 | 
			
		||||
 cd sail-riscv && \
 | 
			
		||||
 make && \
 | 
			
		||||
 ARCH=RV32 make && \
 | 
			
		||||
 ARCH=RV64 make && \
 | 
			
		||||
 ln -s $RISCV/sail-riscv/c_emulator/riscv_sim_RV64 $RISCV/bin/riscv_sim_RV64 && \
 | 
			
		||||
 ln -s $RISCV/sail-riscv/c_emulator/riscv_sim_RV32 $RISCV/bin/riscv_sim_RV32
 | 
			
		||||
 | 
			
		||||
# Buildroot
 | 
			
		||||
WORKDIR /opt/riscv
 | 
			
		||||
RUN git clone --recurse-submodules https://github.com/openhwgroup/cvw.git
 | 
			
		||||
ENV export WALLY=/opt/riscv/riscv-wally
 | 
			
		||||
RUN git clone https://github.com/buildroot/buildroot.git && \
 | 
			
		||||
  cd buildroot && \
 | 
			
		||||
  git checkout 2021.05 && \
 | 
			
		||||
  cp -r /opt/riscv/riscv-wally/linux/buildroot-config-src/wally ./board && \
 | 
			
		||||
  cp ./board/wally/main.config .config && \
 | 
			
		||||
  make --jobs
 | 
			
		||||
 | 
			
		||||
# change to cad's hometown
 | 
			
		||||
WORKDIR /home/cad
 | 
			
		||||
							
								
								
									
										48
									
								
								addins/docker/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								addins/docker/README.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
			
		||||
Installing Wally, RISC-V tools, and Imperas tests from source gives you maximum control, but has several disadvantages:
 | 
			
		||||
 | 
			
		||||
-Building the executables takes several hours.
 | 
			
		||||
-Linux is poorly standardized, and the build steps might not work on your version
 | 
			
		||||
-The source files are constantly changing, and the versions you download might not be compatible with this textbook flow.
 | 
			
		||||
 | 
			
		||||
Docker is a tools to run applications in a prepackaged container
 | 
			
		||||
including all of the operating system support required.  Wally offers
 | 
			
		||||
a ~30GB container image with the open-source tools pre-installed from
 | 
			
		||||
Section D.1. In particular, using the container solves the long build
 | 
			
		||||
time for gcc and the fussy installation of sail. The container runs on
 | 
			
		||||
any platform supporting Docker, including Windows and Mac as well as
 | 
			
		||||
Linux.  It can access files outside the container, including local
 | 
			
		||||
installation of CAD tools such as Questa, and a local clone of the
 | 
			
		||||
core-v-wally repository.
 | 
			
		||||
 | 
			
		||||
Docker can be run on most operating systems, including Linux, Windows,
 | 
			
		||||
and Mac. The Wally Docker container is hosted at DockerHub
 | 
			
		||||
(http://docker.io).
 | 
			
		||||
 | 
			
		||||
Podman is a more secure and easier-to-use variation of Docker for
 | 
			
		||||
Linux developed by RedHat.  Both Docker and Podman run the same
 | 
			
		||||
containers.
 | 
			
		||||
 | 
			
		||||
This directory has a copy of the file utilized to create the Docker
 | 
			
		||||
for the toolchain discussed in the text. To build this docker, you can
 | 
			
		||||
type the following where the last argument is the name where you want
 | 
			
		||||
to store your docker.
 | 
			
		||||
 | 
			
		||||
docker build -t docker.io/wallysoc/wally-docker:latest .
 | 
			
		||||
 | 
			
		||||
This can also be changed if you make a mistake by using the tag
 | 
			
		||||
command.  For example, if I wanted to change my docker from
 | 
			
		||||
wally-docker to wally-docker2, I would type:
 | 
			
		||||
 | 
			
		||||
docker tag wallysoc/wally-docker:latest docker.io/wallysoc/wally-docker2:latest
 | 
			
		||||
 | 
			
		||||
Once you build your docker, you can run it as given in the Readme.
 | 
			
		||||
However, you can also push it to DockerHub with the following command.
 | 
			
		||||
 | 
			
		||||
docker push docker.io/wallysoc/wally-docker:latest
 | 
			
		||||
 | 
			
		||||
To run your docker, you can type the following at a command prompt or
 | 
			
		||||
terminal.
 | 
			
		||||
 | 
			
		||||
docker run -it -p 8080:8080 docker.io/wallysoc/wally-docker
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user