Date 1 - 1 of 1
[RFC] Docker-based development environment for Windows
LeMay, Michael <michael.lemay@...>
Problem: Setting up a Zephyr development environment on Microsoft Windows involves many steps.
Proposal: Use Docker to automate the setup procedure.
Docker Toolbox (https://www.docker.com/products/docker-toolbox) can be installed on Windows. It automates the installation of a VMM and a Linux VM suitable for running Docker containers. It also installs associated tools.
A Dockerfile is a sort of script for creating a Linux container (https://docs.docker.com/engine/reference/builder/). I wrote one that automates the creation of a Zephyr development environment based on Ubuntu 15.10. It's fairly short, so I pasted it at the end of this message in its entirety. It would be placed in a new, empty directory, e.g. $ZEPHYR_BASE/scripts/docker.
To build the container, the developer would execute "docker build -t zephyr-build ." in that directory from the "Docker Quickstart Terminal".
To run the container, the developer would execute "docker run -t -i -v /c/Users/<username>/<zephyr_src_dir>:/zephyr zephyr-build", where <zephyr_src_dir> is a Zephyr source tree. This would present the developer with a command prompt in the Zephyr development environment with the root of the Zephyr source tree as the initial working directory.
To build an app, the developer would navigate to the desired app source directory and execute the same commands that would be used in any other Ubuntu Linux environment. The output binary can be accessed from Windows after being built.
This environment is also suitable for building GRUB for the Intel Galileo using the scripts/build_grub.sh script. However, the script must first be copied to /tmp within the Linux container and executed from there, since the GRUB build process is incompatible with the virtual filesystem for the Zephyr source tree.
I think that this environment would only be suitable for building Zephyr binaries. Installing the binaries to the target is an orthogonal procedure. The files simply need to be copied to a USB-connected flash device for a board like the Intel Galileo, but the installation procedure is more complicated for some other boards.
I can submit this Dockerfile as a patch with associated documentation if it seems potentially useful.
This could potentially be useful on other platforms besides Windows, but I have only tested it on Windows 10 so far.
RUN apt-get update \
&& apt-get install -y \
autoconf automake bison bzip2 file flex gcc-multilib git make python \
&& rm -rf /var/lib/apt/lists/*
ENV SDK_VER 0.7.2
ENV SDK_ARCHIVE zephyr-sdk-$SDK_VER-i686-setup.run
ADD https://nexus.zephyrproject.org/content/repositories/releases/org/zephyrproject/zephyr-sdk/$SDK_VER-i686/$SDK_ARCHIVE ./
RUN chmod u+x $SDK_ARCHIVE
ENV ZEPHYR_SDK_INSTALL_DIR /opt/zephyr-sdk
RUN ./$SDK_ARCHIVE --nox11 -- -d $ZEPHYR_SDK_INSTALL_DIR
RUN rm $SDK_ARCHIVE
RUN echo export ZEPHYR_GCC_VARIANT=zephyr >> ~/.bashrc
RUN echo export ZEPHYR_SDK_INSTALL_DIR=$ZEPHYR_SDK_INSTALL_DIR >> ~/.bashrc
RUN echo source /zephyr/zephyr-env.sh >> ~/.bashrc
CMD ["/bin/bash", "-l"]
|1 - 1 of 1|