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.
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. If you run the
latest long term support version of
you should be good to go after installing some packages with the
$ sudo apt-get install openjdk-7-jdk bison g++-multilib git gperf \ libxml2-utils make python-networkx zlib1g-dev:i386 zip
Getting the Source¶
Now that your system is ready to build Fairphone OS, it’s time to download the source.
As Fairphone OS consists of many subprojects, we will use the
tool to download the source code. It is very handy to install
in a user local bin directory.
If you do not already have a user local
bin directory, create one and
add it to your
PATH environment variable:
$ mkdir ~/bin $ export PATH=~/bin:$PATH
You might want to add the last command to your
.zshrc, in case you are using the right shell) configuration file.
Now we download
$ curl https://storage.googleapis.com/git-repo-downloads/repo-1.22 > ~/bin/repo
You might want to check if you downloaded the right file by verifying its SHA1 checksum:
$ sha1sum ~/bin/repo
The checksum for the latest version 1.22 is
If the checksum is correct make repo executable by running
$ chmod u+x ~/bin/repo
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¶
Our code is based on Code Aurora code, with the manifest being LA.BF.1.1.1-03010-8x74.0. Let’s create a new working directory and initialize it:
$ mkdir fairphone_os && cd fairphone_os $ repo init -u ssh://code.fairphone.com:29418/fp2-dev/manifest -b fp2-m-sibon $ # or for http based access $ # repo init -u https://code.fairphone.com/gerrit/fp2-dev/manifest -b fp2-m-sibon
Now let’s download the source by issuing the following command:
$ repo sync
The first time you’ll do that it will take quite some time.
Getting the Binary Components¶
Unfortunalty, not all components of Fairphone OS can be released as open source, so you have to download a set of binary drivers and install them into the the source tree:
$ wget https://code.fairphone.com/downloads/FP2/blobs/fp2-sibon-17.10.1-blobs.tgz $ md5sum fp2-sibon-17.10.1-blobs.tgz 6138ecb17fd78129cafa194f0060f136 fp2-sibon-17.10.1-blobs.tgz $ sha256sum fp2-sibon-17.10.1-blobs.tgz e77ec0df44b24dbdf82d01baf9f15ac87a445cedceae30ff57e932e2ebe870b7 fp2-sibon-17.10.1-blobs.tgz $ tar zxvf fp2-sibon-17.10.1-blobs.tgz $ sh fp2-sibon-17.10.1-blobs.sh
Finally, you have everything set to initiate the build process.
Run the following command to initialize the build environment:
$ . build/envsetup.sh
Now configure the kind of build we want to make by running:
$ choosecombo 1 FP2 2
$ 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.