Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,771,700 Members 43,589 Now Online
XDA Developers Android and Mobile Development Forum

[RECOVERY/MOD] TWRP 2.6.3.0+ with externally-powered USB-OTG support [2013-10-05]

Tip us?
 
zman0900
Old
(Last edited by zman0900; 6th October 2013 at 02:43 AM.) Reason: New version
#1  
zman0900's Avatar
Senior Member - OP
Thanks Meter 216
Posts: 269
Join Date: Jan 2010
Location: Columbus, OH
Lightbulb [RECOVERY/MOD] TWRP 2.6.3.0+ with externally-powered USB-OTG support [2013-10-05]

I have built a flashable zip to replace the kernel in your recovery image with one that supports USB-OTG. I have repacked the TWRP 2.6.0.0 recovery image with a different kernel that enables the use of USB-OTG when booted to recovery. The kernel is taken from Ziddey's patch for externally powered usb-otg and is a modified version of Franko's kernel. See that thread for more info on the kernel. (Note that this won't change the kernel used in your rom, only within TWRP).

Currently, TWRP is the only recovery I know of that supports USB-OTG. So while you can probably run this without problems on other recoveries, it like won't do anything useful either.

I didn't actually develop anything here other than the script in the zip. I just used unpackbootimg to extract the kernel from ziddey's boot.img and extract the ramdisk from twrp's recovery.img the recovery installed on your phone, then build a new recovery image using those parts with mkbootimg.

This will not work with a standard, unpowered OTG cable!
Try this at your own risk. It works for me, but I am not responsible if anything goes wrong.



Requirements
  • An unlocked Nexus 4 (with TWRP installed)
  • A USB OTG Y-cable. It should have a female regular USB, and both female and male micro-USB.
  • Flash Drive (As of TWRP 2.6.3.0, FAT, exFat, and ext4 format worked, ntfs and f2fs didn't)
  • Micro-USB power source (charger, battery, tiny gasoline generator, solar panels, finely tuned potatoes, etc)

Changes
  • 2013-10-05
    • Complete rebuild to do the work of replacing the kernel on your phone so I don't have to update every time TWRP does.
    • Updated to Ziddey's kernel 2013.10.01 1954ET r188 for JSS/JLS
  • 2013-09-19
    • Original release

Installation (zip method)
  1. Download the zip file to your phone
  2. Boot into your phone's recovery (CWM / TWRP)
  3. Flash the zip
  4. Reboot to recovery
  5. Repeat these steps after upgrading your recovery image.

Use
  1. Boot into recovery
  2. Connect flash drive and charger to OTG Y-cable.
  3. Connect Y-cable to phone.
  4. You should now be about to mount USB-OTG, select it for backup/restore, browse it with file manager, etc

Downloads
usbotg-replace-recovery-kernel-20131005.zip - 5.71 MB

Old Downloads
openrecovery-twrp-2.6.0.0-mako-usbotg.img - 7.11 MB
openrecovery-twrp-2.6.0.0-mako-usbotg.zip - 7.24 MB

Thanks
Ziddey - For his modifications to the kernel that made this possible (see thread linked above)
TeamWin - For TWRP recovery
Franko - For his kernel
Fkrone - For his flashable zip for CWM Recovery that I based mine off of
Koush - For his AnyKernel updater. I used it as an example and for the binaries.


See Also
If you want to or are already using Ziddey's method to enable USB-OTG in your rom, he has made a flashable zip that will copy the kernel installed for your rom to your recovery. See Post #13 for more info and to download.
Nexus 7 2013 - Carbon
Nexus 4 - CM10.2
Nexus 7 - CM10.2
Epic 4G - CM10
HTC Hero (cdma) - CM7
The Following 16 Users Say Thank You to zman0900 For This Useful Post: [ Click to Expand ]
 
nikkpap
Old
#2  
nikkpap's Avatar
Senior Member
Thanks Meter 70
Posts: 330
Join Date: Jan 2007
Location: Thessaloniki
Quote:
Originally Posted by zman0900 View Post
I have repacked the TWRP 2.6.0.0 recovery image with a different kernel that enables the use of USB-OTG when booted to recovery. The kernel is taken from Ziddey's patch for externally powered usb-otg and is a modified version of Franko's kernel. See that thread for more info on the kernel. (Note that this won't change the kernel used in your rom, only within TWRP)

I didn't actually develop anything here. I just used unpackbootimg to extract the kernel from ziddey's boot.img and extract the ramdisk from twrp's recovery.img, then built a new recovery image using those parts with mkbootimg.

This will not work with a standard, unpowered OTG cable!
Try this at your own risk. It works for me, but I am not responsible if anything goes wrong.



Requirements
  • An unlocked Nexus 4
  • A USB OTG Y-cable. It should have a female regular USB, and both female and male micro-USB.
  • Flash Drive (FAT and ext4 format tested, others may work)
  • Micro-USB power source (charger, battery, tiny gasoline generator, solar panels, finely tuned potatoes, etc)

Installation (fastboot method)
  1. Boot into your phone's bootloader (fastboot mode)
  2. Connect to computer with regular USB cable
  3. Run
    Code:
    fastboot devices
    to verify device is connected.
  4. Run
    Code:
    fastboot flash recovery /path/to/openrecovery-twrp-2.6.0.0-mako-usbotg.img
  5. Reboot into recovery

Installation (zip method)
  1. Download the zip file to your phone
  2. Boot into your phone's recovery (CWM / TWRP)
  3. Flash the zip
  4. Reboot to recovery

Use
  1. Boot into recovery
  2. Connect flash drive and charger to OTG Y-cable.
  3. Connect Y-cable to phone.
  4. You should now be about to mount USB-OTG, select it for backup/restore, browse it with file manager, etc

Downloads
openrecovery-twrp-2.6.0.0-mako-usbotg.img - 7.11 MB
openrecovery-twrp-2.6.0.0-mako-usbotg.zip - 7.24 MB

Thanks
Ziddey - For his modifications to the kernel that made this possible (see thread linked above)
TeamWin - For TWRP recovery
Franko - For his kernel
Fkrone - For his flashable zip for CWM Recovery that I shamelessly stole
can you do this for the latest CWM by philz touch recovery... plz

http://d-h.st/users/philz_touch/?fld_id=16051#files
Qtec s200 -> HTC Artemis -> HTC Diamond -> HTC Blackstone ->Apple iPhone 3GS 16 Gb ->Sony Ericsson Xperia X10 mini -> HTC Hero ->Samsung Galaxy 3 -> Samsung Galaxy S i9000 -> Samsung Galaxy S II i9100 -> Samsung Note N7000-> LG Nexus4 -> Xiaomi Red Rice -> Xperia Z (Last but not Least... )
 
ritchea
Old
#3  
ritchea's Avatar
Senior Member
Thanks Meter 52
Posts: 279
Join Date: Sep 2011
Location: okeechobee
Quote:
Originally Posted by zman0900 View Post
I have repacked the TWRP 2.6.0.0 recovery image with a different kernel that enables the use of USB-OTG when booted to recovery. The kernel is taken from Ziddey's patch for externally powered usb-otg and is a modified version of Franko's kernel. See that thread for more info on the kernel. (Note that this won't change the kernel used in your rom, only within TWRP)
This is great! Thanks.
 
ziddey
Old
#4  
Senior Member
Thanks Meter 1457
Posts: 1,546
Join Date: Aug 2007

 
DONATE TO ME
Hah, awesome thinking! I had foolishly assumed the recovery used a stripped down kernel.

I see you used the JSS kernel. Good to know it works with twrp 2.6.0.0. Have you considered a sort of "anyrecovery" implementation? So long as the recovery in question supports otg properly (can't remember if cwm even had the option), it should work. Worst case, the user will have to flash a known good recovery via fastboot or android (say goomanager).

Sorry you didn't even make it one post before some goon decided to quote the first post


Good thinking
 
zman0900
Old
(Last edited by zman0900; 22nd August 2013 at 06:26 AM.)
#5  
zman0900's Avatar
Senior Member - OP
Thanks Meter 216
Posts: 269
Join Date: Jan 2010
Location: Columbus, OH
Quote:
Originally Posted by nikkpap View Post
can you do this for the latest CWM by philz touch recovery... plz

http://d-h.st/users/philz_touch/?fld_id=16051#files
I've never actually used CWM on this phone and haven't used it on any device for about a year, so I don't know if they even support OTG. If they do, I can add in the kernel and it should probably work.

Quote:
Originally Posted by ziddey View Post
Hah, awesome thinking! I had foolishly assumed the recovery used a stripped down kernel.

I see you used the JSS kernel. Good to know it works with twrp 2.6.0.0. Have you considered a sort of "anyrecovery" implementation? So long as the recovery in question supports otg properly (can't remember if cwm even had the option), it should work. Worst case, the user will have to flash a known good recovery via fastboot or android (say goomanager).

Sorry you didn't even make it one post before some goon decided to quote the first post


Good thinking
I thought about the "AnyRecovery" idea. Its definitely possible since I actually did all the work on the phone over adb just because I didn't feel like finding the code for unpackbootimg and mkbootimg to compile for x86. If CWM supports OTG, I may do it, otherwise it will probably just cause confusion. Thanks for your work on the kernel by the way.


EDIT: As far as I can tell, CWM does not support OTG. Does anyone know of any other recovery that has support? I may make the AnyRecovery thing anyways just to support future version of TWRP, but I'll probably wait until the next version of TWRP or ziddey's kernel is ready.
Nexus 7 2013 - Carbon
Nexus 4 - CM10.2
Nexus 7 - CM10.2
Epic 4G - CM10
HTC Hero (cdma) - CM7
 
Sillik
Old
#6  
Senior Member
Thanks Meter 36
Posts: 207
Join Date: Dec 2010
Well this is awesome! Thanks for the good job...

However, does this have the issue found on regular TWRP 2.6.0.0 where you can't move your backup afterwards?

Also, it is easy to test making a backup, but has someone tried restoring from a backup? I wouldn't want to notice it doesn't work when I really need it!
 
ferreinf
Old
#7  
ferreinf's Avatar
Senior Member
Thanks Meter 335
Posts: 1,790
Join Date: Jun 2010
Very useful will try it when i have the time...

Thanks
Xperia Z1 & Nexus 7 2013 powered by KitKat

AndroidPT.com
Portuguese Android Comunity Team
 
ziddey
Old
#8  
Senior Member
Thanks Meter 1457
Posts: 1,546
Join Date: Aug 2007

 
DONATE TO ME
Quote:
Originally Posted by zman0900 View Post
EDIT: As far as I can tell, CWM does not support OTG. Does anyone know of any other recovery that has support? I may make the AnyRecovery thing anyways just to support future version of TWRP, but I'll probably wait until the next version of TWRP or ziddey's kernel is ready.
Could always do an "any-any" where it'd essentially be script only-- dump existing boot kernel and recovery ramdisk, make new image, and flash as recovery.


Sent from my phone. Please forgive typos and brevity.
 
xcooper
Old
#9  
Junior Member
Thanks Meter 1
Posts: 17
Join Date: Apr 2008
Thumbs up it works for backup and restore. THANKS

Just flushed the ZIP image TWRP-OTG and tested backup and restoration. Also tested to flash new kernel through the external USB drive. Every thing works . Thank you for sharing this mod recovery. Is there a plan to update the TWRP 2.6.1.0 ?
 
ritchea
Old
#10  
ritchea's Avatar
Senior Member
Thanks Meter 52
Posts: 279
Join Date: Sep 2011
Location: okeechobee
Quote:
Originally Posted by xcooper View Post
Just flushed the ZIP image TWRP-OTG and tested backup and restoration. Also tested to flash new kernel through the external USB drive. Every thing works . Thank you for sharing this mod recovery. Is there a plan to update the TWRP 2.6.1.0 ?
The mod seems to work on 2.6.1.0.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes