Building LineageOS for FP4

You also need a pretty decent CPU it appears.
I set up a full linux on my tiny Onemix 3S laptop (which has a 500GB SSD and 16GB RAM) and followed all the steps all over again to get a better grip at those, and it’s been building for the last 15 hours (only reach 75% so far) :smiley:

BTW I’m about to flash my device in the next few minutes, stay tuned if your into catastraphic events.

Alright: first attempt failed, it seems that flashing the recovery generated by the build did not… change the recovery ? I’m still getting greeted by stock recovery hence, unable to bypass signature verification

Edit: Was able to run lineage recovery with fastboot boot recovery.img

Edit2: I booted into Lineage !

So far so good. Though I have very minimal services installed.
Will try and get microG setup as I couldn’t flash openGapps pico apparently because of system partition too small. Kind of a deal breaker to me as I still need minimal google services, mostly maps

6 Likes

I couldn’t flash openGapps pico apparently because of system partition too small.

Do you still remember the exact error you got?

Halas no… I’m now struggling with my next mess: I naively tried to flash magisk via lineage recovery and ended up in a bootloop. I will therefore wipe everything all over again and let you know about the message I get when I go to gapps phase.

I would gladly hear some tricks about efficently going to fastboot/recovery/bootloader when device wont boot to OS and bootloader unlocked warning seems to somehow mess with the vol down + power combination.
I mean I’m pressing the vol down + power buttons and no matter what it either tries to boot and get stuck on Fairphone logo, or shutdowns. I managed to get to it earlier but don’t quite understand how I did it.
@hirnsushi an idea ? :smiley:

Edit: Finally got into recovery with a random 3 buttons simultaneously press after lgoo or something…

@Error here are the logs I get when trying to flash Open gapps pico:
First I got those errors:

E: open failed /metadata/ota: no such file or directory
E; couldn’t open mount Metadata

Then installer runs and after “performing calculation”:

Insufficient sotarge space in System partition. You may want to use smaller Open Open Gapps package or consider removing some apps blahblahbla…

That’s really weird, opengapps pico being the smallest variant should definitely have enough space. Are you able to boot into LineageOS again? If so, enable debugging, enter adb shell on your pc and then enter df to see how much space is used by the various partitions.

1 Like

yeah that what I thought too… usually works on other devices…

Here’s the df outout:

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/dm-5 1222628 993036 213208 83% /
tmpfs 2805200 1268 2803932 1% /dev
tmpfs 2805200 0 2805200 0% /mnt
/dev/block/dm-6 445412 214716 221788 50% /system_ext
/dev/block/dm-7 585288 354588 218992 62% /product
/dev/block/dm-8 597452 366112 219384 63% /vendor
/dev/block/dm-9 232328 1084 226600 1% /odm
tmpfs 2805200 0 2805200 0% /apex
/dev/block/dm-10 107795640 1972480 105692088 2% /data
/dev/block/loop6 3940 3912 0 100% /apex/com.android.extservices@300000000
/dev/block/loop7 848 820 12 99% /apex/com.android.tzdata@300000000
/dev/block/loop8 2400 2368 0 100% /apex/com.android.resolv@300000000
/dev/block/loop9 5132 5096 0 100% /apex/com.android.runtime@1
/dev/block/loop10 8836 8808 0 100% /apex/com.android.permission@300000000
/dev/block/loop11 876 848 12 99% /apex/com.android.tethering@300000000
/dev/block/loop12 131428 127768 1028 100% /apex/com.android.vndk.v30@1
/dev/block/loop13 6532 6500 0 100% /apex/com.android.cellbroadcast@300000000
/dev/block/loop14 18824 18796 0 100% /apex/com.android.media.swcodec@300000000
/dev/block/loop15 4688 4660 0 100% /apex/com.android.media@300000000
/dev/block/loop16 1688 1660 0 100% /apex/com.android.os.statsd@300000000
/dev/block/loop17 5660 5632 0 100% /apex/com.android.neuralnetworks@300000000
/dev/block/loop18 336 304 28 92% /apex/com.android.sdkext@300000000
/dev/block/loop19 524 496 20 97% /apex/com.android.ipsec@300000000
/dev/block/loop20 232 92 136 41% /apex/com.android.apex.cts.shim@1
/dev/block/loop21 7764 7736 0 100% /apex/com.android.adbd@300000000
/dev/block/loop22 83736 83708 0 100% /apex/com.android.art@1
/dev/block/loop23 4712 4684 0 100% /apex/com.android.conscrypt@300000000
/dev/block/loop24 4896 4868 0 100% /apex/com.android.wifi@300000000
/dev/block/loop25 24648 24616 0 100% /apex/com.android.i18n@1
/dev/block/loop26 3936 3908 0 100% /apex/com.android.mediaprovider@300000000
/dev/fuse 107795640 1972480 105692088 2% /storage/emulated

Funny enough googling for the error led me to another thread in the Fairphone forum:

Do we know if the device is encrypted by default? And do we know if lineage recovery can deal with that? :thinking:


Edit: It seems to me, /metadata is missing. If I compare your partitions to mine on vanilla, it should be mounted somewhere, huh, weird…

And… what is this partition used for ? Weirdly it doesn’t seem to prevent the device to run properly… so far…

On another matter, I managed to root the device which is great.

1 Like

OK, I found this info in the docs:

metadata partition. This partition is used when device is encrypted. The size is 16 MB or larger.

Could you check adb shell 'getprop ro.crypto.state' :thinking:

Well it returns “encrypted”

So it’s encrypted but /metadata isn’t mounted, could this be a problem with the state the previous ROM left behind? :thinking:
The /e/ install guide specifically mentions:

fastboot erase userdata
fastboot erase metadata

Did you issue those commands after you flashed lineage?


Edit: It’s possible lineage doesn’t actually use metadata encryption, here is the documentation on that matter.


Edit 2: Just found this:

Devices launched with Android 11 or higher must have metadata encryption on internal storage enabled.

So it has to be enabled but it’s not mounted, our old nemesis AVB strikes again :roll_eyes:

1 Like

I most definitely did not, I don’t think it was on the lineage tutorial, or was it ?
Technically what will be the effect on my device ? Because I do not experience any issue… yet.
Been setting up my phone almost completely now and it’s pretty smooth

1 Like

Then I’d suggest just riding that lineage wave for some time until it breaks.
Those commands will only wipe userdata / encryption metadata completely in the best case and in the worst lead to a host of other issues.

Enjoy your artisinal homemade ROM for now :smiley:

1 Like

I most definitely will.
While you’re there could you please enlight me on some concepts I didn’t quite grasp ?

For a start, regarding localisation apps: so I managed to get google maps working though I can’t login (and it seems I won’t be able too), but I had to install location providers.
My understanding is that those location providers replace Google service’s ability to provide location information.

Therefore:

  • Just which ones should I use ?

  • Is there any point in installing several of them ?
    I currently installed: mozilla, applewifi, deja vu, GSMNetworkLocationProvider, Nominatim
    Can I assume that the more of them installed, the more precise the location will be ? Will it significantly drain my battery ?

  • What about sattelite localisation ? I still don’t understand why my phone would not be able to get location information when it has an integrated GPS ? Can’t it work on degoogled phones ?

GPS should still work without problems, those are used to get a faster fix or location information in places where GPS isn’t available.
More ≠ precise in this case, there’s sadly no real logic to which one takes precedence. IIRC the fastest one is used :thinking:

As for which one to choose, they all have their strengths and weaknesses, I think this wiki (a bit old) provides a great overview. As far as I can tell, the most up to date one is LocalGsmNlpBackend and that’s the one I usually use, mostly because it’s easy to contribute to with Tower Collector and the database is available offline.
Wifi based ones have been buggy for me in the past, sometimes the location would end up two towns over, cell towers rarely move :smirk:


Edit: Maybe this topic should be split now above this post and turned into a more general one discussing building lineage etc.? :thinking:


Edit 2: Thank you @robbert.f that was fast :smiley:
Would it be possible to move the first post back to the other topic, otherwise that one ends without the solution. Nevermind :slightly_smiling_face:

2 Likes

Don’t press the power button, but instead maintain one of the volume buttons and then connect the USB-C cable to your computer. Your FP4 will be in:

  • volume down + cable : fastboot mode,
  • volume up + cable : Android recovery
4 Likes

That’s a great way to do it :metal:

I generally keep it plugged in and release Power as soon as the screen turns black, then just keep holding up or down until you’re in the desired mode.
Bonus tip: Pressing Vol. Down during the boot animation (that blue dot) will boot you into Safe Mode, really useful if you messed up some Magisk configuration as this will disable all modules.

2 Likes

I’m currently looking into building LineageOS with microG and fdroid. As far as I understand, I need to enable signature spoofing using these patches and then include these packages while building LineageOS.

I was able to apply this patch but when I tried to apply this one I get an error saying

can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- a/src/com/android/permissioncontroller/permission/utils/Utils.java
|+++ b/src/com/android/permissioncontroller/permission/utils/Utils.java
--------------------------

since the files it’s trying to patch don’t exist.

Do I only need to use the other patch or did I miss a step?

Very nice, you got a working build for the FP4! :smiley:
Are you able to contribute your work the the semi-official channels in this thread: FP4 and LineageOS - #70 ?

Seems dk1978 and the others would be happy to get help. :slight_smile: Then, even more users would benefit. Have a nice day!

1 Like

I would gladly contribute, but to be honnest this is my first ever custom ROM build - kind of a little event in my concern :smiley: - and I wouldn’t really know how to contribute.

I only but followed the procedure written by @Error so I didn’t really achieve anything I could take credit for ! I didn’t modify a single file from the repo in the process… (I’m just starting to mess with the manifest to create a gApps bundled version but that’s about it)

2 Likes