multiple images

This commit is contained in:
Peter McGoron 2023-05-29 14:39:02 -04:00
parent 06ca4bb653
commit d56383adba
6 changed files with 60 additions and 56 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
buildroot.tar.gz
buildroot/
f4pga/
litex/
opensbi/
upsilon/

View File

@ -1,37 +0,0 @@
FROM debian:bookworm
# FIXME: Very large User IDs cause ADD to not work properly. Use RUN
# instead.
ENV FPGA_FAM=xc7
ENV F4PGA_INSTALL_DIR=/home/user/f4pga
# Install base system and system user.
RUN apt-get update \
&& apt-get install -y git sudo wget xz-utils \
&& adduser --quiet --disabled-password user
USER user:user
WORKDIR /home/user
# Install F4PGA.
# FIXME: We need to either enable passwordless sudo for user (not good)
# or disable all instances of sudo. This hack works for this commit but
# might break in the future.
COPY --chown=user:user f4pga/scripts/prepare_environment.sh /home/user
RUN sed -i 's/sudo/#sudo/g' ./prepare_environment.sh \
&& ./prepare_environment.sh \
&& rm ./prepare_environment.sh
# Install LiteX. TODO: put in litex directory.
COPY --chown=user:user litex/litex_setup.py /home/user
WORKDIR /home/user
RUN chmod +x litex_setup.py \
&& bash -c '\
source ~/f4pga/xc7/conda/etc/profile.d/conda.sh; \
conda run -n xc7 ./litex_setup.py --init --install --user --tag=2023.04'
# Install Buildroot.
WORKDIR /home/user
COPY --chown=user:user buildroot.tar.gz /home/user
RUN tar -xvf buildroot.tar.gz && rm buildroot.tar.gz
USER root:root
RUN apt-get -y install build-essential gcc g++ sed make binutils diffutils bash patch gzip bzip2 perl tar cpio unzip rsync bc findutils wget

11
Dockerfile.buildroot Normal file
View File

@ -0,0 +1,11 @@
FROM debian:bookworm
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y git wget xz-utils build-essential gcc g++ sed make binutils diffutils bash patch gzip bzip2 perl tar cpio unzip rsync bc findutils wget python3 libncurses5-dev libncurses-dev file which \
&& adduser --quiet --disabled-password user
USER user:user
WORKDIR /home/user
COPY --chown=user:user buildroot.tar.gz /home/user
RUN tar -xvf buildroot.tar.gz && rm buildroot.tar.gz

26
Dockerfile.hardware Normal file
View File

@ -0,0 +1,26 @@
FROM debian:bookworm
ENV FPGA_FAM=xc7
ENV F4PGA_INSTALL_DIR=/home/user/f4pga
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y git wget python3 xz-utils bash verilator m4 \
&& adduser --quiet --disabled-password user
USER user:user
WORKDIR /home/user
COPY --chown=user:user f4pga/scripts/prepare_environment.sh /home/user
RUN sed -i 's/sudo/#sudo/g' ./prepare_environment.sh \
&& ./prepare_environment.sh \
&& rm ./prepare_environment.sh
COPY --chown=user:user litex/litex_setup.py /home/user
RUN mkdir /home/user/litex \
&& chmod +x litex_setup.py \
&& cd litex/ \
&& bash -c '\
source ~/f4pga/xc7/conda/etc/profile.d/conda.sh; \
conda run -n xc7 ../litex_setup.py --init --install --user --tag=2023.04' \
&& rm ../litex_setup.py

View File

@ -1,10 +1,9 @@
.PHONY: image f4pga buildroot litex clone help container attach
ADDED_FILES=f4pga/scripts/prepare_environment.sh litex/litex_setup.py buildroot.tar.gz
.PHONY: images f4pga buildroot litex clone help container attach hardware-image buildroot-image
help:
@echo 'compile commands (run in order)'
@echo 'make clone: clone repositories'
@echo 'make image: build docker image'
@echo 'make images: build docker images'
@echo 'make container: create docker container'
@echo
@echo 'run commands'
@ -13,8 +12,13 @@ help:
@echo 'clean commands'
@echo 'make clean-container: delete docker container'
image: ${ADDED_FILES}
docker build -t "upsilon-buildenv" .
hardware-image: f4pga/scripts/prepare_environment.sh litex/litex_setup.py
docker build -f Dockerfile.hardware -t "upsilon-hardware-env" .
buildroot-image: buildroot.tar.gz
docker build -f Dockerfile.buildroot -t "upsilon-buildroot-env" .
images: hardware-image buildroot-image
container:
docker run --name upsilon-container --volume .:/home/user/outside -it upsilon-buildenv /bin/bash -l

View File

@ -1,16 +1,13 @@
MagLab Upsilon development environment setup.
Upsilon development environment setup.
Written by Peter McGoron.
Preqreuisites
=============
# Preqreuisites
Rebinding Caps Lock to Escape
-----------------------------
## Rebinding Caps Lock to Escape
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:swapescape']"
Installing OpenFPGALoader
-------------------------
## Installing OpenFPGALoader
Then install [openFPGALoader][1]. This utility entered the Ubuntu repositories
in 23.04. Install and compile it if you do not have it. Install the udev rule
@ -18,8 +15,7 @@ so that admin access is not required to load FPGA bitstreams.
[1]: https://trabucayre.github.io/openFPGALoader/index.html
Setup Rootless Docker
---------------------
## Setup Rootless Docker
Docker allows you to run programs in containers, which are isolated
environments. Upsilon development (at the Maglab) uses Docker for
@ -33,12 +29,10 @@ If you have issues with docker, try adding to `~/.config/docker/daemon.json`
}
Download and Install Python3
----------------------------
## Download and Install Python3
Install `python3-venv` (or `python3-virtualenv`) and `python3-pip`.
Setup Build Environment
=======================
# Setup Build Environment
Run `make image container attach`.