It gives me great pleasure to present to you TWRP on the Samsung Galaxy Fold. Your foldable phone just became even more flexible.
This project picks up TWRP where Chris Williamson left off. Chris produced the initial release of TWRP for the Fold, which combined a custom kernel sporting some extra features with a pre-rooted TWRP image.
Chris asked me to take over the development of TWRP for the Fold to allow him to concentrate on kernel development for the device, and I was happy to oblige. My goal is to offer you the most functional build of TWRP that I possibly can, whilst making no assumptions about your desire to root the device or run a custom kernel. For that reason, the kernel I am supplying as part of this project is as close to stock as possible, with only the minimum number of changes required to allow TWRP to function, and with no added features. For the same reason, the images I provide have not been pre-rooted with Magisk.
Rooting Samsung system-as-root devices
All new devices launched with Android 9 are required to be factory-configured as system-as-root devices. The ramdisk image formerly found in boot.img is now merged with /system.
For Samsung devices such as the Galaxy Fold, this means that boot.img can no longer be used to root the device. Instead, Magisk is installed in the recovery partition and the user must subsequently always boot from that partition, regardless of whether TWRP or Android is desired. The device's hardware keys are used at boot time to select between Magisk-rooted Android and TWRP.
Before doing anything else, back up your data now if you have any.
If you are installing TWRP on a brand new device, you must first unlock its bootloader. Select OEM Unlocking from Settings → Developer Options, then reboot to Device Unlock mode to actually unlock the bootloader. This will have the side-effect of resetting the device.
If you are installing TWRP on an unrooted device, it is crucial that you also flash the attached vbmeta.img file at the same time. Simply include this in a tar file with the TWRP image for your device (renamed recovery.img) and flash them together. You must reformat /data after doing this.
If you fail to neutralise the device's vbmeta protection before rebooting, the device's anti-tampering protection will be triggered and you will be unable to boot either Android or TWRP. A full reinstallation of stock firmware will be required and your device may be left in KG State Prenormal, requiring time-consuming extra steps to restore its ability to accept unofficial images again. Do not fail to neutralise vbmeta.
If you have already rooted your device with Magisk, vbmeta has already been disarmed and you may proceed with installing TWRP.
As noted above, the TWRP images supplied here are not pre-patched with Magisk. If you wish to dual-boot TWRP and Android, you must patch the recovery image with Magisk before flashing it. Version 20.2 (or 19.4) of Magisk is recommended for this. Versions 20 and 20.1 contain a serious bug that will render the recovery partition unbootable after patching. Please see John Wu's excellent step-by-step instructions for rooting the 2019 generation of Samsung Pie devices with Magisk.
An altogether simpler way of working is to flash the TWRP image on demand, only when required. After finishing your work in TWRP, simply replace TWRP with a Magisk-rooted stock recovery image and reboot to Android. I personally recommend this swapping approach, as it frees both the TWRP maintainer and the user from constantly updating the TWRP image to ensure it contains a kernel that is compatible with the version of the firmware on the device.
Here is a basic sample script that will check whether the current environment is Android or TWRP, flash the appropriate recovery image for the other environment, then reboot to it. You can easily adapt it to fit your needs.
twrp_img=/sdcard/twrp/twrp-3.3.1.img stock_img=/sdcard/twrp/recovery-ask2-magisk.img if [ -f /sbin/magisk ]; then # We're in Android: Switch to TWRP. # infile=$twrp_img else # We're in TWRP: Switch to Android. # infile=$stock_img fi dd if=$infile of=/dev/block/by-name/recovery bs=$(stat -c%s $infile) && reboot recovery
TWRP is offered here as an assortment of recovery image files. To use with Odin, first rename the appropriate file recovery.img and then tar it.
Ready-made tar files are not supplied by me, because this would double the number of files to be maintained, and it is trivial to generate a tar archive on any modern computing platform, including on the Fold itself.
The Fold, like all 2019 Samsung Pie devices, utilises file-based encryption (FBE) by default. The use of encryption in TWRP on Samsung devices is invariably problematic, however, and encryption is therefore routinely disabled by users wishing to use TWRP. If this is not done, your files will remain unreadable to TWRP.
To remove encryption from your device, please flash the Samsung multi-disabler after installing TWRP, and then reformat /data again. Do not skip this step, even if you have already formatted /data one or more times thus far.
The images below are known to be compatible with the firmware revisions stated. Results on other revisions will vary.
The F907B images have been personally tested and verified by me on my own Fold 5G prior to release. The F900F images should be of comparable quality.
Latest release for F907B (ATA1 firmware)
Latest release for F900F (ATA3 firmware)
- TWRP is currently displayed only on the device's main (inner) screen.
- Haptic feedback is currently unavailable in TWRP.
Frequently Asked Questions
Q. Why do you offer a separate build for each device with landscape orientation?
TWRP source code
A. The aspect ratio of the main (inner) screen 4.2:3 is such that TWRP on this device looks good in both portrait and landscape orientation. In portrait mode, the clock and battery meter are shifted to the left to avoid the camera notch. In portrait mode, the entire image is shifted to the right to avoid the notch.
See the gallery of images below, or simply try each version of TWRP on your device, to discover which orientation you prefer.
TWRP device trees
Kernel source code
For support or just to talk about the device amongst friends, please join our small Telegram group dedicated to the Galaxy Fold.
I am indebted to Chris Williamson (@chrisaw) for laying the foundations for TWRP on the Fold. And thanks in no small part to him and his contagious enthusiasm for the device, I'm now also indebted to Samsung for the purchase price of a Fold 5G.
Thanks to @osm0sis for AIK, a tool without which working with boot images would be far more tedious than it already is.
Thanks to Samsung for engineering this amazing device in the first place.
And last but not least, thanks to my wife, Sarah, for her tolerance of my expenditure on gadgetry.
TWRP for Samung Galaxy Fold, Tool/Utility for the Samsung Galaxy fold
Current Stable Version: 3.3.1-23_ianmacd
Stable Release Date: 2020-02-24
Last Updated 2020-02-24