Building LineageOS for FP4

It worked :tada: To recap: I extracted the proprietary files from my phone. The missing files were added from the iodé build. The roomservice.xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote name="device" fetch="https://github.com" revision="lineage-18.1" />
  <remote name="kernel" fetch="https://github.com" 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" />
</manifest> 

Other than a few warnings, the build finished successfully. Nevertheless, I’m still hesitant to actually install it on my phone since I haven’t seen a clear path to restoring the device to its initial conditions should something go wrong.

I assume Fairphone would have to release a complete stock image for that to be easily possible.

11 Likes

Well I’m a curious guy, provided with a relatively understandable procedure I could sacrifice my device for the cause

2 Likes

Are you using debian or ubuntu? If so, I can write a summary of the things I did.

Well I’m usually using Ubuntu WSL, or Raspberry Pi debianish arm64 distro.
Though, I could quickly set up a full Ubuntu/Debian on a spare computer if this is mandatory.

Bottom line write what is the less painful for you and I’ll try to figure out

First, follow the general tutorial on how to build LineageOS yourself, this one from the FP3 is a good example. Before entering breakfast FP4, create a file called roomservice.xml in ~/android/lineage/.repo/local_manifests/roomservice.xml and edit it to be the same as in the post above.

Then use repo sync and breakfast FP4 after that to get the files from the WeAreFairphone github.

Now you need to get the proprietary vendor blobs. First, use the extract-files.sh script to pull files from the phone. In my case, many could not be pulled. Copy the directory ~/android/lineage/vendor/fairphone/FP4/proprietary to somewhere else, so you have the original files.

Then download the iodé rom linked above (file iode-2.3-20220121-FP4.zip). Extract the zip and follow this tutorial on how to extract the proprietary files from payload.bin file.

After the files have been extracted from the iodé rom, put the original files you extracted from the phone back in ~/android/lineage/vendor/fairphone/FP4/proprietary

You should now be able to continue in the tutorial and compile it using croot and then brunch FP4

With cd $OUT you can get to the directory where the boot image and the installer package should be.

From here you should be able to follow most instructions on how to flash LineageOS - the FP3 instructions as an example again. Don’t forget to unlock your bootloader before flashing the OS.

I know this is a pretty bare-bones explanation of what I did and I hope I didn’t forget anything, so please let me know should you be stuck somewhere or should something go wrong. Also keep in mind that the initial repo sync can take an ungodly amount of time, it took me almost an hour. The compilation takes a while as well, it took almost two hours for me.

Happy hacking! :technologist::space_invader:

4 Likes

Alright currently syncing as we speak.

Totally novice question for the next steps:
Should I create and edit roomservice.xml BEFORE running:

source build/envsetup.sh

After, but I don’t think it makes a difference, if you want, do it both before and after for good measure :stuck_out_tongue:

1 Like

Alright will keep you posted.

I’m like totally amateur on this matter, I mean I have pretty basic knowledge of linux and I like to mess things up, but expect more dumb questions.

No worries! I’m somewhat new myself, this is only the second device I’ve built LineageOS for myself. Ask as many stupid questions as you want! :blush:

1 Like

Alright first sync is over, everything went well.
Now:

However local_manifests folder doesn’t exist, should I create it or is it a typo ?

It doesn’t exist by default, you can just create it!

Alright, seems I can’t have breakfast…
roomservice.xml is created, repo is synced, build/envsetup.sh is set, yet… somehow

Can not locate config makefile for product “lineage_fp4”

Do you have the same issue if you capitalize FP4? So breakfast FP4 instead of breakfast fp4

Edit for the sake of accuracy: it WAS indeed the lack of capitalization that prevented the brunch to work.
Though it would throw error about F4-vendor.mk anyway

Could you maybe check the device directory? A subfolder called device/fairphone/FP4 should be there, containing the device specific code.

Yeah it’s there.

Weirdly, after another sync error seem now to point towards absence of “FP4-vendor.mk”

Ok now I just noticed this warning in the tutorial:

Some devices require a vendor directory to be populated before breakfast will succeed. If you receive an error here about vendor makefiles, jump down to Extract proprietary blobs. The first portion of breakfast should have succeeded, and after completing you can rerun breakfast

So I guess I should move on ?

I don’t have a FP4-vendor.mk file either and our directories look identical, so I don’t think that’s it. It looks like it’s throwing an error because of a missing file in the vendor directory and not in the device directory. Have you extracted the proprietary blobs before running breakfast?

If yes, could you try, in this order:

repo sync
source build/envsetup.sh
breakfast FP4

Nope I did not, as per your instructions.
By the way my ~/android/lineage/vendor folder doesn’t contain any fairphone folder

In that case, create the fairphone/FP4 subfolder, continue with the blob extraction, and rerun breakfast. Hope that helps!

It’s in the folder with the device specific code device/fairphone/FP4 that you can see on the screenshot you posted above!