• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Does patched boot.img Magisk work on MIUI V12.5.1.0? (Edit: Yes it does!)

Search This thread

bohemist

Senior Member
Mar 9, 2018
336
177
San Pedro, Laguna
Please does someone upgraded succefully from 12.0.5.0 to 12.5.1.0 with root and without wiping data ?
If yes, how did you flashed the 12.5 ROM because TWRP recovery does no support MIUI 12.5 A11 encryption, so I guess flashing it from TWRP is not recomanded.
I am quite afraid to be forced to wipe everything and preserve root is mandatory for me so I did not tried to upgrade for now.
Thank you in advance.
I upgraded my wife's Mi9T Pro to the latest MIUI 12.5.1.0 via OTA update. This phone is rooted, so after the update is completed, I reboot the phone to system without root to make sure everything is working without root, yet. And, everything works.

Then I downloaded the latest OTA full ROM as suggested in this post: https://forum.xda-developers.com/t/...-5-1-0-edit-yes-it-does.4299669/post-85271375

...then extract the boot.img and patched it via Magisk.

Then, flashed it via ADB.
 

spiou

Senior Member
Jul 20, 2007
113
9
Paris
I upgraded my wife's Mi9T Pro to the latest MIUI 12.5.1.0 via OTA update. This phone is rooted, so after the update is completed, I reboot the phone to system without root to make sure everything is working without root, yet. And, everything works.

Then I downloaded the latest OTA full ROM as suggested in this post: https://forum.xda-developers.com/t/...-5-1-0-edit-yes-it-does.4299669/post-85271375

...then extract the boot.img and patched it via Magisk.

Then, flashed it via ADB.
Thank you for your feedback.
If you upgraded via OTA, I suppose that you had not TWRP installed ? Or did you restored before the stock recovery ?
Did you also uninstalled root (restored stock boot.img) before upgrade process or this step is not necessary ?
 

bohemist

Senior Member
Mar 9, 2018
336
177
San Pedro, Laguna
Thank you for your feedback.
If you upgraded via OTA, I suppose that you had not TWRP installed ? Or did you restored before the stock recovery ?
Did you also uninstalled root (restored stock boot.img) before upgrade process or this step is not necessary ?
I had TWRP installed and a few Magisk modules were active during the OTA. The reason I opted to update via OTA is I want to see it working without root. I wanted to make sure there were no issues before rooting again. I thought this was an important step, especially that it is a major version upgrade from Android 10 to 11.

When everything works OK, I proceed to rooting the phone by patching boot.img via Magisk and flashed it via ADB.

Right now, the phone has no TWRP as it is not needed. I will install TWRP when necessary, but for now, it's not needed. The phone is working fine.
 

spiou

Senior Member
Jul 20, 2007
113
9
Paris
I had TWRP installed and a few Magisk modules were active during the OTA. The reason I opted to update via OTA is I want to see it working without root. I wanted to make sure there were no issues before rooting again. I thought this was an important step, especially that it is a major version upgrade from Android 10 to 11.

When everything works OK, I proceed to rooting the phone by patching boot.img via Magisk and flashed it via ADB.

Right now, the phone has no TWRP as it is not needed. I will install TWRP when necessary, but for now, it's not needed. The phone is working fine.
Thanks for these precisions.
Few more more questions :
- Magisk is 23.0 ?
- Are you on Global or EU ROM ?

I'm suprprised that the update OTA is functional with TWRP : I thought that after download of the update the phone should reboot in stock recovery to install it, so I thouhgt this was not functionnal with TWRP.
Actually I never updated via OTA cause I rooted my 9T pro since 1st day...
 

bohemist

Senior Member
Mar 9, 2018
336
177
San Pedro, Laguna
Thanks for these precisions.
Few more more questions :
- Magisk is 23.0 ?
- Are you on Global or EU ROM ?

I'm suprprised that the update OTA is functional with TWRP : I thought that after download of the update the phone should reboot in stock recovery to install it, so I thouhgt this was not functionnal with TWRP.
Actually I never updated via OTA cause I rooted my 9T pro since 1st day...
It's Magisk 23.0 on Global ROM

When updating/upgrading via OTA, it will wipe out TWRP and restore stock recovery. But that's not an issue as I have a laptop at all times, and I can just re-install/flash TWRP when needed.
 

spiou

Senior Member
Jul 20, 2007
113
9
Paris
It's Magisk 23.0 on Global ROM

