I need to root a custom MTK Android device. This device does not have volume keys at all so unlocking bootloader is impossible.(If anyone knows differently please educate me)

What I did previously that worked was use SP Flash Tool to flash over just the custom recovery. Then I would 'adb reboot recovery' and boom... there's my TWRP and I can easily root. We recently got some software upgrades so I flashed them over (complete ROM), device works great. But now, when I flash over my custom recovery and boot to it I get the native android recovery. It flashes successfully, it's definitely the right recovery.img... how is this possible. Any advice would be MOST appreciated.

  • Does it reboot straight to recovery or the system first even for second? – Bo Lawson Jul 30 '19 at 19:37
  • 1
    When I wrote this, straight to recovery, HOWEVER, just today I noticed it quickly flash the animated android icon (meaning the little green dude) before going right to recovery. I read a post elsewhere blaming the file located in the system files called recovery-from-boot.p however this file cannot be modified without root and when I did modify it (rename) the device is bricked and will not start. I managed to use Magisk to root the device boot img and then flash that onto the device which results in root but there are operation issues. I need SuperSU and therefore a TWRP. – RbK Aug 1 '19 at 17:52
  • recover-from-boot.p info mentioned above: androidforums.com/threads/… – RbK Aug 1 '19 at 17:57
  • So after you modified the boot.img with magisk you then renamed the recovery-from-boot.p? Renamed it to what/how? Did you do was that before or after you tried to flash TWRP? Since modifying that file is exactly what TWRP does then what went wrong . Can you please explain what detailed steps and order did you take when modifying the boot-from-recovery.p? – Bo Lawson Aug 2 '19 at 3:31
  • That was it! I tried renaming it to "recovery-from-boot-old.p" I did this twice once before I flashed twrp and once after. I also tried deleting it completely without much confidence but ALL resulted in the device not booting. What I JUST did was change it to "recovery-from-boot.bak" and then flashed my twrp after. (I also tried flashing it before with the same result) It rebooted fine and I was able to boot into my twrp after. So that was it. Note that you need to install SuperSU BEFORE uninstalling Magisk otherwise it bricks. – RbK Aug 2 '19 at 16:55

When you boot directly into TWRP after flashing TWRP patches the stock system recovery-from-boot.p file by renaming (modifying) it:

rename"/system/recovery-from-boot.p", "/system/recovery-from-boot.bak"h

This prevents the system from replacing twrp with stock recovery.

Simplifying the process there are a couple of files involved. First, the install-recovery.sh is called by the init.rc at boot. If there is an update to recovery or an issue then the install-recovery.sh calls for the recovery-from-boot.p (the patch) to patch the recovery and boot.img.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.