Build Instructions

Let’s get started on creating your very own Fairphone OS build! As Fairphone OS is largely based on the Android Open Source Project (AOSP), the steps to build are quite similar to building AOSP. So you might find the resources on the AOSP website helpful.

My code is compiling

Prepare the Build Environment

Before actually getting and building your own version of Fairphone OS, you should make sure that your system is properly set up to build it. You can follow this handy guide at the AOSP project site to set up your build environment, which also explains you how to setup ccache to speed up compilation.

Getting the Source


As of October 2020, we are using a new public Gerrit instance. The old URL is not available anymore. We migrated all projects, changes and user accounts to the new instance at, which is also updated to the latest version of Gerrit.

Now that your system is ready to build Fairphone OS, it’s time to download the source.

Installing repo

As Fairphone OS consists of many subprojects, we will use the repo tool to download the source code. It is very handy to install repo in a user local bin directory.

To install repo, follow the instructions on the AOSP website.

Register an account

We kindly ask you to register a Gerrit account for cloning the repositories. This might come in handy later on when you want to contribute code back. Click on the register link using OpenID and upload an SSH key into your Gerrit account.

Initializing the repo

Android 7 and 9

The following commands initialize the repo manifest for Android 9. For building Android 7, use commands but the manifest branch or fp2-n-sibon instead of fp2-p-sibon.

$ mkdir fairphone_os && cd fairphone_os
$ repo init -u ssh:// -b fp2-p-sibon
$ # or for http based access
$ # repo init -u -b fp2-p-sibon

Android 6

Our code is based on Code Aurora code, with the manifest being LA.BF.1.1.1-03010-8x74.0. Android 6 sources are stored in legacy project paths with fp2-dev prefix as follows:

$ mkdir fairphone_os && cd fairphone_os
$ repo init -u ssh:// -b fp2-m-sibon
$ # or for http based access
$ # repo init -u -b fp2-m-sibon

Downloading the source tree

Now let’s download the source by issuing the following command:

$ repo sync --detach --current-branch --no-tags

The first time you’ll do that it will take quite some time.

Getting the Binary Components

Unfortunately, not all components of Fairphone OS can be released as open source.

Android 9

When running the first build, the build system will prompt you to run the command required to download the binary components and accept the special license agreement.

Android 7

The binary components required for building Android 7 are automatically downloaded by the build system. On first build you will be prompted to accept the special license agreement.

Android 6

Download a set of binary drivers and install them into the the source tree.

$ wget
$ md5sum fp2-sibon-18.04.1-blobs.tgz
40aa95aa5d4638a5ff26462036422a60  fp2-sibon-18.04.1-blobs.tgz
$ sha256sum fp2-sibon-18.04.1-blobs.tgz
269e91fd3a510293363106a060577680f9a3880da6eea28bd9f74274b11bb6b4  fp2-sibon-18.04.1-blobs.tgz
$ tar zxvf fp2-sibon-18.04.1-blobs.tgz
$ sh


Finally, you have everything set to initiate the build process.

The following commands are only required for building Android 7:

$ export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx6G"

For building any Android version, run the following commands to initialize the build environment:

$ export LC_ALL=C
$ . build/

Now configure the kind of build we want to make by running:

$ # Android 7 or 9:
$ choosecombo release fp2_sibon userdebug
$ # Android 6:
$ choosecombo 1 FP2 2

And go:

$ make -j8

Now you can watch some cat videos on Youtube until the compilation is done.


Did compilation succeed without errors? That’s awesome, because now it’s time to flash your Fairphone 2 by running:

$ fastboot flashall

fastboot is most probably waiting for your Fairphone 2 to be connected to your computer. For fastboot to actually find your device it has to be brought into a special mode called fastboot mode. You can achieve that by powering on the phone while holding the volume down button. Once your phone is in fastboot mode (given it is connected to your PC via USB ;) fastboot will start flashing your device and reboot it into your own-built Fairphone OS.