-
Notifications
You must be signed in to change notification settings - Fork 668
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #771 from ucb-bar/update-dockerfiles
Update dockerfiles
- Loading branch information
Showing
9 changed files
with
118 additions
and
238 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,67 @@ | ||
### 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 && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
curl \ | ||
git \ | ||
sudo \ | ||
ca-certificates \ | ||
keyboard-configuration \ | ||
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 && \ | ||
sudo rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
# 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"] |
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,22 @@ | ||
General | ||
------- | ||
This DockerFile contains the necessary steps to build a Docker container that can run | ||
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`. |
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,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 "$@" |
Oops, something went wrong.