Permanently Replace Stock Recovery with TWRP on U22?

#1
Hello and thanks much to those who have posted the link to a working TWRP for the U22. From what I can tell, this TWRP is being accessed by installing on an SD card and then booting for there.

In my past experiences with TWRP and CWM on both phones and other Android boxes, I have been able to replace the stock recovery with TWRP and thereby been able to get into recovery with the command "/system/bin/reboot recovery". And this, coupled with Open Recovery Script inside of TWRP allows me to automate backups and run them on a schedule.

So I am wondering if I can do the same with the TWRP that has been posted and, if so, how? Do I need a different TWRP? And what, if any, problems/downsides might I expect in doing this? For example: inability to get or apply firmware updates as they are released? Or inability to boot into recovery using the reset button/power key method?

If this is impossible on the U22 or if there are downsides significant enough to not do so, can I leave the TWRP image on the SD card with the card left plugged in and issue the "reboot recovery" command and it will find/use the TWRP that is on the SD card. If so, is there a way/place to put and Open Recovery Script so that it gets run in this scenario? And with the card in place, will the TWRP image be ignored on normal boots?

Thanks for your help in clarifying all of this for me.
 
#2
To clarify, when I speak about permanent install I am talking about the technique described here in the first post under the headings "From OEM update app" and "From OEM stock firmware (with root)".
 
#4
Thanks alot. I just opened and am poking around in my new U22 and I see no switch for bootloader unlock in the settings anywhere. So not sure if it IS bootloader locked from the factory. Anyone know?
 
#5
Thanks alot. I just opened and am poking around in my new U22 and I see no switch for bootloader unlock in the settings anywhere. So not sure if it IS bootloader locked from the factory. Anyone know?
I believe it is unlocked. Worst case scenario, you can just try flashing via adb, and if the bootloader is locked, it won't let you flash.
 

MooseJaw

Trusted Helper
#6
I haven't tried it with this box, so take my advice with caution. It should work. While booted twrp recovery from sd/usb, you should be able to install the twrp recovery.img.

Steps:
1- Make sure the twrp recovery.img is on your sd card/usb.
2- Boot into twrp and press install.
3- Press the little button that says "Images..." in the bottom corner
4- Find the recovery.img on your sd/usb, press it, and then select Recovery.
5- Swipe to flash.

With that said, it seems like an unnecessary risk. Why risk bugging up the stock recovery when you can easily boot to the custom recovery from your sd/usb?
 
#7
Hi and thanks. I will check out your suggestion.

The main reason I want to have permanent TWRP is so that the terminal command "reboot recovery" will end up in TWRP. With it only on the SD card, I always end up in stock recovery mode. I want this so I can automate my nightly TWRP backups if at all possible. I use these boxes more as Android computers than media boxes. I run a bunch of home automation stuff and other things as well as media. I often get shot in the foot by either some new app or mod or just by my own foolishness. So having a full TWRP backup from the night before always limits the damage (or at least it has so far).

I have just made a full backup from the SD card's TWRP onto the SD card itself and that seems to have gone fine. I have also tested my ability to connect to the device from Win10 using the burning tool. So I think that if I hose things up, I should be able to just flash the firmware I have and then restore the TWRP backup just made. In theory!

Cheers
 
#8
I haven't tried it with this box, so take my advice with caution. It should work. While booted twrp recovery from sd/usb, you should be able to install the twrp recovery.img.

Steps:
1- Make sure the twrp recovery.img is on your sd card/usb.
2- Boot into twrp and press install.
3- Press the little button that says "Images..." in the bottom corner
4- Find the recovery.img on your sd/usb, press it, and then select Recovery.
5- Swipe to flash.

With that said, it seems like an unnecessary risk. Why risk bugging up the stock recovery when you can easily boot to the custom recovery from your sd/usb?
Well, just tried the above steps. Did NOT seem to take. When I issue command "reboot recovery" I still end up in stock recovery. I can also still get into TWRP from the SD card. And otherwise the box seems unchanged except:

I took a TWRP backup of the recovery partition as part of a full backup before doing this and then took one of just the recovery after doing this. I would have expected no change since I am still getting stock recovery. The size of the actual backup files are identical. But the contents of the sha files are different. Not sure why that would be but I also checked the MD5s and they too are different.

Hmmmm.
 
#9
And I also just tried the technique of "dd if=recovery.img of=/dev/block/recovery" and that didn't work either. Still going back to stock recovery. But no error messages in either case.
 

MooseJaw

Trusted Helper
#10
That's strange. I've used that exact method with my phone without issue.

Alternatively, you could try the following:
1- Download and install the TWRP App (get version 1.19 from apk mirror. Newer versions do not let you locate the recovery.img from internal storage)
https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=Twrp
2- Save the TWRP recovery.img in the U22's internal storage at the root of the internal storage (/sdcard/)
3- Open the TWRP app
4- Select TWRP FLASH
5- Select Device, Android Emulator = TWRP (do not download via TWRP)
6- Select file to flash and locate the recovery.img from your internal storage (/sdcard/)
7- Select Flash to Recovery
8- It should flash the custom TWRP recovery.img, replacing the stock recovery.
9- In the TWRP app's settings, select Reboot in Recovery. The box should now boot to the custom TWRP recovery.
 
Last edited:
#11
Well thanks again for the above suggestion. I seem to have the same results as the other techniques. Once I completed the flash in the app and rebooted back to TWRP I do, in fact end up in TWRP. Same was true when I entered TWRP from the SD card. BUT after I reboot to system and then try to "reboot recovery" or enter recovery via the rest/power combo, I get shown stock recovery.

This is all making me think that on this device, the recovery partition is NOT in the usual place or with the usual name. And so the changes are simply not sticking. But essentially, the results are all the same - the copied/flashed TWRP image is not persisted in a place or way that it replaces the stock recovery. And there are no error messages or other indications of failure.

Very strange!

Cheers
 
#14
Did you try adb as I suggested?
Well, not sure that is going to work. May not support fastboot. I am able to "adb reboot bootloader" and it restarts and just shows the basic Minix logo screen. However, I get nothing in the list for "fastboot devices" and issuing any other "fastboot" command simply says "<waiting for any device>". Thanks for any other ideas.

PS - I also tried putting the U22 into firmware burning mode for use with the Amlogic tool. But still no fastboot device.
 
Last edited:
#15
Well, not sure that is going to work. May not support fastboot. I am able to "adb reboot bootloader" and it restarts and just shows the basic Minix logo screen. However, I get nothing in the list for "fastboot devices" and issuing any other "fastboot" command simply says "<waiting for any device>". Thanks for any other ideas.

PS - I also tried putting the U22 into firmware burning mode for use with the Amlogic tool. But still no fastboot device.
Maybe the bootloader is locked after all?
I only ever unlocked the bootloader once on a Xiaomi phone, out of the dozen or so Android devices I ever got, so I don't have any further "expertise" to share unfortunately.
 
Top