[GUIDE]Porting TWRP without source

Search This thread

Danny.69

Senior Member
May 10, 2015
137
12
hello, I have the guide and I have ported twrp, but I have several problems,
1- touch screen does not work
2- adb does not work from twrp
3- mouse otg works, I can click, but I can not leave pressed, if I leave pressed, it does an intermittent click

I have tried to port devices with soc tegra k1, same as my device.
twrp ports:
twrp shield tablet 2.7
twrp shield tablet 2.8
twrp shield tablet 3.0
twrp shield tablet 3.1
twrp xiaomi my pad 3.1
in all cases, the exact same thing happens.

I must boot twrp with the fastboot boot twrp.img command, since my recovery partition is 8mb, and can not enter twrp, when I have twrp, I will try to enlarge the partition.

adj. recovery. log, and kernel.log, if any expert sees what is wrong.
thanks in advance
 

Attachments

  • dmesg.log
    120.5 KB · Views: 38
  • recovery.log
    116.2 KB · Views: 39
Last edited:
  • Like
Reactions: orbitalmartian

Alando123

Senior Member
Dec 21, 2017
67
63
Earth
Ubuntu issues, lol

I am attempting this on Kubuntu 18.10, however when the image is unpacked I end up with 2 encrypted folders from stock recovery.img.. I am not root, and Kubuntu creates a root user with no password upon install, so I can't edit because I am not the owner (according to Kubuntu). Is there a way to work around this?
 
Last edited:

alecxs

Forum Moderator
Staff member
Feb 17, 2016
5,097
8
5,327
gitlab.com
CTRL + ALT + T
(where ~ is folder)
Code:
sudo -H -u root xdg-open ~
 
Last edited:

Aalesund

Senior Member
Jul 22, 2014
139
75
Hello, i've tried to port TWRP for my old Prestigio PMT5487_3G with MT6582 chipset and resolution 800 x 1280. Kernel: 3.4.5 If that matters.
I've used this TWRP 3.1.1 - https://xdaforums.com/lenovo-a3500/development/recovery-twrp-3-11-lenovo-a3500-t3684225 because it is for MT6582 (800x1280) and I think it will be compatible.
But I'm facing some problems with fstab files and partitions.
I have no "fstab" file in ramdisk folder from unpacked TWRP, I'll put my "fstab" from stock ramdisk folder.
Also I have "ueventd.rc" and "ueventd.goldfish.rc" in my stock ramdisk folder. So, I'll put only ueventd.rc to twrp, but waht about my stock ueventd.goldfish.rc? It's needed or not?

But, okay now is the real problem.
In unpacked twrp's folder "ramdisk/etc" I have only "recovery.fstab", there is no file "twrp.fstab".
And my stock recovery.fstab says:
Code:
# mount point	fstype		device			[device2]

/boot		emmc		boot
/cache		ext4		/dev/block/mmcblk0p2
/data		ext4		/dev/block/mmcblk0p3
/misc		emmc		misc
/recovery	emmc		recovery
/sdcard		vfat		/dev/block/mmcblk0p4
/system		ext4		/dev/block/mmcblk0p6

But I'm not sure about partitions, because the DiskInfo shows different partitions.
Here is 2 screenshots from DiskInfo - https://imgur.com/a/yW9edrE
Root Explorer screenshot - https://imgur.com/a/L2g4ox9
For example: recovery.fstab says "/dev/block/mmcblk0p6" is system, but Diskinfo says "/dev/block/mmcblk0p5" is the system?!?
And all others partitions are different: "data" is "/dev/block/mmcblk0p3" or "/dev/block/mmcblk0p7" ?
I'm not sure recovery.fstab has show the correct partitions!
Maybe I should changes the entire partition info in my stock recovery.fstab to match with the real partitions in DiskInfo?
What to do?
I hope you can help me.
 

Augustoandro

Senior Member
Jun 20, 2017
569
266
Pune
Micromax IN Note 1
Hello, i've tried to port TWRP for my old Prestigio PMT5487_3G with MT6582 chipset and resolution 800 x 1280. Kernel: 3.4.5 If that matters.
I've used this TWRP 3.1.1 - https://xdaforums.com/lenovo-a3500/development/recovery-twrp-3-11-lenovo-a3500-t3684225 because it is for MT6582 (800x1280) and I think it will be compatible.
But I'm facing some problems with fstab files and partitions.
I have no "fstab" file in ramdisk folder from unpacked TWRP, I'll put my "fstab" from stock ramdisk folder.
Also I have "ueventd.rc" and "ueventd.goldfish.rc" in my stock ramdisk folder. So, I'll put only ueventd.rc to twrp, but waht about my stock ueventd.goldfish.rc? It's needed or not?

But, okay now is the real problem.
In unpacked twrp's folder "ramdisk/etc" I have only "recovery.fstab", there is no file "twrp.fstab".
And my stock recovery.fstab says:


But I'm not sure about partitions, because the DiskInfo shows different partitions.
Here is 2 screenshots from DiskInfo - https://imgur.com/a/yW9edrE
Root Explorer screenshot - https://imgur.com/a/L2g4ox9
For example: recovery.fstab says "/dev/block/mmcblk0p6" is system, but Diskinfo says "/dev/block/mmcblk0p5" is the system?!?
And all others partitions are different: "data" is "/dev/block/mmcblk0p3" or "/dev/block/mmcblk0p7" ?
I'm not sure recovery.fstab has show the correct partitions!
Maybe I should changes the entire partition info in my stock recovery.fstab to match with the real partitions in DiskInfo?
What to do?
I hope you can help me.
The partitions shown by DiskInfo are the correct ones, edit your recovery.fstab accordingly.
If there is some file missing, create it.
I have recommended the TWRP images in the thread because they are suitable for most of the devices, I strongly believe you should use one of those. But if that fails, you are free to use the one you are working with right now.
And put the ueventd.goldfish.rc in the twrp to be ported.

HIT THANKS IF FOUND USEFUL
 
Last edited:

Frost199

New member
Mar 5, 2019
1
0
The partitions shown by DiskInfo are the correct ones, edit your recovery.fstab accordingly.
If there is some file missing, create it.
I have recommended the TWRP images in the thread because they are suitable for most of the devices, I strongly believe you should use one of those. But if that fails, you are free to use the one you are working with right now.
And put the ueventd.goldfish.rc in the twrp to be ported.

HIT THANKS IF FOUND USEFUL


yep
 

MiSSigNNo

Senior Member
Feb 7, 2006
244
48
39
Madrid
4p.marketing
I tried this method with the motorola nexus 6 image for a MTK6797X (Helios x27) device (chuwi hipad) . The problem is that no matter what I put on the twrp.fstab I found this errors in TWRP:
unable to mount storage
unable to mount system
(essentially unable to mount anything)

Then I though: maybe if I do this exact method using the older brother Hi9 Plus (same X27 proc) already functional TWRP, then it may work:

My wrong: I tried to unpack that TWRP and follow the same instructions, but it does not even boot into TWRP, it gets stuck in the boot screen :(
(at least with motorola nexus 6 twrp it did boot into TWRP :( )

There is only one thing strange with all this process: I downloaded DiskInfo and contrarily to all the screenshots I only can see the mount points, but not the sources (I have activated all the advanced options, and I even have the pro version)
Here is a screenshot:
YTLwta7.png


Now I'm in a deadend now with this topic.
 
Last edited:

bacon612

Senior Member
Jan 9, 2012
1,457
622
Sony Xperia Z2 Tablet
OnePlus 8 Pro
twrp.fstab and recovery.fstab should be identical, so all you have to do is copy and paste the contents of one into the other after rectifying whatever is wrong with them.

HIT THANKS IF FOUND USEFUL

Hi i am unclear on this state of your directions as well as this post here.

Which fstab contents are copied over which?

Does recovery.fstab get copied over by twrp.fstab?

At present they are not identical, to make them identical, one has to be copied over the other. This is very unclear to me.

Any help would be appreciated. Thanks for your efforts.
 

SachinBorkar

Senior Member
May 15, 2018
131
16
India
I think if users cannot able to boot after porting twrp.

They need to find device with same specification as they have with same kernel ( at least same kernel ) and port it to their device.

Sent from my Titanium Vista 4G using Tapatalk
 

Augustoandro

Senior Member
Jun 20, 2017
569
266
Pune
Micromax IN Note 1
Hi i am unclear on this state of your directions as well as this post here.

Which fstab contents are copied over which?

Does recovery.fstab get copied over by twrp.fstab?

At present they are not identical, to make them identical, one has to be copied over the other. This is very unclear to me.

Any help would be appreciated. Thanks for your efforts.
Copy the contents of recovery.fstab to twrp.fstab
 

2001ABHI

New member
Aug 24, 2016
4
0
Yes, I know XDA is filled with such guides.
But you can only port a TWRP if you implement parts of all the guides.
This guide is a summation of all those guides.

NOTE:
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.

REQUIREMENTS:
1.Download these TWRP recoveries in accordance with your screen resolution.
A. If your screen resolution is 480x850, 480x854; download
https://twrp.me/devices/lgnexus4.html
B. If your screen resolution is 720x1280, 800x1280 or 720xsomething; download
https://twrp.me/devices/asusnexus720123g.html
C. If your screen resolution is 1080x1920, download
https://twrp.me/devices/motorolanexus6.html
2. Download Android Image Kitchen-Linux from this thread:
https://xdaforums.com/showthread.php?t=2073775

LET'S BEGIN:
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
Code:
su
Enter your root password, then type
Code:
./unpackimg.sh
7. This will unpack your stock recovery.img. Do not close the terminal.
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
Code:
./unpackimg.sh
12. This will unpack your twrp_recovery.img
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.
A. default.prop
B. fstab.devicename_or_chipsetname
C. ueventd.rc
D. Any other file like ueventd.devicename.rc
16. Copy and paste these files from stock ramdisk folder to new ramdisk folder.
A. default.prop
B. fstab.devicename
C. ueventd.rc
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.
Code:
/external_sd          vfat         /dev/block/mmcblk1p1  flags=removable;storage;display="SDCARD"
/usb-otg                auto         /dev/block/sda1    flags=removable;storage;display="USB-OTG"
22. Edit the following lines as shown in default.prop
Code:
ro.secure=0
ro.adb.secure=0
security.perf_harden=0
ro.debuggable=1
persist.sys.usb.config=adb,mtp
23. Now, come out of the ramdisk folder and open the terminal.
24. Type
Code:
./repackimg.sh
25. Your new TWRP img would be generated and named as image-new.img by default. You may change the name later.

When you have successfully built the TWRP, or if you want to request one instead of creating yourself, contact me on this thread:
https://xdaforums.com/android/general/unofficial-twrps-devices-source-code-t3833338


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
https://mega.nz/#!fbIR0AoD!ykRMTAitymE4bQMVc6S0qbCYztTkVZDZSgIKcVTxEHg
https://mega.nz/#!yXQzwKJK!rWO_LiKZwFjzw4ZyM0qzzKw6uopxrxAkSkKNRYXVuIY
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.

CREDITS:
HostZero for his porting guide.
Osm0sis for his awesome Android Image Kitchen
Hello i tried everything but im still stuck in a bootloop
 

SachinBorkar

Senior Member
May 15, 2018
131
16
India
What is error 7 and how to solve this?

/* Sorry! if I am off topic */

Sent from my Titanium Vista 4G using Tapatalk
 

NFSP G35

Senior Member
Feb 28, 2012
363
213
I was able to get TWRP to boot using this method for an ONN (Walmart) 10" tablet which has a MediaTek MT8163.
I think the fstab still needs tweaking, but that's less of a concern at the moment.
The big issue I'm having is that the touch screen is rotated 90deg compared to the display (display is portrait, touch is landscape)
default.prop had `ro.sf.hwrotation=90` and I tried changing it to 0, 180 and 270 with no effect.
Everything I find online says to build from source and set RECOVERY_TOUCHSCREEN_SWAP_XY, but I can't do that since I'm not building from source.
So I'm kinda lost on how to rotate the touchscreen
 

Top Liked Posts

  • There are no posts matching your filters.
  • 41
    Yes, I know XDA is filled with such guides.
    But you can only port a TWRP if you implement parts of all the guides.
    This guide is a summation of all those guides.

    NOTE:
    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.

    REQUIREMENTS:
    1.Download these TWRP recoveries in accordance with your screen resolution.
    A. If your screen resolution is 480x850, 480x854; download
    https://twrp.me/lg/lgnexus4.html
    B. If your screen resolution is 720x1280, 800x1280 or 720xsomething; download
    https://twrp.me/asus/asusnexus720123g.html
    C. If your screen resolution is 1080x1920, download
    https://twrp.me/motorola/motorolanexus6.html
    2. Download Android Image Kitchen-Linux from this thread:
    https://xdaforums.com/showthread.php?t=2073775

    LET'S BEGIN:
    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
    Code:
    su
    Enter your root password, then type
    Code:
    ./unpackimg.sh
    7. This will unpack your stock recovery.img. Do not close the terminal.
    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
    Code:
    ./unpackimg.sh
    12. This will unpack your twrp_recovery.img
    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.
    A. default.prop
    B. fstab.devicename_or_chipsetname
    C. ueventd.rc
    D. Any other file like ueventd.devicename.rc
    16. Copy and paste these files from stock ramdisk folder to new ramdisk folder.
    Code:
    default.prop
    fstab.devicename
    ueventd.rc
    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.
    Code:
    /external_sd          vfat         /dev/block/mmcblk1p1  flags=removable;storage;display="SDCARD"
    /usb-otg                auto         /dev/block/sda1    flags=removable;storage;display="USB-OTG"
    22. Edit the following lines as shown in default.prop
    Code:
    ro.secure=0
    ro.adb.secure=0
    security.perf_harden=0
    ro.debuggable=1
    persist.sys.usb.config=adb,mtp
    23. Now, come out of the ramdisk folder and open the terminal.
    24. Type
    Code:
    ./repackimg.sh
    25. Your new TWRP img would be generated and named as image-new.img by default. You may change the name later.

    When you have successfully built the TWRP, or if you want to request one instead of creating yourself, contact me on this thread:
    https://xdaforums.com/android/general/unofficial-twrps-devices-source-code-t3833338


    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. Enable the following Diskinfo settings:
    Code:
    Show mount path
    Show partition name
    Show file system
    Expert mode
    Unmounted partitions
    Device Mapper partitions
    Temporary filesystems

    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.

    TROUBLESHOOTING INSTRUCTIONS:
    1. If you get a dm-verity error or facing an encryption problem, go to this thread and flash the "dm-verity and forceencrypt disabler zip".
    https://xdaforums.com/android/software/universal-dm-verity-forceencrypt-t3817389
    2. If you encounter a bootloop while booting into your new TWRP, please consult post #20 of this thread.
    3. At times, the path of partitions during recovery boot is not the same as those during normal boot. That's why you may get errors like
    Code:
    Updating partitions details...
    Failed to mount '/cache' (Invalid argument)
    Failed to mount '/system' (Invalid argument)
    Failed to mount '/data' (Invalid argument)
    Failed to mount '/metadata' (Invalid argument)
    ...done
    Unable to mount storage
    Failed to mount '/data' (Invalid argument)
    To resolve this, in your TWRP terminal type the following command
    Code:
    find /dev/block -name by-name
    Replace the paths of the partitions in your fstab files with the ones you get as output using the command above (only the partitions which failed to mount).

    If there are some bugs or you need some assistance in porting TWRP, contact me by mentioning in your post, for example @Augustoandro, we'll work on it to make it bug-free.

    Special thanks to @aIecxs for his troubleshooting instructions of bootloop, "Failed to mount /partition_name (invalid argument)" error and also @inguna for guiding me on how to fix the "SDCARD not detected by the TWRP" problem and also fixing the MTP, ADB not working issue.
    Another thanks to @seanybiker and @avirus for their troubleshooting instructions on "DM-Verity and forceencrypt" errors.

    CREDITS:
    @HostZero for his porting guide.
    @osm0sis for his awesome Android Image Kitchen
    @Zackptg5 for his "DM-Verity and Forceencrypt disabler zip".
    4
    Can't find fstab.devicename in stock ramdisk folder. btw phone is samsung a41 (sm-a415f) @Augustoandro
    This happens sometimes. Some devices directly reference the recovery.fstab file instead of fstab.devicename.
    Edit the rest of the files and proceed further.

    HIT THANKS IF FOUND USEFUL
    3
    @JLowe
    I apologize for the delay in replying.

    1. The topmost part
    Code:
    #<src> <mnt_point> <type> <mnt_flags>
    has already been commented out by "#", so leave it as it is.
    2. For listing the system partition in fstab files, always use "/system".
    3. Always include all entries from the stock recovery.fstab in your TWRP recovery.fstab and edit your twrp.fstab in accordance with it.
    4. Whatever partititon is not available in your stock, never include it in your TWRP fstab (applies to both recovery.fstab and twrp.fstab). If you can't find a partition neither in your stock fstab nor via DiskInfo , it just means those partitions don't exist on your device.
    5. Never include files not available in your stock recovery to your TWRP.

    HIT THANKS IF FOUND USEFUL
    2
    Thanks a lot @Augustoandro! IMHO this is by far the easiest guide for porting TWRP to unsupported devices. Keep it up!
    2
    Hi I tried to Port a Recovery for my H96 Max RK3399 TV Box .
    I used TWRP From My RK3328 TVBox.
    I can Boot in Recovery, but its not Mounting any Partition (everywhere 0MB)
    I Think the problem is in .Fstab File but I am Not sure.
    I would appreciate help

    Sorry for my poor English
    Partitions not being recognized means the problem is in fstab files. Both recovery.fstab and twrp.fstab need to be edited.
    I am sure of it.

    HIT THANKS IF FOUND USEFUL