Added Docker setup to build wasp-os.

This should make it a bit easier for people to contribute. Also fixed
the documentations on how to setup on Debian, as certain recommended
packages don't exist.

Signed-off-by: Shuhao Wu <shuhao@shuhaowu.com>
This commit is contained in:
Shuhao Wu 2021-02-02 18:21:18 -05:00 committed by Daniel Thompson
parent 090ed8489b
commit 268f8c06e9
4 changed files with 65 additions and 0 deletions

View File

@ -9,6 +9,9 @@ Installation Guide
Building wasp-os from source
----------------------------
Install prerequisites
~~~~~~~~~~~~~~~~~~~~~
Building wasp-os and launching the wasp-os simulator requires Python 3.6
(or later) and the following python modules: click, numpy, pexpect, PIL
(or Pillow), pydbus, pygobject, pyserial, pysdl2.
@ -50,6 +53,22 @@ tested using the `GNU-RM toolchain
link time optimization is enabled during the MicroPython build
(LTO is enabled by default).
Install prerequisites via docker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To build via docker, simply invoke `tool/docker/shell` from the root directory
after having docker installed. This will build the docker image and also drop
you into a shell with wasp os's source code shared into the container at
``/home/user/wasp-os``. All ``make`` commands should be usable from this shell,
including ``make sim`` and ``make check``. Some commands that interact with
bluetooth such as ``wasptool`` may not work, for now.
.. note::
If you want to use the Docker-based setup, it is assumed that you're using
and x86 machine on Linux, running Xorg. Other setup may require some
patching for now.
Fetch the code from
`https://github.com/daniel-thompson/wasp-os <https://github.com/daniel-thompson/wasp-os>`_ and download the prerequisites:
@ -69,12 +88,16 @@ list below:
make -j `nproc` BOARD=k9 all
make -j `nproc` BOARD=p8 all
The output of these will be stored in ``build-${BOARD}/``.
To rebuild the documentation:
.. code-block:: sh
make docs
The docs will be browsable in ``docs/build/html`` as per Sphinx standards.
Device Support
--------------

24
tools/docker/Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM ubuntu:focal
ARG uid
ARG gid
RUN set -xe; \
export DEBIAN_FRONTEND=noninteractive; \
apt-get update; \
apt-get install -y \
wget git build-essential pkg-config libsdl2-2.0.0 python3-click \
python3-numpy python3-pexpect python3-pil python3-pip python3-pydbus \
libcairo2-dev python3-serial unzip python3-sphinx graphviz \
python3-recommonmark python3-pytest \
; \
pip3 install cbor pysdl2 pygobject cryptography;
RUN set -xe; \
wget --progress=dot:mega -O - https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 | tar xjf - -C /opt
RUN set -xe; \
addgroup --gid $gid user; \
adduser --gecos "" --disabled-password --uid $uid --gid $gid user;
COPY setup-env.sh /etc/profile.d/setup-env.sh

View File

@ -0,0 +1,3 @@
export PATH=/opt/gcc-arm-none-eabi-9-2019-q4-major/bin:$PATH
cd ~/wasp-os

15
tools/docker/shell Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
docker build --build-arg uid=$UID --build-arg gid=$(id -g) -t wasp-os-dev ./tools/docker
docker run \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v $(pwd):/home/user/wasp-os \
-u user \
-e DISPLAY \
--init \
--device /dev/dri \
-it \
--rm \
wasp-os-dev \
bash -l