Fairphone 4 Kernel Source Code¶
Here you can find instructions on how to download and compile the version of the Linux kernel used in the Fairphone 4.
The sources are available on our public Gerrit on git branch
As the sources are split over multiple git repositories, we have prepared a repo manifest so you can compile the kernel and its modules outside of the Android build system.
You need the repo tool from Google. To install repo, follow the instructions on the AOSP website.
You will also need to install the Clang/LLVM toolchain on your host system. Every major version between clang 10 and clang 13 was tested and found to work correctly.
# Initialize the local repository mkdir fp4-kernel && cd fp4-kernel repo init -u https://gerrit-public.fairphone.software/manifest -b kernel/11/fp4 # Download the sources repo sync --detach --current-branch --no-tags
Next you can compile your kernel using the following commands:
cd kernel/msm-4.19 export ARCH=arm64; export CROSS_COMPILE=aarch64-linux-gnu- export KBUILD_OUTPUT=build # Choose either fp4-perf_defconfig (release mode)... make CC=clang LLVM=1 vendor/fp4-perf_defconfig # ... or fp4_defconfig (debug mode) make CC=clang LLVM=1 vendor/fp4_defconfig # Finally compile the kernel make CC=clang LLVM=1 -j$(nproc)
You will find the compiled kernel in
build/arch/arm64/boot/Image. Please note, that currently the sources do not contain the devicetree sources (.dts, .dtsi). You will need to extract the dtb (device tree blob) from the stock image’s boot.img and use that with your self-compiled kernel (e.g. with
unpackbootimg from github.com/osm0sis/mkbootimg).
While we’re working on publishing full flashable images, you can directly download the images for the boot and dtbo partitions:
Additionally please note, that the stock Android image currently does not support having the WLAN driver built-in (
CONFIG_QCA_CLD_WLAN=y) and Wi-Fi will not work in Android unless you trigger starting the WLAN driver manually using
echo 1 > /sys/kernel/boot_wlan/boot_wlan.