Building LineageOS for FP4

Ok thanks. What does it take to make it an official LOS build downloadable on I’m going to ask in the other thread. Thank you @Aaanze for sharing the files and documentation. As I understand it, it will need a fresh installation, when the official LOS comes available because of the signing keys. Is this correct?

I have one question, @Error @hirnsushi maybe you could enlight; I see fairphone deployed a new security patch for FP4 on FPOS.
Are those patches OS specific only or somehow they include some improved driver and therefore should be included whatever the OS.
In the later case how would one “add” it to lineage repo for the purpose of building an OTA file ? Does it only make sense ?

At the moment only the stock Camera of FPOS can access 48MP resolution, so that’s not a bug of your LineageOS build :wink:
You can look up on this forum for similar experience with OpenCamera, GCam, GrapheneOS camera etc.

1 Like

That update can’t be installed on your custom ROM, no.
Someone (more knowledgeable) will have to look at the update and merge changes with the source (if applicable). How you would do it exactly I can’t tell you, that’s definitely outside of the stuff I have messed with before.

1 Like

That’s what I thought. Well… guess I’ll have to wait for the qualified people to commit changes on the repo. Though its not been moving much for the last 17 days…

I just built and signed the build using this docker image. Just put this in your manifest file:

<?xml version="1.0" encoding="UTF-8"?>
  <remote name="device" fetch="" revision="lineage-18.1" />
  <remote name="kernel" fetch="" revision="lineage-18.1" />
  <project path="device/fairphone/FP4" name="WeAreFairphone/android_device_fairphone_FP4" remote="device" />
  <project path="kernel/fairphone/sm7225" remote="kernel" name="WeAreFairphone/android_kernel_fairphone_sm7225" />
  <project path="vendor/partner_gms" name="lineageos4microg/android_vendor_partner_gms" remote="github" revision="master" />
  <project path="vendor/fairphone" remote="github" name="USERNAME/proprietary-vendor_fairphone" />

You’ll have to create (or find) a github repo with the proprietary files and replace USERNAME with, well, your username. The repo should look a little like this. Obviously the directory with the blobs should be called FP4 and the repo whatever is in the manifest file, here it’s proprietary-vendor_fairphone.

This build will include microG and fdroid, as well as the privilege extension thingy to make fdroid able to install apps without asking a million times.


Any ideas where I should upload/share the build?


WET, mega

you might want to take a look at



I just uploaded mine on github:

except it’s just the vendor/fairphone/FP4 subtree and not the whole vendor/fairphone, so I guess it needs to be set like this in repo’s config instead:

<project path="vendor/fairphone/FP4" remote="github" name="g4bwy/proprietary-vendor_fairphone_FP4" />

Looks like I found one source of where the 54 LineageOS installations
comming from, when you search for “FP4” at :wink:

I am by now sure LOS will find its way onto my brand new FP4 sooner or later. :smiley: I’ll try to be a patient patient by now.
Have fun!


The fall back Stock ROM is available now Touch wood and have fun trying.

1 Like

I’ll post it here just for cross refs: FP4 and LineageOS - #162 by g4b

btw, this build was made with test keys. I have another one with custom keys, but I’m concerned about migration whenever an official upstream build becomes available, so I didn’t upload it (also signature verification needs to be bypassed when installing from recovery, and I’m not sure how to fix it)

does anyone here have experience with that ? (I found the migration scripts here, but since I can’t test it with an actual official build I’m not yet confident to start using my custom keys as a daily driver…)

So I’ve been playing with my LOS build and so far I’m very happy with it.

Now I’m a bit disappointed because I intended to do greater things with my FP4 one of them implying cifs filesystem support. Which of course is not enabled by default.
I would not mind starting to mess with custom kernels but I honestly have but a blurry idea how to do that.

  1. I’ve browsed a bunch of threads mentioning cifs support and the only thing valuable I found was

    • add “CONFIG_CIFS=m” in some obscur configuration file named “defconfig” ? I looked at the kernel sources tree and could not find such file
    • I need to incorporate modules md4.ko and cifs.ko to the build. Here again I understood those modules have to be built in a device specific way that I could not figure out
  2. In the event I solved 1. I’d still I need to figure out how to build ONLY the LOS kernel. I mean I could get it by building the entire room but it seems a bit disproportionate.

Anyone here has some knowledge on custom kernel building/patching to share ?

I’m a developer thou I don’t have much experience working with kernels.

Regarding the issue 1:

  • After a quick search in the kernel tree with find I found the following “defconfig” files:

I guess you should add the CONFIG_CIFS=m flag in kernel/fairphone/sm7225/arch/arm64/configs/defconfig as “arm64” is the ISA the sm7225 chip uses.

  • As far as I understood, those kernel objects do not need to be strictly device specific. A quick search led me to see that you can even load them at runtime with insmod. Although I think you’ll probably need to add a build instruction to add them at build time. But I’m just guessing.

With the issue 2: do not worry about that. Usually, especially in well written software, building instructions and resolution are made so only the objects whose source files have been modified are recompiled again. So, next time you type brunch FP4 after changing the source, you should only see some kernel modules being recompiled (and later repackaged in the zip file).


Btw, I want to thank you all for contributing in this thread on how to build LOS. With your help I managed to build and flash LOS.

For anyone interested, I’ve modified the partner_gms to only include FDroid, the priviledge extensions and the two localization services. While I want a degoogled OS I have avoided using MicroG, at the moment, for security concerns.

If anyone is interested in using such configuration let me know so I’ll post the forked repository with the changes. I still haven’t made them public as I am testing it.

1 Like

This is awesome, thanks a lot I will for sure give a try !

Problem is, for some reason I can’t get “brunch” command recoginized before I proceed to “repo sync”. Which always ends up modifying something (los repo is in constant motion), therefore implies the full rebuild of the entire rom…
Is there anything I’m missing ? How can I initialize brunch command without syncing repo first ?

Edit: it seems the command

source build/

is the one initializing brunch command

Edit 2:

From what I’ve read it seems you HAVE to build the ko modules specifically for the kernel. But this seems way out of my league for now.

I’m new with android things, but in linux to configure the kernel you can do that:

  • cd into the kernel directory.
$ cd /path/to/kernel
  • Generate a default config with most drivers built into the kernel.
$ make defconfig
  • Open an interactive menu to edit the generated .config (needs ncurses).
    Find CIFS inside the menu (</> for Search) and enable as a module <M> not <Y>.
$ make menuconfig
  • Build The Kernel
$ make
  • Install Kernel Modules (Modules are installed to /path/to/somewhere.).
$ make INSTALL_MOD_PATH="/path/to/somewhere" INSTALL_MOD_STRIP=1 modules_install

If there is not much difference (between android and linux), it should be the same or similar.


Thank you this is very usefull, my main struggle being how to find the source of said modules. But this will already definitely help !