Everything about Fairphone 5 modding:

This time I will do things differently on my blog; I will just document everything useful I find out or do with the Fairphone 5 in one place without a goal in mind, as long as I am using it. Everything from modding to installing UbuntuTouch will be documented here:

A few important things first:



Installing LineageOS:

Finally, one year after the release of the Fairphone 5, LineageOS is officially available. The installation is a little more involved than it was back in the Android 10 days, but consists of little more than unlocking the bootloader, flashing some custom boot and vendor partitions and then using them to install LineageOS completely. It is by far (as usual on Android) the best AndroidROM you can use. With a de-Google script, you can remove the last few remnants of Google-BS and you have a really clean AndroidOS. I have a script linked in this entry that I use and it should work with LineageOS too (Just remove the APK and DISABLE parts, those are only needed on stock FairphoneOS! IDK what they would do on LineageOS). If you want to install it too just follow the official instructions.

https://wiki.lineageos.org/devices/FP5/ https://wiki.lineageos.org/devices/FP5/install/ https://download.lineageos.org/devices/FP5/builds
https://github.com/CatWithCode/Fairphone5-Tweaks/blob/main/deGoogle/DeGoogle_Fairphone.sh



ACC (ACCA) on FairphoneOS or /e/OS:

Currently, ACC does not work on the available Android ROMs. It will probably work on all custom ROMs, but I've only tested it on more or less two stock ROMs (FairphoneOS and /e/OS) and neither of them worked. I'm really sure it has something to do with the read-only system partitions. It should work on GSI's BUT I have tested and used them a lot in the past and they more often then not, not worth the effort and are only a good option if you have non good native port's. Currently /e/OS is the best way to get a good LineageOS Port on your Fairphone 5.

https://github.com/VR-25/acc https://f-droid.org/packages/mattecarra.accapp/ https://github.com/MatteCarra/AccA/releases



Android Auto with CustomRom's or /e/OS with and without* MicroG (ROOT):

I moved it to it's own entry because the amount of work makes it worth it:

/Blog/2024.02.06_AndroidAuto_without_Google/AndroidAuto_without_Google.html



Switch stock/"/e/OS" builds/branches/channels from Stable to DEV without losing userdata:

It is not recommended and (can)/WILL break things. But you can do it;

Open the "flash_FP5_factory.sh"-file and comment out the following lines with a "#";

It sould go from this:

... flash_image_ab_or_abort "${sn}" shrm "${IMAGES_DIR}/shrm.img" "$FASTBOOT_BIN" -s "${sn}" erase userdata "$FASTBOOT_BIN" -s "${sn}" erase metadata "$FASTBOOT_BIN" -s "${sn}" --set-active=a ...

To this:

... flash_image_ab_or_abort "${sn}" shrm "${IMAGES_DIR}/shrm.img" #"$FASTBOOT_BIN" -s "${sn}" erase userdata #"$FASTBOOT_BIN" -s "${sn}" erase metadata "$FASTBOOT_BIN" -s "${sn}" --set-active=a ...

That's it. Now run the file and you should have the new firmware on your device WITHOUT losing your userdata.





Battery Runtime Scoreboard:

All the setups I used ranked on battery runtime (No scientific data, just daily usage, charge limit at 83% for battery health):

  1. /e/OS [Without MicroG and /e/Services) - REALLY GOOD!; 3 days on a charche with light use. About 8 hours with the screen on at normal to low brightness.
  2. Fairphone 5 Stock-Rom [deGoogled] - OK; About 1.5 days on a charge, about 5-6 hours of screen time. Mostly due to problems in the OS, caused by parts of the system being disabled and/or uninstalled, causing errors in many places.
  3. Fairphone 5 Stock-Rom - Meh; The usual problem with using Google services. About 4-5 hours of screen time and 1 day maximum battery runtime.





Fixed screen refresh rate (sometimes):

Not much to it. Just force a high refreshrate (as far as the normal system will allow). This will fix wrong refreshrates on other roms like /e/OS. These ADB commands are also in my scripts. There is a bug in the current /e/OS build that breaks 90hz. After locking and unlocking the phone, the screen feels... weird. No idea why. Currently only 60hz works properly on /e/OS:

https://source.android.com/docs/core/graphics/multiple-refresh-rate

Command's used (ALWAYS READ THE OFFICIAL DOCUMENTATION! THIS IS ONLY FOR ARCHIVING PURPOSES!):





Installing /e/OS:

They have released the official /e/OS port for the Fairphone 5. The first release has a few minor issues (90hz mode randomly turns off, boot animation is a bit buggy with magisk installed, the system is sometimes laggy for a few seconds) but it is a good port and at the time of writing a good and easy way to de-Google the Fairphone 5. I wrote a script to remove MicroG and /e/OS components from the OS without breaking anything. I do not need MicroG and do not use any /e/OS services. You can find it in my "Fairphone5-Tweaks" repository. The Fairphone 5 can also be purchased with the /e/OS pre-installed for 50€ extra if this is important to you:

There are stable builds, which is updated every few months, and a dev builds, which is updated once or twice a month and can be viewed like LineageOS Nightly-Builds. Pick your poison. I use dev. Switching between dev and stable is possible, but not recommended by the creators of /e/OS (so much so that you will find NOTHING on how to do it for them). I have added how to do it to this blog post. Your welcome :3.

https://doc.e.foundation/devices/FP5/install
https://murena.com/shop/smartphones/brand-new/murena-fairphone-5/
https://github.com/CatWithCode/Fairphone5-Tweaks

Command's used (ALWAYS READ THE OFFICIAL DOCUMENTATION! THIS IS ONLY FOR ARCHIVING PURPOSES!):

  1. Downloading the official Install Archive from there Website: https://doc.e.foundation/devices/FP5/install
  2. Rebooting the phone into the bootloader adb reboot bootloader
  3. Extract the archive, open a bash in it, make the installer executable and run it: chmod +x flash_FP5_factory.sh && ./flash_FP5_factory.sh
  4. Once everything is done and the phone has booted, you can use my script to clean up the OS to have a clean plate to work from (!!!Important!!! Take all possible permissions from BlissLauncher. With permissions, BlissLauncher will crash!) and/or root it (do not reuse your old modded boot.img! The /e/OS-Boot.img is different! You need to redo the rooting part to have a usable rooted boot.img to boot from for the full Magisk installation!).





de-Google of the Stock-Rom:

At the time of writing, there are more or less no CustomRoms. They are all under development. This meant that I had to de-google the stock rom as much as possible without breaking things. After a lot of testing, I found a config that keeps everything working, including updates, without modifying the Stock-Rom at all, while cleaning it up as much as possible without root (The stock rom is closed source, which means cleaning everything up and making sure your done is impossible). I used Universal Android Debloater and some other tutorials on the internet to create a script. You can find it in my "Fairphone5-Tweaks" repository:

https://github.com/CatWithCode/Fairphone5-Tweaks

You need to replace almost every app on your phone. The script will also install any APK it finds in the Assets/Basic/ subfolders. Make sure the apps are the correct architecture! I recommend installing them all on the phone itself with the F-Droid and Aurora App and then dumping them with an extractor. Then you can create your own apk folder for easy reinstall after a reset.

GPS provider and WebView needs also to be swaped out. The issue is that Bromite is more or less abandoned and other WebView replacements are not well supoorted. At the moment it dose not theme worth it. GPS provider can be changed to one in you area.

IMPORTANT:

>>> READ THE Aurora-Store FIX-SECTION!

>>> "Google Play Services" and "Google Services Framework" are only disabled! You need them to update the stock rom via OTA! Enable both and you can update again! A temporary uninstall would soft-brick this functionality! You could flash each OTA update (could not find any offical zip's) with the recovery, but this could lead to bricking and slot desynchronisation!





Fixing wrong architecture in the Aurora-Store:

This was so annoying to figure out. Aurora-Store NORMALLY downloads the right architecture of Apps for the phone... NORMALLY. It had the correct default phone architecture selected in the settings, but many apps would install but not work. Fixing this is as simple as going into the Aurora Store device settings and selecting "Google Pixel 7a" with "arm64-v8a". Examples of apps with this problem were: Discord, Komoot, Maps, SteamLink, Spotify, ... . It is also good to know that a lot of app's today are multi apk, means: Many of them cannot be easily backed up and restored:

https://forum.fairphone.com/t/a-lot-of-apps-not-working-with-logs-discord-komoot-maps-steamlink-and-spotify/102736



Rooting the phone (Any Stock-Rom/Custom-Rom:

As far as I have seen it is recommended on modern Android that you only BOOT a modified boot image (NOT FLASH) and then use Magisk in Android to directly root the installed bootloader:

https://xdaforums.com/t/rooting-fp5.4634181/#post-89111662


Command's used (ALWAYS READ THE OFFICIAL DOCUMENTATION! THIS IS ONLY FOR ARCHIVING PURPOSES!):

  1. Getting the offical Firmware: https://support.fairphone.com/hc/en-us/articles/18896094650513
  2. Extracting the boot.img
  3. Installing the Magisk-App on the Phone: https://github.com/topjohnwu/Magisk
  4. Pathing the boot.img with the Magisk-App
  5. Copy modded boot.img to PC
  6. adb reboot bootloader
  7. fastboot boot modded_boot.img
  8. Opening Magisk-App and NOT pressing Yes at the further modifications needed popup
  9. Select Install Magisk and choose direct install (For OTA: Open Magisk, Uninstall Root (DON'T REBOOT!), Install OTA-Update WITHOUT REBOOT, Open Magsik and let it Install into the "Inactive Slot", Now reboot! Don't do this if no Computer is nearby to restore your phone. Soft-Bricks are possible with this!): https://topjohnwu.github.io/Magisk/ota.html
  10. Reboot
  11. Opening Magisk-App and pressing Yes at the further modifications needed popup
  12. Reboot





Unlocking the Phone / Reinstalling the Stock Rom:

For some reason, you have to unlock the phone's bootloader and critical partitions to reinstall the stock ROM. An interesting part of doing this was that I never encountered any "warranty void" stuff on the way, neither on the phone nor in the OFFICIAL guides. They just mention that you need to flash the phone back to stock (and preferably lock the bootloader again) if you want to claim warranty. I am no expert, but as far as I can see, that seems to be the way they do it. Voiding the warranty because of software modifications is illegal anyway as far as I know, but still very cool that they are so open about it (DO NOT QUOTE ME OR USE THIS AS A SOURCE! THIS IS JUST UNCONFIRMED STUFF I PUT TOGETHER MYSELF! IF YOU SCREW UP, YOUR LOSS! I AM NOT A LAWYER AND THIS IS NOT LEGAL ADVICE! THIS IS JUST ME RAMBLING!!!):

https://support.fairphone.com/hc/en-us/articles/10492476238865-Manage-the-Bootloader

One VERY annoying thing is that you need an unlock code from them. And from a little bit of testing I saw that your code is checked by a server. This means that if you create 3 unlock codes, only the last one will work. This is one of the only really bad points on the phone for me at the moment. If the server or the company ever shuts down the bootloader will probably be locked forever and the software will become obsolete.

https://www.fairphone.com/en/bootloader-unlocking-code-for-fairphone https://support.fairphone.com/hc/en-us/articles/18896094650513


Command's used (ALWAYS READ THE OFFICIAL DOCUMENTATION! THIS IS ONLY FOR ARCHIVING PURPOSES!):

Unlocking:

  1. Settings → About phone → scroll down to IMEI (SIM slot 1)
  2. Settings → About phone → Model & Hardware → Serial number
  3. Get your unlock code: https://www.fairphone.com/en/bootloader-unlocking-code-for-fairphone
  4. Settings → About phone → 5x Build number
  5. Settings → System (→ Advanced) → Developer options
  6. OEM unlocking
  7. USE THE UNLOCK CODE (Internet connection required)
  8. adb reboot bootloader
  9. fastboot flashing unlock
  10. YES
  11. Settings → About phone → 5x Build number
  12. adb reboot bootloader
  13. fastboot flashing unlock_critical
  14. YES

Flashing Stock Firmware:

It could happen that you only get the following output without any flashing of files: "Info: One Fairphone 5 in fastboot mode found (serial number: XXXXXXXX).". This means that executables in the subfolders can not run and are missing the flag that allows them to be executed. Run "chmod +x *.*" in the main folder and every file that was in the archive should now be executable.

  1. adb reboot bootloader
  2. Extracting the latest Firmware Archive: https://support.fairphone.com/hc/en-us/articles/18896094650513
  3. Opening a Terminal in the folder and executing ./flash_fp5_factory.sh and following the prompts.




Sources: