If you already have Magisk installed, it is strongly recommended to upgrade directly via Magisk Manager. The following tutorial is for first time users. For Huawei users, please check the specific section for more information.
If your device have custom recovery support, the easiest way is to install it through custom recoveries, such as TWRP.
This is the “cool” way to install Magisk on your device. Either your device does not have proper custom recoveries, your device is using the A/B partition scheme and you don’t want to mix recovery and boot images together, or you have other concerns (e.g. OTA Installation), you should use this method instead.
In order to use this method, you are required to obtain a copy of the stock boot image, which can be found by extracting OEM provided factory images, or extracted from OTA update zips. If you are unable to obtain one yourself, someone on the Internet might share it somewhere. The following instructions will guide you through the process after you have the copy of boot image.
adb pull /sdcard/Download/patched_boot.img[.tar]
fastboot flash boot /path/to/patched_boot.img
Huawei devices using Kirin processors have a different partitioning method from most common devices. Magisk is usually installed to the
boot partition of the device, however Huawei devices does not have this partition. Depending on what EMUI version your device is running the instructions are slightly different. Even if you have switched to a custom ROM, you shall still know which version of EMUI you are running before switching.
Huawei does not release official factory images, however most firmware zips can be downloaded from the Huawei Firmware Database. To extract the images from
UPDATE.APP in the zip, you have to use Huawei Update Extractor (Windows only!)
For EMUI 8 devices, your device have a partition named
ramdisk, which will be where Magisk is going to be installed.
fastboot flash recovery_ramdisk /path/to/twrp.imgto install the custom recovery.
RAMDISK.imgfrom your firmware. Follow the instructions for boot image patching above, but use the
RAMDISK.imgfile instead of a boot image. To install the patched image back to your device, here is the fastboot command:
fastboot flash ramdisk /path/to/patched_boot.img. Be aware you are flashing to
For EMUI 9 devices, the
ramdisk partition no longer exists. As a workaround, Magisk will be installed to the
recovery_ramdisk partition. This means that you HAVE TO boot to recovery every time you reboot. This also means that you CANNOT have Magisk and custom recoveries at the same time! To boot to recovery, press Power + Volume Up when booting your device.
fastboot flash recovery_ramdisk /path/to/twrp.imgto install the custom recovery. Magisk will overwrite the custom recovery.
RECOVERY_RAMDIS.imgfrom your firmware. Follow the instructions for boot image patching above, but use the
RECOVERY_RAMDIS.imgfile instead of a boot image. To install the patched image back to your device, here is the fastboot command:
fastboot flash recovery_ramdisk /path/to/patched_boot.img. Be aware you are flashing to