English

FP3 custom rom development based on released source code

I wrote a little script for installing TWRP and magisk aka rooting:


The output looks like this:

File 'twrp-3.3.1-0_k4y0z-20200202-02-fp3.img' already there; not retrieving.

File 'twrp-installer-3.3.1-0_k4y0z-20200202-02-fp3.zip' already there; not retrieving.

File 'Magisk-v20.3.zip' already there; not retrieving.

downloading 'boot.img'...
OKAY [  1.139s]
booting...
OKAY [  7.334s]
finished. total time: 8.473s
Total xfer: 1.06x                                                          
Total xfer: 1.45x                          
Flashed TWRP and Magisk
Rebooting to device...
3 Likes

prog_emmc_firehose_8953_ddr_redmi7.mbn works with FP3.
I only tested printgpt with edl.py so far

1 Like

Seems like we found a working programmer, will update you when we have done some more tests

1 Like
4 Likes

Thanks for doing this important work! Can anyone guess how long this development will take approximately? My FP2 starts to fall apart and I would really like to switch to a FP3 running LineageOS. Are we talking about weeks or months or is it impossible to foresee the development time at all?

If you are feeling adventurous, you could try it right now …


This. Better expect nothing and be pleasantly surprised than expect something and be disappointed :slight_smile: .

Thanks to all the experts here for the huge progress in the last few weeks.
Unfortunately I only have little time at the moment to participate and it’s been some time since I’ve worked on Android system development. But I want to try to dig little into LOS.
Dumb question to the experts: Wouldn’t this config https://github.com/LineageOS/android_device_motorola_river or this https://github.com/LineageOS/android_kernel_motorola_sdm632 respectively a good one to start with?

2 Likes

you can start with the river devicetree, but you need to take the FP3-kernel.

1 Like

Yes sure. I set up a device tree based on the Motorola platform now: https://github.com/mstaz/android_device_fairphone_fp3
I extraced the binaries with extract-files.sh from @k4y0z’s full dump:

Configs and makefiles seem to be parsed successfully so far.
This is my try to start development on LOS for the FP3 :slight_smile:

However build fails because of errors in kernel sources.

…/…/…/…/…/…/kernel/fairphone/sdm632/drivers/media/platform/msm/vidc_3x/msm_vidc.c:1381:2: error: function definition is not allowed here

Seems that there are some crazy non-standard nested functions used:
https://github.com/FairphoneMirrors/android_kernel_fairphone_sdm632/blob/master/drivers/media/platform/msm/vidc_3x/msm_vidc_common.c#L732
@k4y0z didn’t you face the same errors?
Maybe another compiler is used for LOS.

3 Likes

You need to use the compile-branch:

3 Likes

Thanks for the hint. I’ll try that tomorrow.

I built a new kernel based on k4y0z’s and reverted the kernel config: https://github.com/basxto/android_kernel_fairphone_sdm632/commit/a4b10ea6bbee9cb3d1d945567a20400e0e5eaee7
My phone is running with 101 stock (also works with 110), LOS16 as system and custom kernel + twrp on boot.
Not working:

  • camera
  • flash light
  • WiFi
  • calling somebody or getting called ended with a black screen

Working:

  • bluetooth
  • LED
  • buttons
  • display resolution
  • turning display back on
  • GSM (f-droid synced over GSM)
  • ethernet over usb-c via adapter
  • receiving sms
  • seeing that I get called
  • NFC
  • fingerprint sensor

It takes an eternity to boot up, but I think that’s because the camera does not work.
If you use fastboot boot and want to boot into your custom twrp, you have to reboot your phone into recovery mode and hold the volume down key. Otherwise it will skip the initramfs.

6 Likes

Now I booted into ArrowOS with 110 stock and custom kernel.
Camera and flash light work this time. But WiFi and calling still does not work.

I was able to make some progress. However not too much so far :frowning_face:

With the new released sources for kernel and audio techpack I was able to build LOS16. Also I was finally able to flash and run it on my device. As expected nothing is working yet. Means no display at all.
However ADB can be accessed and logs from dmesg and logcat already look quite promising. After some time device automatically reboots.

What drives me little crazy is this Android Verified Boot stuff. Sometimes the bootloader automatically switches back to the other slot before anything is even loaded. Can’t even start TWRP on that slot then. After some flashing (stock dump, vbmeta, LOS images) I get it running somehow, but I didn’t got an idea what is the relevant thing here. Is someone aware of this AVB stuff and can explain how to deal with it during development?

Would be nice if someone could give it a try and help me with it. Next thing for me would be to get the display running.

3 Likes

Did you do adb disable-verity for AVB ?

I couldn’t even boot to TWRP for that slot. However maybe it also helps to do it from other slot. I’ll give that a try next time it happens. I have the feeling that it’s related to rollback protection.

adb disable-verity should disable verity for the two slots.

If you can’t boot to TWRP maybe you should check the “success” status of the slots.

Thanks a lot for trying this. Is there somewhere a guide to help to port lineage?

I can boot to TWRP with the other slot active. “success” status also has an influence on that, just as with flashing GSI images. However I don’t completely understand the checks the bootloader performs before loading the boot image and starting it.

There is the official Android documentation of course. Build system, tools etc. is pretty much the same for LOS. There is just some additional stuff.
For setting up the build environment an existing LOS build how-to can be followed, e.g. for the Motorola G7 what has the same processor platform.
For the configuration I did so far, I tried to write some notes in the readme, but this is far away from complete :wink:

1 Like

It seems Verified Boot has been implemented by Fairphone
Can you please try to rebuild TWRP with these kernel defconfig flags disbaled

https://github.com/mstaz/android_kernel_fairphone_sdm632/blob/38de92e4740862caa6b79bc4816e6405a0c7b43f/arch/arm64/configs/fp3_stock_defconfig#L4888-#L4890

CONFIG_MODULE_SIG_KEY=“certs/signing_key.pem”
CONFIG_SYSTEM_TRUSTED_KEYRING=y
CONFIG_SYSTEM_TRUSTED_KEYS=""

You can follow this post here to build twrp yourself

For OS side you will have to unpack stock boot.img diff initscripts and fstab remove any verity checks here .

From your tree it seems to be okay https://github.com/mstaz/android_device_fairphone_fp3/blob/master/rootdir/etc/fstab.qcom#L36

I will my receive fairphone 3 in 1 week looking forward to join the development .

1 Like

Those configs are used for kernel-module signing. Why do you want to disable that?
TWRP doesn’t even use any of the kernel-modules.
If you want to use prebuilt kernel-modules in OS I have added the fairphone-certificate here: