Efct16 Software Workshop

Switching recovery to Fairphone Open OS recovery

The stock recovery in Fairphone OS 1.5.1 will allow us to do some basic things, such as clearing the cache partition, performing a factory reset, and installing a signed (i.e. official) system update. What it doesn’t allow us to do, is make a backup and install unofficial updates. The latter may be interesting if, for instance, you want install/update Xposed. If you want to know more about this, and as this topic is limited to the efct16 demo, I encourage you to search for more up-to-date (wiki) topics on the forum.

Fairphone open OS comes with a more powerful recovery option, called Team Win Recovery Project (TWRP). There is also a port available here, along with some more information about TWRP. Finally, if you want to discuss pros and cons, see this topic.
One important thing to note is that the Fairphone updater may not play nice with TWRP, so you may have to install system updates manually (which is also explained here).

  1. For the demonstration we used the TWRP version that is included in Fairphone Open OS 16.06. To use it, download a Fastboot image from the code.fairphone.com downloads page. As the links seem to have been cleared up since the release of the newer version, here’s a direct link to Fairphone Open OS 16.06 in case you need/want it. The name of the file you’re looking for ends in image-userdebug.zip.

  2. Unpack the zip file you’ve downloaded, but keep a copy of the zip file if you want to switch to Fairphone Open OS or want follow along the steps to Sailfish.

  3. Open a command line and navigate (cd followed by a directory name to enter it, use tab to auto-complete/cycle through file names. Use dir to list the contents of the current folder) to the folder in which the image has been unpacked.

  4. Make sure the phone is connected. If it is on, with USB-debugging enabled and has your computer authorised for adb, you can reboot into the bootloader (or fastboot mode) by typing adb reboot bootloader. If the phone is off, hold the volume_down button and the power button to boot into the bootloader. You will see a ‘Fairphone powered by Android’ screen - the phone will remain in this state and wait for commands.

  5. You can then flash the recovery image using this command: fastboot flash recovery recovery.img

  6. Reboot the phone by issuing the command fastboot reboot. If you want to go straight to the new recovery, press and hold the volume_up button on the phone before issuing the reboot command/during the reboot. If you want to go to recovery from a normally running system via adb, type adb reboot recovery. If the phone is off, hold volume_up whilst starting the phone.

Making a backup

If all went well, you’ve now accessed TWRP. If TWRP asks you whether you want to mount /system with write access, you can answer no. When TWRP is running, the part of the phone where user data is stored will also be visible in windows. As for the efct16 demonstration we don’t have an SD card, this would be a way to copy that data to the computer. This could also be done via adb. As TWRP does not currently support encryption, this may not work for encrypted data. For other things like apps, app settings, and the system in general, the TWRP backup is more useful. Choose the back up option, select all the partitions you want to backup (in the demo we skipped userdata as this is where the backup is stored if there is no SD-card, and there was no time to test whether this would be a problem). Options to consider are using compression (smaller files, takes more time) and calculating md5 sums (which is a good idea).

As flashing Fairphone Open OS wipes all the data from the phone, having the backup stored in the phone is not very useful. The phone memory should be visible in windows, so the TWRP folder can be copied over that way. Alternatively, if your computer is authorised for adb, you can copy the files from a command prompt: adb pull /storage/sdcard0/TWRP will copy the backup files from the phone to the directory that the command prompt is currently in.