[GUIDE]Porting TWRP without source

Search This thread

R41N MuTT

Senior Member
Hello, I have Vestel Venus 5.0V (VSP250g). My screen resolution is 540x960 and I can't find TWRP image that supported 540x960. Can you help?
This should do the trick. And if you use his stuff tell him thanks. A lot of effort goes into this stuff.
 
  • Like
Reactions: EgeYnl and alecxs

EgeYnl

Member
Feb 12, 2023
12
0
This should do the trick. And if you use his stuff tell him thanks. A lot of effort goes into this stuff.
Thanks for replying. Btw, which TWRP image should install on my device? I mean, does it need to use the same SoC? Thanks.

My SoC is MSM8212.
 

R41N MuTT

Senior Member
Thanks for replying. Btw, which TWRP image should install on my device? I mean, does it need to use the same SoC? Thanks.

My SoC is MSM8212.
EDIT: I found a guide for installing TWRP on the Qualcomm MSM8212. The process could brick your phone, BUT, they have a TWRP image for your SoC. I might try it, me personally, but I brick devices regularly. It's for the Micromax A121 Canvas Elanza 2 and has a Qualcomm MSM8212 SoC
MSM8212 twrp
I don't believe this method is device specific. To be certain, I posted an inquiry for you. Watch this thread
TWRP inquiry
Between these two threads you should be good to go. Please report successes and failures. Maybe consider starting a thread detailing the method for this device, even referencing all this. That'd be totally cool of you.
 
Last edited:
  • Like
Reactions: EgeYnl

EgeYnl

Member
Feb 12, 2023
12
0
EDIT: I found a guide for installing TWRP on the Qualcomm MSM8212. The process could brick your phone, BUT, they have a TWRP image for your SoC. I might try it, me personally, but I brick devices regularly. It's for the Micromax A121 Canvas Elanza 2 and has a Qualcomm MSM8212 SoC
MSM8212 twrp
I don't believe this method is device specific. To be certain, I posted an inquiry for you. Watch this thread
TWRP inquiry
Between these two threads you should be good to go. Please report successes and failures. Maybe consider starting a thread detailing the method for this device, even referencing all this. That'd be totally cool of you.
Thanks for helping dude.
I ported the TWRP file of Huawei Ascend G630 to VSP250g but when I try to flash that image it gives an error.
Code:
Warning: skip copying recovery image avb footer (recovery partition size: 0, recovery image size: 13344768).
Sending 'recovery' (13032 KB)                      OKAY [  0.431s]
Writing 'recovery'                                 FAILED (remote: 'size too large')
fastboot: error: Command failed
 

R41N MuTT

Senior Member
Thanks for helping dude.
I ported the TWRP file of Huawei Ascend G630 to VSP250g but when I try to flash that image it gives an error.
Code:
Warning: skip copying recovery image avb footer (recovery partition size: 0, recovery image size: 13344768).
Sending 'recovery' (13032 KB)                      OKAY [  0.431s]
Writing 'recovery'                                 FAILED (remote: 'size too large')
fastboot: error: Command failed
I'm no expert, but it looks to me like the write failed. Most likely it's the wrong file. Follow this guide using the two files I linked you and try and port TWRP yourself. That's where I'd go from here. Maybe a dev, the OP or somebody will get back to you and walk you through it. Or Google it if you get stuck. If TWRP exists for that SoC for a different phone, perhaps following a guide on how to port TWRP on that device, but using your device firmware instead seems like it would produce results. Like if it's the same SoC it just make sense it's the same files with different names, essentially. I'm just guessing at this point
 
  • Like
Reactions: EgeYnl

alecxs

