TeamWin Recovery Project – or TWRP for short – is a completely touch-based custom recovery that was originally built for Nexus devices, but has since been made available for countless other smartphones and tablets, both in the form of official and third-party builds.
TWRP is the first custom Android recovery because of how many devices it supports and how simple it is to use. But installing it in the first place hasn't always been the simplest thing to do — so far. With the aid of the Magisk module, you can finally use one Android device to flash TWRP to another.
Google disabled Android's native ability to send ADB and Fastboot commands to other devices in an earlier update, but this mod brings back the capability. Developers osm0sis and Surge1223 are the ones who made magic happen, so big props to their work. The initial setup is the hardest part of the entire process, but once that's completed, it's easy to keep going in the future.
What You'll Need
One Android device that was rooted with Magisk (host phone)
Another Android device with an unlockable bootloader (target phone)
USB data cable or OTG adapter for connecting the devices
The main rooted device should have USB OTG support
You will need two Android devices for this to work, and one should already be rooted. The already-rooted device takes the place of the computer in this instance.
Step 1 : Install ADB & Fastboot for Android
On the Android device with root access, open Magisk Manager, tap the menu on the left, then go to "Downloads." Tap the search icon, then type in "adb" to locate theADB & Fastboot for Android NDK module. Tap the download arrow, hit "Install," then tap the "Reboot" button to activate the module.
Step 2 : Download TWRP for Your Device
Now you need to grab the TWRP image file for the device you want to install the custom recovery onto. Grab your TWRP image from the link below and save it to the "Download" folder on both devices. Also, rename the file to "twrp" to make things easier for later on in the guide.
Step 3 : Install the Termux App
To make use of the Magisk module you installed from Step 1, you'll need to have a terminal app. Termux is one of the best such apps, so hit up the link below to get it installed on your already-rooted device.
Play Store Link: Termux (free)
Step 4 : Enable USB Debugging
On the target phone, go to Settings –> About Phone and tap "Build Number" 7 times quickly to activate Developer Options. Once done, head to Developer Options either from Settings –> System –> Advanced or from the very bottom of your Settings app. Finally, enable the "USB Debugging" option.
Step 5 : Connect the 2 Android Devices
If both phones were made in the last few years, you'll just need a standard USB C cable to connect them. One with the modern, reversible connector on both sides. But if one or both of the phones has a micro USB port, you can find adapters on Amazon using the links below.
Step 6 : Allow USB Debugging Permission
Once the two Android devices are connected, the target phone should show a new popup right away. Remove and reconnect the USB cable for the secondary device if this doesn't happen to try again. Now, tap "Always allow from this computer," followed by "OK" to confirm the choice.
Step 7 : Grant Root Access
On the rooted device, open the Termux app, type the following command, then press enter.
This will trigger a superuser request from Magisk, which is required when executing higher-level system commands. Tap "Grant" when prompted, then you're all set here. You'll need to run the "su" command before sending ADB or Fastboot commands each time, but you won't be required to grant the superuser request again.
Step 8 : Verify Your Device Connection
Just because the two devices are connected to one another doesn't mean they are actually communicating correctly. To check this, type the following command on the rooted device through Termux, then press enter.
The above command will check any connected devices that can communicate via the ADB interface. If everything worked as intended, you should see a device ID under the "List of devices attached" line.
Step 9 : Boot into Fastboot Mode
Before you can run any Fastboot commands, you'll need to boot your secondary device into a special mode for this very thing. On the rooted device with Termux, type the following command, then press enter.
adb reboot bootloader
This will send the secondary device into its native bootloader menu, which is also known as "Fastboot Mode."
Step 10: Locate the TWRP File
At this point, you'll need to redirect Termux so that it can locate the twrp.img file you downloaded from Step 2. Using the same rooted device terminal, type the following command, then press enter.
As mentioned, this will redirect the location of the terminal window to the "Download" folder on your rooted device. This is the specific location where the twrp.img file is, so you need to make sure you enter the command exactly as it appears.
Step 11: Check Your Partition Layout
Now it's time to send over the twrp.img file to the secondary device so you can get TWRP installed onto it. But the instructions are different depending on whether or not the target phone supports Android 7.0's A/B partition layout.
So first, if you're not sure whether the phone you want to install TWRP on has A/B partitions, install Treble Check from the Play Store. Open the app and it will say either "Unsupported" or "Supported" in the Seamless System Updates section. If your phone is supported, you have A/B partitions and should follow the corresponding instructions in the next step.
Step 12: Install TWRP
If you have an A/B partition target device, open the Termux app on the host device and type the following command, then press enter.
fastboot boot twrp.img
It will temporarily boot TWRP to the secondary device; however, you will still need to run a permanent installer after that. If you don't do that, TWRP will vanish after you reboot your system.
So, tap "Download," navigate the Download tab, and then press the "Download File" button. Tap the twrp.img file, select "Install Ramdisk Recovery," and then drag the slider to continue. If the cycle is over, push the home button, go to "Reboot," then "Recovery," where you'll be greeted with a permanent version of TWRP!
If the target phone does not have A/B partitions, open Termux on the rooted device and type the following command, then press enter.
fastboot flash recovery twrp.img
This command will permanently install TWRP onto your device without any extra work on your part due to how devices with an "A-only" partition layout work. The final thing you need to do is type the following command, then press enter.
adb reboot recovery
At this stage, your secondary device will automatically reboot to the TWRP main menu. The USB cable or OTG adapter can now be removed safely. You've successfully enabled TWRP and you can do whatever you want to do with famous custom recovery without being bound to a computer.