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.
Also please note that you will need about 300 GB of free disk space for sources and build output. For RAM we recommend to have at least 16 GB available.
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.
To install repo, follow the instructions on the AOSP website.
Register an account¶
We recommend that you register an account on our Gerrit to make contributions easier. Click on the register link using OpenID and upload an SSH key into your Gerrit account.
Initializing the repo¶
The following commands initialize the
repo manifest for Android 11.
mkdir fairphone_os && cd fairphone_os repo init -u ssh://gerrit-public.fairphone.software:29418/manifest -b fp3-a11-sibon # or for http based access # repo init -u https://gerrit-public.fairphone.software/manifest -b fp3-a11-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.
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.
Alternatively you can also run the
get_blobs.py script manually.
Get the relevant blobs version (“DEVICE_BLOB_VERSION”) from the device.mk file.
vendor/fairphone/tools/bin/get_blobs.py --device FP3 --build-id <DEVICE_BLOB_VERSION> --blobs-dir /tmp/test
Finally, you have everything set to initiate the build process.
For building any Android version, run the following commands to initialize the build environment:
Now configure the kind of build we want to make by running:
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 3 by running:
fastboot is most probably waiting for your Fairphone 3 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 and connected to
your PC via USB
fastboot will start flashing your device and
reboot it into your own-built Fairphone OS.