-
Notifications
You must be signed in to change notification settings - Fork 668
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
Update dockerfiles #771
Update dockerfiles #771
Changes from 37 commits
53386ef
8e19b46
4253382
8141c71
77459a3
cfca224
fe1f7fe
7439191
3957282
ef84927
db7fafb
f5ae2e0
f25aa8d
3ba19bb
8300d9c
b528058
9b84682
49a76a6
a46c4e6
fa2da01
925bace
58665ea
500d2b8
e13266b
5e90372
e95e033
d2b3dca
7eb8f39
34e56d5
1f8b597
84cfc73
75bc39a
323394f
d7be658
788b22a
0f3a703
f06afa2
18aa600
d647534
9c650de
b12fa04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
### This is a full chipyard setup | ||
|
||
# BUILD BASE FOR CI | ||
|
||
FROM ubuntu:18.04 as base | ||
ARG CHIPYARD_HASH | ||
|
||
MAINTAINER https://groups.google.com/forum/#!forum/chipyard | ||
|
||
# Install dependencies for ubuntu-req.sh | ||
RUN apt-get update && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you add the |
||
curl \ | ||
git \ | ||
sudo | ||
|
||
# Stopping docker keyboard-config from disrupting ubuntu-req.sh | ||
RUN sudo DEBIAN_FRONTEND=noninteractive apt-get install -y keyboard-configuration && \ | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y console-setup | ||
|
||
# Adds a new user called riscvuser | ||
RUN groupadd --gid 3434 riscvuser \ | ||
&& useradd --uid 3434 --gid riscvuser --shell /bin/bash --create-home riscvuser \ | ||
&& echo 'riscvuser ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-riscvuser \ | ||
&& echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep | ||
|
||
WORKDIR /home/riscvuser | ||
USER riscvuser | ||
|
||
# Update PATH for RISCV toolchain (note: hardcoded for CircleCI) | ||
ENV RISCV="/home/riscvuser/riscv-tools-install" | ||
ENV LD_LIBRARY_PATH="$RISCV/lib" | ||
ENV PATH="$RISCV/bin:$PATH" | ||
|
||
# Install Chipyard and run ubuntu-req.sh to install necessary dependencies | ||
RUN git clone https://github.com/ucb-bar/chipyard.git && \ | ||
cd chipyard && \ | ||
git checkout $CHIPYARD_HASH && \ | ||
./scripts/ubuntu-req.sh 1>/dev/null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this runs |
||
|
||
|
||
# BUILD IMAGE WITH TOOLCHAINS | ||
|
||
# Use above build as base | ||
FROM base as base-with-tools | ||
|
||
# Init submodules | ||
RUN cd chipyard && \ | ||
export MAKEFLAGS=-"j $(nproc)" && \ | ||
./scripts/init-submodules-no-riscv-tools.sh 1>/dev/null | ||
|
||
# Install riscv-tools | ||
RUN cd chipyard && \ | ||
export MAKEFLAGS=-"j $(nproc)" && \ | ||
./scripts/build-toolchains.sh riscv-tools 1>/dev/null | ||
|
||
# Install esp-tools | ||
RUN cd chipyard && \ | ||
export MAKEFLAGS=-"j $(nproc)" && \ | ||
./scripts/build-toolchains.sh esp-tools 1>/dev/null | ||
|
||
# Run script to set environment variables on entry | ||
ENTRYPOINT ["chipyard/scripts/entrypoint.sh"] | ||
|
||
# END IMAGE CUSTOMIZATIONS | ||
|
||
CMD ["/bin/sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
General | ||
------- | ||
This DockerFile contains the necessary steps to build a Docker container that can run | ||
abejgonzalez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
projects with riscv-tools, chisel3, firrtl, and verilator. When run up to the base stage, it installs the necessary | ||
apt-get packages and sets the environment variables needed for CircleCI. When run up to the base-with-tools stage, it initializes and installs the necessary toolchains for running simulations and testing projects. | ||
|
||
Build and Deploy the Container | ||
------------------------------ | ||
|
||
sudo docker build --target base . # to build the image for the CI | ||
sudo docker build --target base --build-arg CHIPYARD_HASH=<COMMIT_HASH> . # to build the image for the CI from a specific chipyard commit | ||
sudo docker build --target base-with-tools . # to build the full image | ||
sudo docker tag <IMAGE_ID> <PATH_NAME>:tag . # to tag the image after the build (ex. 0.0.3) | ||
sudo docker login # login into the account to push to | ||
sudo docker push <PATH_NAME>:tag # to push to repo with tag | ||
sudo docker run -it <IMAGE_ID> bash # to run an interactive version of the container | ||
|
||
Path Names | ||
---------- | ||
Older docker images (when this Dockerfile was in `riscv-boom/riscv-boom`) can be found in the <PATH_NAME> `riscvboom/riscvboom-images`. | ||
Current up-to-date images are located in <PATH_NAME> `ucbbar/chipyard-image`. NOTE: Less recent images in this path may not have toolchains initialized | ||
Current up-to-date CI images are located in <PATH_NAME> `ucbbar/chipyard-ci-image`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ sudo yum install -y centos-release-scl | |
sudo yum install -y devtoolset-8-make | ||
# install DTC | ||
sudo yum install -y dtc | ||
sudo yum install -y python | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few lines above there is a python36, python36-pip and python36-devel installation. Is this python installation for an earlier or later version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would ideally be for a earlier version. I added this because there was a bug I ran into with ubuntu-req.sh where one of the tests was looking for python2 instead of python3. I don't know a way to test on centos, so I'm not entirely sure if the bug would still occur there, so I added it just in case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which test was looking for python2? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was both of the tracegen tests. |
||
|
||
# install verilator | ||
git clone http://git.veripool.org/git/verilator | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# used with the dockerfile to set up enviroment variables by running env.sh | ||
# adapted from https://stackoverflow.com/questions/55921914/how-to-source-a-script-with-environment-variables-in-a-docker-build-process | ||
|
||
. /home/riscvuser/chipyard/env.sh | ||
|
||
exec "$@" |
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.
(sorry for chiming in so late)
Usually, you don't actually want to run
apt-get upgrade
on a Docker container. From this page: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.
Thanks for the tip. I was able to remove
apt-get upgrade
without any problems.