When updating/upgrading via OTA, it will wipe out TWRP and restore stock recovery. But that's not an issue as I have a laptop at all times, and I can just re-install/flash TWRP when needed.
Thanks to you I just successfully upgraded to 12.5.1.0 et rooted without problem.
I just noticed 2 things with this version :
- no more VOLTE icon in status bar : not very important but I prefer to see it
- the phone app (google phone) is super laggy : when I call someone, I can't hang up right away, I must wait about 5 secondes. Do you have the same problem ? Any solution ?
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    I was tempted to do the same because it's the conventional way of installing Magisk and it's how it's always been installed.

    That and mucking with something called boot.img sounds like a one-way trip to brick-street. I.e. boot.img makes me think bootloader or in other words, bad news. Although from what I've heard it turns out you can completely screw up the boot.img and you should still have access fastboot and recovery modes. But I didn't run into any problems flashing a new boot.img so I didn't find out 😅.
    Men, patching the images is nothing new or exotic.
    If you ever read Magisk guide from TJW (the aurhor of Magisk) you would well know that the method has been described there for many years (I personally used the method back since 2018 on other phones)

    Besides, it has many practical advantages - if anything goes wrong you just flash the original (unpatched) image

    Or, when Magisk updates (unfortunately, it does no more and who knows would it ever again, at least from the established channels like Stable or Canary), if there is a problem with the new Magisk - you just flash your previous version of img that was patched with the working version of Magisk and you are back in business

    And there is also nothing impractical here - if you have proper TWRP (you do have for this phone) you don't need to flash the patched img from fastboot but simply from TWRP

    You can also use TWRP backup boot.emmc.win instead of extracted boot.img - simply give boot.emmc.win to Magisk for patching (you don't need to rename it) and then flash it
    1
    You may have modules installed and enabled, that do no more work with the new firmware

    If you didn't wipe/format Data, modules are still in: /data/adb/modules
    (updating firmware does not affect there)

    Use TWRP, go to that folder and add an empty file named: disable
    (exactly as that), to each subfolder (each subfolder corresponds to one module, you may recignize them by folder names)

    Then reboot with the patched boot.img

    Later, manage your modules (enable, uninstall, update) from Magisk app (once you successfully boot to Magisk)

    You Sir are an absolute LIFE SAVER!!!!!!!


    Thank you!
    1
    I also patched magisk just fine :D. Thanks guys for sharing your experiences; it kinda reassured me it'd probably work - I was thinking booting a patched magisk boot.img might be safer so I did that first and it booted as expected. So I just returned to fastboot and flashed it properly. Installed a few modules (the essentials; ACC, Energized, Busybox), rebooted, we're all good ^_^

    Clipboardadb.png


    I think it's already been explained above me but for anyone who hasn't figured it out yet:

    Find the recovery zip or fastboot files you updated with (if you don't have them still then go here but use the *exact* region and version - if your device isn't raphael then don't use these), open with 7zip/winrar/whatever and copy the boot.img from them to any folder on your phone. Open Magisk Manager, browse for where you copied it to and patch it; recovery mode box unticked. Then look for Magisk_patched_xxx.img (xxx part being whatever Magisk called it) in your /Downloads folder on your phone. Copy it back to your PC, fire up Tiny ADB & Fastboot.

    Do a test-run with fastboot boot Magisk_patched_xxx.img first. If it boots up fine and Magisk shows as working, commit the changes by returning to fastboot with adb reboot fastboot and then the command fastboot flash boot Magisk_patched_xxx.img. Then power it up.

    If the temporary boot test-run didn't work, obviously don't execute the flash boot command; power-cycling the phone will get it unstuck.

    I should probably note I don't have TWRP (using stock recovery) and I don't know how that factors into this. This was done the day after a clean_all fastboot flash; read previous posts if you've used Magisk previously and updated with your data intact.
    1
    I would like to add here to use the boot.img patch method. Flashing magisk as a zip through the recovery will cause a bootloop.
    Tested this on my Mi 9T Pro (12.5.1 global) with system encryption enabled.
    1
    In such case, how do you remove the magisk modules after the update? Without root, there is no access to modules.
    Why don't you read the previous messages in this thread - post #6

    Or see:
    Yes, it was asked/answered several times but let it be answered again 🤩

    Besides adb, there are two other ways of disabling (or even uninstalling) the remained modules

    You have to flash your patched boot.img, then

    a) Reboott to Android Safe mode, then reboot again to 'normal' mode.
    All modules will be disabled but also you will have to re-enable Magisk Hide again

    b) Use TWRP (if appropriate for your device), Advanced, File Manager, go to /data/adb/modules and to each folder (foder = module, you can recognize modules by folder names or by reading the textual file module.prop you will find inside) put a file that must be named: disable (exactly as that)

    Or simoly read the Magisk Wiki, available from Magisk Github (linked from Magisk app):