Forum Moderator
Staff member
Feb 17, 2016
4,623
7
3,866
gitlab.com
very old device.. sure it has recovery partition. you can check yourself from adb shell or terminal.
Code:
adb shell
ls -d /dev/block/*/*/*/by-name/*
ls -d /dev/block/*/*/by-name/*
Magisk requires Android 5+ but TWRP is available here. you can root with SuperSU instead.
 
  • Like
Reactions: EgeYnl

EgeYnl

Member
Feb 12, 2023
12
0
very old device.. sure it has recovery partition. you can check yourself from adb shell or terminal.
Code:
adb shell
ls -d /dev/block/*/*/*/by-name/*
ls -d /dev/block/*/*/by-name/*
Magisk requires Android 5+ but TWRP is available here. you can root with SuperSU instead.
I got this. Seems like there is an recovery partition.
Code:
shell@VSP250g:/ $ ls -d /dev/block/*/*/*/by-name/*
/dev/block/*/*/*/by-name/*: No such file or directory
1|shell@VSP250g:/ $ ls -d /dev/block/*/*/by-name/*
/dev/block/platform/msm_sdcc.1/by-name/DDR
/dev/block/platform/msm_sdcc.1/by-name/aboot
/dev/block/platform/msm_sdcc.1/by-name/boot
/dev/block/platform/msm_sdcc.1/by-name/cache
/dev/block/platform/msm_sdcc.1/by-name/fota
/dev/block/platform/msm_sdcc.1/by-name/fsc
/dev/block/platform/msm_sdcc.1/by-name/fsg
/dev/block/platform/msm_sdcc.1/by-name/misc
/dev/block/platform/msm_sdcc.1/by-name/modem
/dev/block/platform/msm_sdcc.1/by-name/modemst1
/dev/block/platform/msm_sdcc.1/by-name/modemst2
/dev/block/platform/msm_sdcc.1/by-name/pad
/dev/block/platform/msm_sdcc.1/by-name/persist
/dev/block/platform/msm_sdcc.1/by-name/recovery
/dev/block/platform/msm_sdcc.1/by-name/rpm
/dev/block/platform/msm_sdcc.1/by-name/sbl1
/dev/block/platform/msm_sdcc.1/by-name/sdi
/dev/block/platform/msm_sdcc.1/by-name/splash
/dev/block/platform/msm_sdcc.1/by-name/ssd
/dev/block/platform/msm_sdcc.1/by-name/system
/dev/block/platform/msm_sdcc.1/by-name/tz
/dev/block/platform/msm_sdcc.1/by-name/userdata
 

EgeYnl

Member
Feb 12, 2023
12
0
Update: I ported LG L Fino's TWRP image for my own device but the result is the same.
Code:
fastboot flash recovery twrp.img
Warning: skip copying recovery image avb footer (recovery partition size: 0, recovery image size: 11819008).
Sending 'recovery' (11542 KB)                      OKAY [  0.369s]
Writing 'recovery'                                 FAILED (remote: 'size too large')
fastboot: error: Command failed

fastboot boot twrp.img
Sending 'boot.img' (11542 KB)                      OKAY [  0.366s]
Booting                                            FAILED (remote: 'dtb not found')
fastboot: error: Command failed
 

alecxs

Forum Moderator
Staff member
Feb 17, 2016
4,623
7
3,866
gitlab.com
recovery partition size: 0 = no partition with name 'recovery' exist
dtb not found = need to append dtb to kernel
 
  • Like
Reactions: EgeYnl

AltFantasy

Senior Member
Aug 18, 2021
156
45
Nokia X10/X20
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://forum.xda-developers.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://forum.xda-developers.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://forum.xda-developers.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".
my screen resolution is 1080x2400... how do I get a recovery image for that screen size? I suspect that I'll have to find the recovery image of a device with a 1080x2400 screen
 

apipChan

New member
Apr 16, 2023
2
0
6. In the terminal, type the command
Code:
su
when i type this to cmd, it show like this, anyone can help?
1686484605476.png
 

TheCoder067

Member
Jun 24, 2023
25
4
su is a linux command. you are trying to run a linux command on windows. you dont need su on windows, just download the windows version of Android Image Kitchen and use the scripts in there.
You could try installing wsl ubuntu from. Microsoft store and using android_boot_image_editor
It's kinda hard to setup but when setuped it's very nice link to download
 

Top Liked Posts

  • There are no posts matching your filters.
  • 40
    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://forum.xda-developers.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://forum.xda-developers.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://forum.xda-developers.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