[HOW TO] Flash a custom ROM on FP3 with GSI

,

How to flash a Generic System Image (GSI) on FP3

The Generic System Image is an efficient way to have a custom ROM on the new phones. It works thanks to the Project Treble. It makes possible to flash a generic image on the system keeping the hardware relative part intact. (Which also leaves some unwanted app)

Disclaimer

I am not responsible of anything you do with your device. Some wrong actions can brick your phone.

Requirements

  • Unlocked bootloader (this will wipe all your data: ✏ FP3: unlock the bootloader ;
  • Download the GSI of your choice. arch: arm64, A/B slot (usually arm64_bvN images) here is a list ;
  • Download GSI hardware overlay for FP3
  • Download TWRP for FP3 ;
  • [Optional] Download magisk ;
  • Keep your device battery charged up to 70% at least ;
  • Slot a and b have to be in success state :
    To verify, boot in bootloader and type fastboot getvar all, you should see :
[...]
(bootloader) slot-success:b:Yes
[...]
(bootloader) slot-success:a:Yes
[...]

If not, go to the Troubleshooting Tips part.

Flash GSI

Optional : Root

  1. [Optional] If you want to install TWRP, do it by following k4y0z instructions
  2. Boot into TWRP :
    If TWRP is installed, boot into recovery else boot in bootloader and execute: fastboot boot {twrp_image.img} ;
  3. Install magisk from TWRP :
    2.a Select the Install button.
    2.b Find the folder where you download the zip file.
    2.c Select the zip file
    2.d Swipe the slider to install Magisk

Install the GSI

  1. Boot to bootloader
  2. Flash GSI on the system partition
fastboot flash system {gsi_image.img}
  1. Boot into TWRP :
    If TWRP is installed, boot into recovery else boot in bootloader and execute: fastboot boot {twrp_image.img} ;
  2. Mount /system writable
adb shell mount /system_root
  1. Install the overlay
adb push treble-overlay-fairphone-fp3.apk /system/overlay/
  1. Disable verity
adb disable-verity
  1. Reboot to bootloader
  2. Erase userdata, reboot and wait
fastboot -w
fastboot reboot

Note: the APK Magisk Manager may not work with some GSI.

Flash back stock ROM

If you can boot in TWRP :

  1. Make sure you have the latest version of TWRP ;
  2. If TWRP is installed, boot into recovery else boot in bootloader and execute: fastboot boot {twrp_image.img} ;
  3. Make sure you have the option “Mount system partition read-only” checked (in mount) ;
  4. Install the latest flashable ZIP.

If you can’t boot in TWRP :

You can use this script : fp3_flash_stock.
You should probably run it twice to flash both slots.
If you get the 30 seconds warning after that, dont forget to confirm booting with pressing the power button. After booting continue with "get rid of the “30seconds Warning”

Do vendor update

System updates depend on the GSI maintainer, but the others still depends on fairphone.
Please, consider to do a backup of your data first.

  1. Flash latest stock ROM (cf Flash back stock ROM)
  2. Install again the GSI, without erasing userdata (Install GSI step 1 → 6)

Example :

 % adb reboot bootloader
 % sudo ./flash.sh
 % sudo fastboot flash system system_gsi.img 
 % sudo fastboot boot twrp-3.3.1-0_k4y0z-20200202-02-fp3.img
 % adb shell mount /system_root
 % adb push treble-overlay-fairphone-fp3.apk /system/overlay/
 % adb disable-verity
 % adb reboot

Note : If reboot boot to recovery, press power + Vol UP and select boot system.

Here is a little termux app to get notified when a new vendor update is available. It is based on the support page .

Troubleshooting Tips

To get a slot-success=Yes

You need to have the stock rom and do :

fastboot --set-active=a
fastboot reboot # until it completely boot
fastboot --set-active=b
fastboot reboot # until it completely boot

To get back the navigation bar

Use Magisk module MagiskHidePropsConf and set prop qemu.hw.mainkeys to 0.

  • install Busybox for Android NDK by searching for it in the “Downloads” section of Magisk manager
  • install MagiskHidePropsConf by searching for it in the “Downloads” section of Magisk manager
    • otherwise one gets an error message from the props command that comes with MagiskHidePropsConf
    • reboot
  • adb shell and then props following the menu to “Add/edit custom props > New custom prop” to create the qemu.hw.mainkeys property and then setting it to “0”
    • reboot

To disable some useless priv apps

adb shell pm disable-user --user 0 com.qualcomm.qti.qms.service.telemetry
adb shell pm disable-user --user 0 com.qualcomm.qti.qms.service.connectionsecurity
adb shell pm disable-user --user 0 com.qualcomm.qti.qms.service.trustzoneaccess
adb shell pm disable-user --user 0 com.qualcomm.qti.optinoverlay
adb shell pm disable-user --user 0 com.orange.update
adb shell pm disable-user --user 0 com.orange.aura.oobe

You can use adb shell pm uninstall -k instead of adb shell pm disable-user if you experience any re-activation, but you won’t be able to reactivate it without a computer.

To get rid of the “30 seconds Warning” at boot

If you see the warning that shuts down the phone after the 30 seconds :
adb reboot "dm-verity enforcing"

Thanks

Thanks to @k4y0z, @dyd0u, @basxto, @z3ntu, @corvuscorax, @michlx, @Claymore1297, @Ingo
And thanks to all the dev teams and the community for that awesome work
(pm if you’d like to be here and I forgot you :slight_smile: )

Other

Let us know if you tried with an other GSI!

Tested with

[AOSP 9 based]
AOSP 9 (Official, maintained) :white_check_mark:
ArrowOS (Official, not actively maintained) :white_check_mark:
BlissOS (Official, not maintained) :white_check_mark:
LineageOS 16 (Unofficial, not maintained) :white_check_mark:
Resurrection Remix (Official, not maintained) ~
HavocOS (Official, not maintained) :x:

[AOSP 10 based, still in deep development]
AOSP 10 (Official, maintained) :x:
/e/ custom build (unofficial, maintained)
LineageOS 17.1 or LineageOS 17.1 with OTA (Unofficial, maintained) :white_check_mark:

[Android 11 Developer Preview]
android-gsi-11 (official, maintained) :x: (bootloop)

Official/unofficial information come from this gsi list. Please refer to the GSI maintainer if the ROM doesn’t work.

35 Likes

I’m fairly certain that isn’t needed, vendor should already be correct and system is being overwritten anyway by the GSI

1 Like

Actually, during my tests I did that when I get the custom ROM. I’m just waiting for someone to try without these commands to erase it :slight_smile:

I did it to be sure it was in the stock version (magisk mount system and vendor)

I guess that makes sense for vendor, but you are overwriting system with the GSI anyway.
So no reason to flash the original system beforehand.

I agree, that’s why I 'd like someone to try :wink:

If I understand this correctly, it should technically work with most gsi roms?
In that case I’d like to try this with Resurrection Remix this weekend. I had it on previous phone and would like to try it out again

Yes it should! Let us know when you’ll try :slight_smile:
(The gsi is an official image of resurrection :wink: )

Hi everybody. Thanks @pigpig for the guide!
I’ve been using LOS 16 GSI all day, it’s very stable.
I installed Xposed framework (mandatory for signature spoofing, I think), with microG (packaged in Nanodroid to debloat some apps), and it’s going great!
Phone calls, LTE, Wi-Fi, Bluetooth, Cameras, GPS, AP are working fine for me.
I think that the fingerprint sensor works better with this ROM, so maybe the issues here is related to the Fairphone stock ROM?
Also, data-related problems mentionned here and here are not present anymore, so I again guess it’s a bug in stock…
Anyway, thanks again to everybody that made it possible !

3 Likes

I have tried all the steps and it works perfect. But how can i flash the stock rom? I have made the download as linked in post 1.
Thanx

2 Likes

I have also uploaded a flashable ZIP for installing Stock via TWRP:
https://androidfilehost.com/?fid=4349826312261710557

2 Likes

Yes I have downloaded the file. But I can’t flash it in TWRP, get an error message, just try it again.

Can you please send me the recovery.log, maybe I have made a mistake when packing the ZIP.

adb pull /tmp/recovery.log

Error message is "Invalid zip file format"recovery.log.pdf (33.6 KB) please remove .pdf

That is not the ZIP-file I linked to, you are using the dump.
Please use this one:
https://androidfilehost.com/?fid=4349826312261710557

Oh sorry, I’m just downloading it, then I’ll test it again.

The file may be broken, I am currently uploading a new one.
Please if you can try installing it anyway and get me another recovery.log.

… i got an error. recovery.log.pdf (25.4 KB)

… the “Fairphone_FP3_8901.2.A.0105.20191217_12171325_user_release-keys_broken.zip’” i also got an error.recovery.log.pdf (25.4 KB)

I think k4y0z is building a new flashing zip. As I 've seen it is because the flashing zip is for “FP3” device and it see yours as “fp3” device…

Which GSI ROM did you try? Did it work? (for the wiki, and other users :slight_smile: )

2 Likes

I tried Los 17.1 installation ok, but not working (could not open apps) and Los 16 working perfect. Not did that:

fastboot flash vendor vendor.img # Not sure if needed
fastboot flash system system.img -S 522239K# Not sure if needed

1 Like