Talking here about how to extract the stock Boot, Recovery and Persist images, needed in case of e.g. bootloop upon flashing Magisk or TWRP, to reflash the stock image(s).
Also, boot image is needed for patching from Magisk Manager (and flashing by Fastboot), as a preferable way to install Magisk.
Stock Recovery is needed if you want to revert from the custom one, and stock Persist is important because it contains certificate for Widevine L1 (needed for Full HD in eg Netflix)
From Recovery (zip) firmware
Download the Recovery (zip) image from:
https://c.mi.com/oc/miuidownload/detail?device=1700361
Extract the archive and find the boot.img inside.
However, it does not contain recovery.img
From Fastboot (tgz) firmware
Similarly, download the Fastboot (tgz) image from:
https://c.mi.com/oc/miuidownload/detail?guide=2
(check Desktop site if opening from the mobile browser)
Extract the archive, find the images folder with boot.img and recovery.img inside
From TWRP or OrangeBox
Boot and Persist images can be disk-dumped from TWRP or OrangeFox, from its Terminal, with the command:
Dumped images will be saved to Internal memory - both the official TWRP and OrangeFox support internal storage encryption (use your Android lock-screen password/pin), hence no need to format Data for TWRP to dump to Internal memory
Note:
Observe that if Magisk was installed, dumped Boot image won't be the stock one but the one already patched by Magisk
We could similarly dump the Recovery image, but since we must dump from TWRP or OorangeFox,
the dumped image won't be the stock one but the image of the installed custom Recovery
From Terminal Emulator app
Similarly, Recovery and Persist mages can be disk-dumped from Terminal emulator app:
By ADB
Finally, Recovery and Persist images can be also disk-dumped from ADB:
Of course, ADB with drivers must be properly installed to the PC, and ADB debugging must be enabled in Settings, Developer options menu on the phone.
PC must be authorized from the phone once they get connected by USB cable
Finally, after the su command, root privilege must be granted to the Terminal emulator app before proceeding with dd command
Take care not to miss the authorization and root granting pop-ups on the phone if screen was switched of
Notes:
Observe that in both cases of Terminal emulator app and ADB, if custom Recovery was already installed, then you will be dumping the image of that custom Recovery
We can similarly dump the Bot image from Terminal emulator app or by ADB - but the root (Magisk) was prerequisite, hence the dumped image will be the Boot image already patched by Magisk
Also, boot image is needed for patching from Magisk Manager (and flashing by Fastboot), as a preferable way to install Magisk.
Stock Recovery is needed if you want to revert from the custom one, and stock Persist is important because it contains certificate for Widevine L1 (needed for Full HD in eg Netflix)
From Recovery (zip) firmware
Download the Recovery (zip) image from:
https://c.mi.com/oc/miuidownload/detail?device=1700361
Extract the archive and find the boot.img inside.
However, it does not contain recovery.img
From Fastboot (tgz) firmware
Similarly, download the Fastboot (tgz) image from:
https://c.mi.com/oc/miuidownload/detail?guide=2
(check Desktop site if opening from the mobile browser)
Extract the archive, find the images folder with boot.img and recovery.img inside
From TWRP or OrangeBox
Boot and Persist images can be disk-dumped from TWRP or OrangeFox, from its Terminal, with the command:
Code:
dd if=/dev/block/bootdevice/by-name/boot of=/sdcard/boot.img
dd if=/dev/block/bootdevice/by-name/persist of=/sdcard/persist.img
Note:
Observe that if Magisk was installed, dumped Boot image won't be the stock one but the one already patched by Magisk
We could similarly dump the Recovery image, but since we must dump from TWRP or OorangeFox,
the dumped image won't be the stock one but the image of the installed custom Recovery
From Terminal Emulator app
Similarly, Recovery and Persist mages can be disk-dumped from Terminal emulator app:
Code:
su
dd if=/dev/block/bootdevice/by-name/recovery of=/sdcard/recovery.img
dd if=/dev/block/bootdevice/by-name/persist of=/sdcard/persist.img
By ADB
Finally, Recovery and Persist images can be also disk-dumped from ADB:
Code:
adb shell
su
dd if=/dev/block/bootdevice/by-name/recovery of=/sdcard/recovery.img
dd if=/dev/block/bootdevice/by-name/persist of=/sdcard/persist.img
Of course, ADB with drivers must be properly installed to the PC, and ADB debugging must be enabled in Settings, Developer options menu on the phone.
PC must be authorized from the phone once they get connected by USB cable
Finally, after the su command, root privilege must be granted to the Terminal emulator app before proceeding with dd command
Take care not to miss the authorization and root granting pop-ups on the phone if screen was switched of
Notes:
Observe that in both cases of Terminal emulator app and ADB, if custom Recovery was already installed, then you will be dumping the image of that custom Recovery
We can similarly dump the Bot image from Terminal emulator app or by ADB - but the root (Magisk) was prerequisite, hence the dumped image will be the Boot image already patched by Magisk
Last edited: