Fairphone 5 - Kernel Source CodeΒΆ

Here you can find instructions on how to download and compile the version of the Linux kernel used in the Fairphone 5.

The sources are available on our public Gerrit on git branch kernel/13/fp5.

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.

Hint

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. Clang version 15 was tested but other versions should also work correctly.

# Initialize the local repository
mkdir fp5-kernel && cd fp5-kernel
repo init -u https://gerrit-public.fairphone.software/manifest -b kernel/13/fp5
# Download the sources
repo sync --detach --current-branch --no-tags

Next you can compile your kernel using the following commands:

cd kernel/msm-5.4
export ARCH=arm64; export CROSS_COMPILE=aarch64-linux-gnu-

# Choose either release mode...
TARGET_BUILD_VARIANT=user scripts/gki/generate_defconfig.sh vendor/fp5-qgki_defconfig
KBUILD_OUTPUT=build make CC=clang LLVM=1 vendor/fp5-qgki_defconfig
# ... or for debug mode
TARGET_BUILD_VARIANT=userdebug scripts/gki/generate_defconfig.sh vendor/fp5-qgki-debug_defconfig
KBUILD_OUTPUT=build make CC=clang LLVM=1 vendor/fp5-qgki-debug_defconfig

# Finally compile the kernel
KBUILD_OUTPUT=build make CC=clang LLVM=1 -j$(nproc)

You will find the compiled kernel in build/arch/arm64/boot/Image.