✏ Porting TWRP recovery

Tags: #<Tag:0x00007fefbcbab1a8> #<Tag:0x00007fefbcbaafa0> #<Tag:0x00007fefbcbaac30>


Hi Rob,
yes, first of all, you need to set your phone into bootloader mode again, just as you did in the rooting tutorial. However in your example, you changed the path of your cmd by typing cd … twice. You eneded up being in c:\ where your .img file is, but from there the fastboot command is not reachable, since the program is located in the minimal adb and fastboot folder. Instead do the following: run the shortcut from your desktop to go to the commandline, then type:

fastboot flash recovery c:\recovery.img

The command will find both the fastboot.exe and also your recovery.img and you should be good to go…



By the way, the Fairphone sources include building a recovery image - I was able to go back from TWRP to the stock recovery using that. (Not sure if it contains closed-source parts though.)


Did they change the ota? I downloaded it a while ago, but in the zip I downloaded there was definitely no recovery included… Can’t check the current one though, so since I’m on the bus ATM…


Sorry, my bad… Some unpacking error…


If you want to make a backup of all the partitions except the original recovery: Flash (or boot; see first reply to this post) TWRP, go to Advanced -> Terminal Command and just click “Select”

Then enter the first of the following 3 commands and press “Go”. Delete the line and enter next command etc

  1. mkdir /sdcard/backup

  2. for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ;do dd if=/dev/block/mmcblk0p$i of=/sdcard/backup/part$i.dd; done

  3. dd if=/dev/block/mmcblk0rpmb of=/sdcard/backup/partrpmb.dd

You will now have a raw image of all the partitions on the phone on the internal storage. Move them to a safe place on your computer. They can be flashed back in case of emergency. No instructions here, cause really dangerous.
This will not copy data as it shares a partition with the internal storage


@Moritz: Thanks for your very helpful and kindly comments, as well for the compilations work.

Thanks to you guy I finally could install successful GravityBox to my rooted FP2 !!!
I hope now better times start for the yet difficult relation between my FP2 and me (who are used to a GravityBoxed FP1)…

I updated the wiki for a more detailed installation guide for your compiled recovery.img!

Thanks, Thanks, Thanks!


Today I finally had time to flash twrp

Two questions:

  • any plans to implement reading an encrypted /data partition?
  • TWRP does not see my sd card. After rebooting, stock os does see it. Does anybody else experience this? (Edit: works if I allow /system to be rw)


@therob good to hear that! :slight_smile: did you succeed in hiding the icon for the second ,empty sim? It was the main reason I installed gravitybox, but it simply did nothing on my FP2…


Since I use both SIMs I cannot check this right now. But if you wish, I can give my FP2 a peeling and can check it.

What I struggling with GB@FP2:
I could not manage until now, to use the GravityBox-Shortcut-Settings as I could with the FP1. There I had the setting, that by a sweep-down of the status-bar at the side (e.g. right), directly the settings menu with configurable ssetting toggles appeared and not show the notifications first…

I now activated it also at the FP2, but still the annoying Android5.1-setting appears, and still only after two sweeps, what is the most annyoing behaviour of this damn setting panel.

So either I still missed any setting in GravityBox, or it does not work with FP2 / Android5.1…hm…

I just opened a wiki about GravityBox@FP2 where we can discuss working and not working features…


Yes, I know that. But it doesn’t work for me. Also clock is wrong when I boot into normal system until it receives the current time from the network. I’ve read something that there is no RTC in the system. Maybe I also messed something up on building my system. Do you use the stock firmware?

Problem is that some hardware parts are used for encryption. I added a link to a thread where some people seem to got it running. Unfortunately I didn’t had time so far to try it. But please feel free to do so and post your experience here :smile:

Maybe you need to explicitly mount it in TWRP. I’m not totally sure but I think I needed to do this as well.



You do not neccesarily need to flash TWRP for using it. Instead of flashing it you can boot it straight from your PC. This is what I recomment before flashing anyrhing anyway. In the command line simply replace ‘flash’ by ‘boot’.
This way you can probably even backup the original recovery.
However, I don’t know what I would want with this crappy piece. :wink:


Yes, right now I’m seeing up anything (again) for compiling system AND twrp… Just thought because this here is some kind of “reference implementation”.

Iirc, after allowing twrp to make modification to the system, it also was able to mount the SD card…


I use the stock image and everything works with the clock, even after reboot. :slightly_smiling:


Thanks, #Max_S. I have done straight this:

And it works! I have TWRP and XPosed, XPrivacy and Gravity box running!


Same here. All works fine TWRP, Xposed, XPrivacy, GavityBox. Still on stock rom. :slight_smile:


Maybe a stupid question - what is the impact of encryption on using TWRP (I understood that the port currently does not support device encryption)?

Will it work in general, with the exemption of accessing user data? Or is the complete userdata partition encrypted, rendering recovery almost useless?

Thank you!


You just can’t access userdata from TWRP.


Hey guys,

I just followed the installation guide in the first post and it works like a charm. I’m still using the stock rom and installed xposedv79-sdk22-arm. Thank you very much for your effort, Max! Finally this thing feels like a fairphone again (instead of a proprietary sh** that I don’t really own) :smiley:
Now I can focus on setting up my beloved first batch FP1 for my mom :wink:


Note: by now v80 of exposed framework is available from the link mentioned above. Not sure what difference it makes, but it installs just the same as v79 on my FP2…


So finally I tried to take a copy of /dev/block/platform/msm_sdcc.1/by-name/recovery
by using
dd if=/dev/block/platform/msm_sdcc.1/by-name/recovery of=/storage/sdcard1/recovery.img
which gives me a 16MB file, which sounds reasonable. But I am not sure if I actually copied the right source location …”

Yes, you did:
After installing TWRP-Recovery I successfully reinstalled the stock-recovery with this method. Great, thanks a lot