But you can only port a TWRP if you implement parts of all the guides.
This guide is a summation of all those guides.
I would be using AIK-Linux in this tutorial, since I don't recommend Windows for all this, who knows what problems you will get into.
1.Download these TWRP recoveries in accordance with your screen resolution.
A. If your screen resolution is 480x850, 480x854; download
B. If your screen resolution is 720x1280, 800x1280 or 720xsomething; download
C. If your screen resolution is 1080x1920, download
2. Download Android Image Kitchen-Linux from this thread:
1. Unzip Android Image Kitchen zip file.
3. Now, navigate to the unzipped folder of AIK (Android Image Kitchen).
4. Just Right Click and select "Open Terminal here".
5. Copy and paste your stock recovery.img and paste it in AIK folder.
6. In the terminal, type the command
8. Cut the new folders, ramdisk and split_img, and paste them somewhere outside of AIK folder.
9. Remove the stock recovery.img in AIK folder.
10. Now, copy and paste the twrp_recovery.img according to your screen resolution in the AIK folder.
11. Now, revert back to the terminal and type
13. Delete all the files in the new split_img folder we got by unpackimg twrp_recovery.img
14. Copy and paste all the files in stock split_img folder to the new split_img folder.
15. Delete following files from new ramdisk folder.
D. Any other file like ueventd.devicename.rc
16. Copy and paste these files from stock ramdisk folder to new ramdisk folder.
17. Now go into stock ramdisk/etc folder and copy recovery.fstab
18. Paste the recovery.fstab file in new ramdisk/etc folder.
19. Edit the twrp.fstab file according to the newly pasted recovery.fstab
20. You will have to replace"/sdcard" with "/external_sd" and "/usb" with "/usb-otg".
21. If the partitions stated above are not available in your fstab files then add these lines. Order may change on the format in which the files are written.
/external_sd vfat /dev/block/mmcblk1p1 flags=removable;storage;display="SDCARD" /usb-otg auto /dev/block/sda1 flags=removable;storage;display="USB-OTG"
ro.secure=0 ro.adb.secure=0 security.perf_harden=0 ro.debuggable=1 persist.sys.usb.config=adb,mtp
When you have successfully built the TWRP, or if you want to request one instead of creating yourself, contact me on this thread:
SPECIAL INSTRUCTIONS FOR MEDIATEK DEVICES:
1. The recovery.fstab you will get after unpacking your stock recovery.img would be flawed in most cases. I believe OEMs do this deliberately.
2. In order to know which partition is mounted at which location and at which device, you'll need DiskInfo (Install it from Play Store) and a root explorer.
3. Change the Diskinfo settings like this
4. Use the root explorer to find the path of your partitions. They would be located under /dev (mtk devices have bootimg and recovery here generally) and some other partitions like /system, /cache would be deeper inside.
5. You can trace their exact locations by navigating within the /dev directory for partition names like mmcblk0p5.
SPECIAL INSTRUCTIONS FOR DEVICES THAT DON'T HAVE RECOVERY.FSTAB WITHIN STOCK RECOVERY.IMG
1. In the ramdisk/etc folder, there might be a dummy recovery.fstab file with the symbol of link on it.
2. Right click on the file and select "Show Target". You'll get to know the path of original recovery.fstab file. It might be within the unpacked recovery or inside some other partition on your phone.
For example: Honor 7C devices have their recovery.fstab in /vendor/etc folder.
If it works perfectly, I will make it available to others through my thread.
If there are some bugs or you need some assistance in porting TWRP, contact me all the same, we'll work on it to make it bug-free.
HostZero for his porting guide.
Osm0sis for his awesome Android Image Kitchen