Fairphone 4 - 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.
For browsing or downloading our ODM source tree, please refer to Fairphone 4 - ODM Android Source Code. You will also find more information about our different Fairphone 4 source tree there.
For building only the kernel, please refer to Fairphone 4 - Kernel Source Code.
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¶
Android 11, 12 and 13¶
The following commands initialize the
repo manifest for Android 13.
For Android 11 or 12, instead use the branches int/11/fp4 or int/12/fp4, respectively.
mkdir fairphone_os && cd fairphone_os repo init -u ssh://gerrit-public.fairphone.software:29418/manifest -b int/13/fp4 # or for http based access # repo init -u https://gerrit-public.fairphone.software/manifest -b int/13/fp4
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.
After downloading the Android source tree, you will need to manually download and extract the proprietary binary blobs. To download the blobs, please refer to Fairphone 4 - Binary Blobs Package.
After download, extract them in the source tree:
# Insert the path of the downloaded archive here. # Replace `FP4-*-blobs.sh` by your downloaded file name. tar -xf .../path/to/FP4-*-blobs.tgz # Unpack into the expected location in your Android source tree. # Read and accept the license by pressing <y>. ./FP4-*-blobs.sh --target device/fairphone/fp4-proprietary
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 4 by running:
fastboot is most probably waiting for your Fairphone 4 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.