TWRP auto porter
Published: 2023-05-02 12:39:29

# TWRP auto porter

## Requirements

* Stock recovery.img (extracted from the firmware or by dumping the phone's ROM using Miracle Box, SP Flash tool etc )
    
* Download MTK Auto TWRP recovery porter by Team Hovatek (links at bottom)
    

## STEPS:

1. Extract the [MTK Auto TWRP](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/TWRP%20auto%20porter/V1.0%20(Stable%20with%20support%20for%20android%205,%206%20&%207).zip?raw=true) recovery porter compressed file
    
2. Copy the stock recovery.img into the stock-recovery folder; if you have recovery-sign.img then ensure to rename it to recovery.img
    
3. Double-click Auto TWRP Recovery Porter.exe
    
4. Tap Enter to confirm that you've copied your stock recovery.img into the stock-recovery folder
    
5. Enter the option for your Android version (5 for Lollipop, 6 for Marshmallow, 7 for Nougat, 8 and 8.1 for Oreo & 8.1g for Oreo-Go) and tap Enter
    
6. Wait while our tool ports the TWRP recovery
    
7. You'll find your ported TWRP recovery in the output folder.
    
8. Flash the recovery image to your device
    

If the ported TWRP doesn't work (ie the phone simply boots back to homescreen) , then ensure you're using stock recovery from your current rom build also try both versions of the TWRP porting tool; one might work for you where the other one fails

---

## Links

[MTK Auto v1.0 | TWRP Stable with support for android 5, 6 & 7](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/TWRP%20auto%20porter/V1.0%20(Stable%20with%20support%20for%20android%205,%206%20&%207).zip?raw=true)

[V1.2 (Beta Testing with support for android 5, 6, 7, 8.0, 8.1 & 8.1go)](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/TWRP%20auto%20porter/V1.2%20(Beta%20Testing%20with%20support%20for%20android%205,%206,%207,%208.0,%208.1%20&%208.1go).zip?raw=true)

[V1.4 GUI (Beta Testing with support for android versions same as v1.2 above)](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/TWRP%20auto%20porter/V1.4%20GUI%20(Beta%20Testing%20with%20support%20for%20android%20versions%20same%20as%20v1.2%20above).7z?raw=true)

[V1.8a GUI (Pie and Beta Testing Q only)](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/TWRP%20auto%20porter/V1.8a%20GUI%20(Pie%20and%20Beta%20Testing%20Q%20only).7z?raw=true)

[V1.9 GUI (Kitkat to Oreo TWRP 3.6.0)](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/TWRP%20auto%20porter/V1.9%20GUI%20(Kitkat%20to%20Oreo%20TWRP%203.6.0).zip?raw=true)

---

## Troubleshooting

### How to fix TWRP rotated display at 180 degrees

STEPS:

1. Unpack your TWRP recovery by dragging the recovery.img onto unpackimg.bat within the Android image kitchen tool's folder
    
2. Copy the downloaded [libminutwrp.so](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/%5BTutorial%5D%20How%20to%20fix%20TWRP%20rotated%20display%20at%20180%20degrees/libminuitwrp%20180%20degrees.7z?raw=true) file into the folder /ramdisk/sbin and if requested, overwrite the existing file
    
3. Repack the TWRP by double clicking repackimg.bat
    
4. Flash, test and confirm if the new TWRP (image-new.img) has it's displayed fixed
    

There's no guarantees that this works for all devices / chipset type, you'd have to test it yourself to find out. So far it's worked on two different mediatek chipset types i.e MT6580 & MT6737 This might work for other devices with TWRP rotated at 270 degrees, but you'll need to find a fixed TWRP, unpack it and copy the libminutwrp.so from within /ramdisk/sbin folder and try it on your TWRP

```plaintext
now i have here a phone and you can see the hardware buttons down here but you can see twrp's buttons up and everything is inverted
now notice that normally install should be here and reboot should be here, if i click install i'll get reboot, which means that the display has been rotated to 180 degrees
now to fix this we are going to need a tool for unpacking the recovery
you can download android image kitchen then you'll your twrp recovery and you'll need this file from another device with this same problem but has a twrp that has been fixed
so basically you need a phone that has it's twrp fixed to display correctly. so in my case i already have the file
we are going to be sharing this file, the link will be in the description
so lets begin, we'll simply drag and drop recovery to unpack
now locate ramdisk, sbin, then copy this file into sbin folder, of course we'll have to replace the existing file
this is the name of the file just incase
then we go back and we'll repack
and we'll have our new image, so i'm going to quickly flash this to the phone
let me reboot to bootloader, which means here then bootloader should be nope..
well, this device has it's hardware button stuck
i'm currently trying to boot to fastboot mode, so i'll quickly launch powershell window
nope, not yet, we need to wait for the phone to boot properly
okay, now i connect it again
so my device is in fastboot mode but you can't see it because the screen is blurred
i see what happened
okay then i reboot to recovery mode
well, there you go, you can see that the screen is fixed, the display rather
now from here you can see when i click install, i get install and everything is how it should normally be
so guys that's how you fix twrp rotated screen, i don't know if this works on every device but you test and tell us
```

### How to fix or enable ADB and MTP in TWRP recovery

Requirements TWRP recovery, you can port TWRP for your device \[Notepad++\] (https://notepad-plus-plus.org/downloads/) [Android image kitchen (AIK)](https://forum.xda-developers.com/showthr...?t=2073775)

Steps on how to fix or enable ADB and MTP in TWRP recovery

Follow the steps below to fix or enable ADB and MTP in TWRP recovery

Extract your twrp recovery.img using AIK tool (drag and drop onto the unpackimg.bat)

If successful, open the \\ramdisk folder and edit the file below using a text editor e.g Notepad++ For android 7 and below, edit default.prop For android 8 and above, edit prop.default

Search for the following items below one after the other and if they exist then modify their values (see the next step for the right values to use) Code: ro.secure ro.adb.secure ro.debuggable persist.sys.usb.config sys.usb.config

If they don't exist then add each item in a new line as seen below Code: ro.secure=0 ro.adb.secure=0 ro.debuggable=1 persist.sys.usb.config=adb,mtp sys.usb.config=adb,mtp

Repack the TWRP by running the repackimg.bat script

Finally, flash and boot into TWRP then confirm if both ADB and MTP work

Important Notice This might also work for other custom recoveries such as CWM / Philz. You can try to find out yourself