Skip to content
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

Containers: update environment #1167

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
52 changes: 39 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
FROM debian:bullseye-backports
# First construct an image where the toolchain gets built

FROM debian:bullseye-backports AS mimiker-toolchain

WORKDIR /root
# Install build dependencies for toolchain
RUN apt-get update -q \
&& apt-get upgrade -q -y \
&& apt-get install -q -y --no-install-recommends \
automake bison ca-certificates curl flex gcc g++ gettext lhasa \
libtool make patch pkg-config python3 python3-setuptools quilt \
texinfo xz-utils zip libpython3-dev debhelper fakeroot ninja-build \
libglib2.0-dev libfdt-dev libpixman-1-dev \
&& rm -rf /var/lib/apt/lists/*
COPY ./toolchain /root/toolchain
# Build toolchain & save .deb packages into /root/deb
RUN cd /root/toolchain/gnu \
&& make -j $(nproc) \
&& cd /root/toolchain/qemu-mimiker \
&& make -j $(nproc) \
&& mkdir /root/deb \
&& find /root/toolchain -iname '*.deb' -exec mv -t /root/deb {} + \
&& rm -rf /root/toolchain

# Now construct an image for end users and Mimiker continuous integration
FROM debian:bullseye-backports AS mimiker-ci

RUN apt-get -q update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \
WORKDIR /root
COPY requirements.txt .
COPY --from=mimiker-toolchain /root/deb /root/deb
RUN apt-get update -q \
&& apt-get upgrade -q -y \
&& apt-get install -q -y --no-install-recommends \
git make cpio curl universal-ctags cscope socat patch gperf quilt \
bmake byacc python3-pip clang clang-format device-tree-compiler tmux \
libfdt1 libpython3.9 libsdl2-2.0-0 libglib2.0-0 libpixman-1-0
# patch & quilt required by lua and programs in contrib/
libfdt1 libpython3.9 libsdl2-2.0-0 libglib2.0-0 libpixman-1-0 \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install setuptools wheel \
&& pip3 install -r requirements.txt \
&& dpkg -i --force-all /root/deb/*.deb \
&& apt-get update -q \
&& apt-get install -q -y -f \
&& rm -rf /var/lib/apt/lists/* /root/deb /root/requirements.txt
# patch & quilt required by programs in contrib/
# gperf required by libterminfo
# socat & tmux required by launch
COPY requirements.txt .
RUN pip3 install setuptools wheel && pip3 install -r requirements.txt
RUN curl -O https://mimiker.ii.uni.wroc.pl/download/mipsel-mimiker-elf_1.5.3_amd64.deb && \
dpkg -i mipsel-mimiker-elf_1.5.3_amd64.deb && rm -f mipsel-mimiker-elf_1.5.3_amd64.deb
RUN curl -O https://mimiker.ii.uni.wroc.pl/download/aarch64-mimiker-elf_1.5.3_amd64.deb && \
dpkg -i aarch64-mimiker-elf_1.5.3_amd64.deb && rm -f aarch64-mimiker-elf_1.5.3_amd64.deb
RUN curl -O https://mimiker.ii.uni.wroc.pl/download/qemu-mimiker_6.1.0+mimiker1_amd64.deb && \
dpkg -i qemu-mimiker_6.1.0+mimiker1_amd64.deb && rm -f qemu-mimiker_6.1.0+mimiker1_amd64.deb
11 changes: 0 additions & 11 deletions toolchain/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion toolchain/gnu/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BINUTILS = binutils-2.37
GCC = gcc-11.2.0
GDB = gdb-11.1

ISL-URL = "http://isl.gforge.inria.fr/$(ISL).tar.xz"
ISL-URL = "https://mirror.sobukus.de/files/src/isl/$(ISL).tar.xz"
MPFR-URL = "ftp://ftp.gnu.org/gnu/mpfr/$(MPFR).tar.xz"
GMP-URL = "https://gmplib.org/download/gmp/$(GMP).tar.xz"
MPC-URL = "https://ftp.gnu.org/gnu/mpc/$(MPC).tar.gz"
Expand Down
2 changes: 1 addition & 1 deletion wiki/docs/_Sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
- [Commenting](https://github.com/cahirwpz/mimiker/wiki/commenting)
- [Onboarding](https://github.com/cahirwpz/mimiker/wiki/onboarding)
- [Test infrastructure](https://github.com/cahirwpz/mimiker/wiki/tests)

- [Toolchain](https://github.com/cahirwpz/mimiker/wiki/toolchain)
41 changes: 41 additions & 0 deletions wiki/docs/toolchain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Toolchain

## Local environment

### Container image

You can use container image used by our CI system.

To build latest version of container run:
- `git clone [email protected]:cahirwpz/mimiker.git && cd mimiker`
- `podman build -t mimiker .`
- `podman container run -it --rm --workdir /root/mimiker --hostname mimiker -v /home/user/mimiker:/root/mimiker mimiker /bin/bash`

after last command you are in shell inside container, you can install your
favourite set of packages or just build Mimiker with the following command:
- `make`

All changes are synchronized between local directory `/home/user/mimiker` and
`/root/mimiker` inside container, so you can edit source files using your
favourite editor.

It is not required but it is recommended to use podman in rootless mode. You can
use also docker as drop-in replacement, but then you are on your own with file
permissions inside `/home/user/mimiker` directory.

Note: building container is *SLOW* and IO *INTENSIVE* process.

### Old-style local toolchain

If you don't want to use containers you can still build binaries by hand &
create packages - currently we support only .deb package format and latest
Debian stable distribution.

For gnu toolchain - C compiler and set of tools required for build & debug - you
need to invoke `make` command inside `toolchain/gnu` directory.

For qemu - emulator used for local development - run `make` command inside
`toolchain/qemu-mimiker` directory.

That's all - if you have problems look into `Dockerfile` in top directory. It
contains list of packages & commands required to prepare toolchain.