Creates an Android build environment for Fairphone 2 based on official build instructions provided by Fairphone.
Get a pre-built image from Docker hub with docker pull jftr/fairphone2-build-env
or use the Dockerfile to build yourself.
After building the image, build environment for Fairphone 2 is setup:
- Dependencies are installed
repo
is installed- Working directory inside the image is created
In order to make all changes persistent, /var/fairphone_os/
should be mounted as a shared volume by using docker run
with the -v $PATH_ON_HOST/:/var/fairphone_os/
option (where $PATH_ON_HOST
is the path at which you would want to store the repository and builds on your host. This should be empty initially).
All steps you need to take are described in the official build instructions. In short:
- Initialize and sync repository
- Download binaries
- (Optional: Make changes)
- Build
All these steps (and some additions discussed on the Fairphone community board) can be executed with the default command of the image:
$ mkdir fairphone_os
$ PATH_ON_HOST=`readlink -f fairphone_os`
$ docker run -v $PATH_ON_HOST:/var/fairphone_os/ jftr/fairphone2-build-env
Alternatively you can get a shell and build manually (or continue an interrupted build without re-downloading all repositories):
$ docker run -v $PATH_ON_HOST:/var/fairphone_os/ -i -t jftr/fairphone2-build-env /bin/bash
Once your build is complete, you can find it in $PATH_ON_HOST
.
Use your host to flash the image to your Fairphone.
- Mind: This is a very basic example (e.g.
ccache
is not configured). Pull requests are welcome. - This is an unofficial image. I'm in no way associated with Fairphone.
- I can't promise that this works for you. Flashing your phone with an image built using this docker image might fail. Flash at your own risk.
- Building the docker image may fail in some configurations when installing
openjdk
. This seems to be due to a kernel bug. - The build may get stuck on Java zombie processes, this can be solved by switching Docker to the
devicemapper
storage backend.