TWRP for Fairphone 3

I just installed the TWRP using the zip installer, then I installed Magisk and rebooted the system. Everything is fine so far. Thanks !


Well you need to enter a PIN/password for the work profile when you setup one. I’ve used the same as for the screen unlock for convenience reasons. TWRP does not seem to be able to decrypt with the correct PIN/password though.

I ran into an error during compilation of> the kernel, more specifically the dtb-overlay:

DTC     arch/arm64/boot/dts/qcom/apq8016-sbc.dtb
./scripts/dtc/dtc: invalid option -- '@'
Usage: dtc [options] <input file>
make: Leaving directory '/home/android/src/build_TWRP_minimal_manifest/kernel/fairphone/sdm632'
ninja: build stopped: subcommand failed.
20:39:13 ninja failed with: exit status 1

I managed to fix that by compiling with:

export DTC_EXT=$( which dtc );
mka recoveryimage

I would have to look at a recovery.log to further investigate

Ah yeah, I forgot about that.
You can also set it to the (full) path of prebuilts/misc/linux-x86/dtc/dtc which is included in the omni-build tree.
I guess I should just include an updated version of dtc in the kernel.

1 Like

Could you please summarise the steps to do in this topic? …

Ah, thanks, I didn’t connect the dots, sorry.

Sounds fine, that will do then.

Installing with the installer ZIP went fine for me, too (I rebooted into recovery afterwards to check).

(People will inevitably complain about the “Moto G7” text, just wait :wink: .)


I added a pull request.

@k4y0z I noticed there are a number of binaries and binary libs inside the TWRP repo. While the kernel modules can probably be taken from the compiled kernel source and the bagiskboot tool could be compiled as a submodule, I wonder where the stuff in vendor/lib64/ comes from and if that is by any chance open source - or are those proprietary qualcomm libs?


Sorry, had to wait one and a half hours before replying, since I’m a new user… :confused:

The steps are fairly simple:

  • Install the Magisk-ZIP from TWRP
  • Profit

Oops, I’ll change that for the next release.
I used the moto g7 tree as base for the fp3 tree.

There are no kernel modules in the repo.
The libs and binaries are mostly proprietary and are needed for encryption.
They are from the stock images.
Some of them could be built from source, but in the case of TWRP, that would just complicate things.
For building a full custom ROM that’s a different story.


I tried the installer and now it only boots into the recovery, im guessing it broke the OS?

Edit: Yep, phone doesnt like boot slot A, essentially boot loops until it defaults back to slot B. TWRP and fastboot are the only things I can access, there also still isnt a stock ROM available, any ideas?

Or perhaps only restore boot.img from this first?


Mhh, that’s strange.
You had Magisk installed before installing twrp, correct?
Did you do any modifications on system or vendor, or just mount either of these RW?
Did you reinstall Magisk after installing TWRP?

I had magisk before installing, I think I mounted system and data with write but didn’t modify anything, phone doesn’t seem to want to boot TWRP either now, including through ADB, switching it on sends you straight into fastboot.

I didnt reinstall magisk afterwards because it refused to boot anyways, I would recommend people who try the TWRP installed dont install magisk first. I think i’m going to have to wait until there is a custom ROM available.

Mounting as RW is enough to trigger verity

Use the stock dump I provided and flash boot.img using fastboot.
Then reinstall TWRP and Magisk. (in that order)

It didn’t boot, BECAUSE you didn’t install Magisk,
Since you triggered verity by mounting system RW you need to reinstall Magisk, which will disable verity.

I see, I tried to flash the boot.img but im getting this error:
sudo fastboot flash boot boot.img
Sending ‘boot’ (65536 KB) OKAY [ 2.416s]
Writing ‘boot’ FAILED (remote: ‘partition table doesn’t exist’)
fastboot: error: Command failed

I think my partition table is corrupt? Anyway to restore/recreate a partition table?

fastboot flash boot_a boot.img
fastboot flash boot_b boot.img

You can also check which slot is currently selected using:

fastboot getvar current-slot

Or select a slot using
fastboot --set-active=<slot>


I flashed the boot images to both slots and had to format /data, But it booted nonetheless, thank you so much, I dont think I would’ve figured that out by myself. I was almost certain that the phones partition table had been corrupted.

1 Like

If the partition-table had been corrupted, you likely wouldn’t even have had fastboot.

I have added a note, that if you had Magisk installed before TWRP, you need to reinstall it after installing TWRP.


Hi guys,
First of all, thanks a lot for all your work on porting TWRP to FP3.
I was so happy that I immediatly tried to flash a GSI (phhusson’s vanilla AOSP, following XDA’s guide), but it didn’t boot.
I made a full backup with TWRP before that, so I tried to restore it, but i didn’t boot either.
So now, I can’t even get to TWRP anymore, even by fastboot boot twrp.img
No matter what I try to do, the phone gets directly to fastboot mode.
My questions are, how could I completely restore the phone to its stock state ? Maybe by using k4y0z’s stock dump ? Is there a specific order to flash different partitions ?
Thanks for your help.

1 Like

fastboot boot should work regardless.
Are you getting any errors?
I’d first try just restoring system.img.

I don’t have any error when I try to fastboot boot.
But I got one when I try to fastboot flash system system.img using the img from your dump.
Here is the result :
Invalid sparse file format at header magic
Sending sparse 'system_a' 1/5 (522239 KB) FAILED (remote: 'data too large')
fastboot: error: Command failed