How to Root HyperOS Using Magisk in 3 Easy Steps [2024]
- Rooting HyperOS on Xiaomi devices is largely similar to previous processes with MIUI, involving obtaining the boot.img file, using Magisk for patching, and flashing the patched file via PC.
- Requires an unlocked bootloader, USB debugging enabled, obtaining the "boot.img" file through the payload.bin extraction process, patching the file with Magisk, and finally flashing the patched image file using fastboot commands.
- Unlocking the bootloader is mandatory and carries a waiting period. Rooting grants extensive control but voids warranty and may render certain apps unusable. Custom recovery can be used for flashing but requires compatibility with the HyperOS version.
Xiaomi has always been a top choice within the Android community for customization and experimenting with new features. Due to its target demographic and audience, coupled with the way its software is designed, Xiaomi devices are particularly well-suited for advanced users, especially when it comes to rooting.
This article will provide a detailed guide on rooting your Xiaomi device running HyperOS. We will cover both the risks involved and the procedures to follow for a safe root process.
Table of Contents
What is Xiaomi HyperOS?
HyperOS is an Android-based operating system for Xiaomi devices, which replaced MIUI in 2023. Although presented as a complete overhaul, the software isn’t really that different from its predecessor, and most of the customization options are, more or less, the same.
↪ Rooting HyperOS
For HyperOS, Xiaomi hasn’t made many changes under the hood, resulting in a user experience that is quite similar to that of MIUI. This extends to rooting the device as well since most of the procedure is mainly the same.
Rooting is the process of gaining privileged control over a device’s subsystems. It grants you deeper control over your phone’s hardware, allowing you to bypass potential restrictions set by the manufacturer or the Android operating system.
READ MORE: How to Install HyperOS Moon Super Wallpaper on Any Android? ➜
Rooting HyperOS Using Magisk
The main idea behind rooting HyperOS using Magisk is to first obtain the phone’s, or rather HyperOS’, boot.img file. This file would then be provided to Magisk, which will handle the patching process and prepare a new file that can be flashed onto the phone.
Before starting the root process, it’s important to note that achieving root access on HyperOS requires unlocking your device’s bootloader. This can be done via the official route by submitting an unlock request to Xiaomi. However, the entire procedure carries a waiting period of approximately 168 hours before you can successfully unlock your device.
Pre-Requisites
Here are some of the elements to keep in check before you start the root process. Some of these are already discussed in detail above.
- An unlocked bootloader.
- A PC (for acquiring the boot.img file and later flashing it onto the phone).
- A USB cable (for data transfer). You can also opt for a wireless transfer if that is what you prefer.
- An active internet connection (to download required files).
- Platform Tools (to use Fastboot commands to flash the patched boot.img file).
- ADB Drivers.
↪ Enable USB Debugging
To enable USB Debugging, follow the steps below:
- Go to Settings and tap on “About Phone.”
- Look for the “OS version,” and tap on it several times till you see the message: “You are now a developer.”Enabling “Developer options” in HyperOS
- Head back to Settings and scroll down to find “Additional settings.” Tap on this.
- Scroll down to “Developer options,” and tap on it.
- Look for “USB debugging,” and turn the toggle on.Enabling “USB debugging” in HyperOS
- In the confirmation dialog that pops up, tap “OK.The (HyperOS) precautionary dialog box
Enabling USB Debugging will allow your phone to communicate with your PC later on in this procedure when the rooted recovery image file will need to be flashed back to the phone.
READ MORE: Is Unlocked Bootloader Needed to Flash Stock Firmware on LG?
1. Finding Your Phone’s “boot.img” File
The first step in rooting your phone is patching its boot.img file. This file is typically found within the payload.bin file, which is used to deliver OTA updates to your device.
1.1) Find the “payload.bin” file
- Find the HyperOS Recovery ROM file online that matches your phone’s current OS version. Download the recovery file. This is usually in a .zip file format.
HyperOS Recovery ROM | Xiaomi - Extract the downloaded .zip file. Inside, you’ll find a file named payload.zip.
Extracted Recovery.zip Folder - To extract the payload.bin file from the ROM’s zip, we’ll need the Payload Dumper Tool.
1.2) Extract the “payload.bin” File (Requires Python)
- Download and install Python 3 (or newer) from the official website. During installation, make sure to check the option “Add Python to PATH.”
- Download the Payload Dumper Tool from its official website. This will be a .zip file that will need to be manually extracted.
- The extracted folder will contain several files, but our focus will primarily be the payload_dumper.exe file and two folders: payload_input and payload_output.
1.3) Acquire the “boot.img” File via Payload Dumper.
- Copy the payload.bin file, previously obtained from the recovery ROM zip, into the payload_input folder.
- Go to the parent directory containing the payload_input folder and run the payload_dumper.exe file.
- This will extract the payload.bin file and generate a new file named boot.img within the payload_output folder. This is the file you need for the rooting process.
READ MORE: How to Install Mi Dialer in HyperOS in 6 Easy Step [2024] ➜
2. Patching the boot.img File
Once you’ve obtained the boot.img file, you’ll need to patch it. This can be done using the Magisk Manager app. However, you’ll first need to transfer the boot.img file to your phone. You can do this manually via a USB cable or wirelessly.
- Download the Magisk Manager app directly on your phone from a reliable source (avoid third-party app stores).
- Open the Magisk Manager app. Look for an option like “Install.” Here, you’ll likely see a prompt to “Select and Patch a File.”
- Go to the location where you transferred the boot.img file on your phone’s storage. Select the file to patch it with Magisk.
3. Flashing the Patched Image File (via PC)
Magisk will patch your phone’s boot.img file and create a new file named “magisk_patched.img” within your phone’s Download folder. This file is important for the next step and has to be transferred back to your PC.
3.1) Setting Up Your PC
- Make sure you have ADB drivers installed on your PC.
- Head on over to the platform-tools folder and open a Command Prompt window.
- In the address bar of the platform-tools folder, type “cmd” and press Enter. This will launch a Command Prompt window within that directory.
3.2 Booting into Fastboot Mode
- Power off your phone completely.
- Once off, hold down the Power and Volume Down buttons simultaneously until you see “FASTBOOT” appear on the screen, or an image of a bunny in a fur cap.
3.3) Connecting and Verification
- Connect your phone to your PC using a USB cable.
- In the Command Prompt window, type the following command and press Enter. This verifies if your computer recognizes the connected phone.
fastboot devices
3.4) Flashing the Patched Image
- To flash the root image file, type the following command and press Enter. This will initiate the flashing process.
fastboot flash boot magisk_patched.img
3.5) Rebooting Your Device
- Once the flashing process is completed, the Command Prompt will display “Finished.”
- You can now reboot your phone manually, or type the command below in the Command Prompt window to trigger an automatic restart.
fastboot reboot
READ MORE: How To Restore Background Play Option in HyperOS? ➜
BONUS: Flashing Root Image File via Custom Recovery
If you already have the boot.img file patched via an external source, or have downloaded it directly from the internet (if you could find one), it could also be flashed using any custom recovery you have. Keep in mind that flashing this .img file using Mi’s stock recovery can render your phone unusable, so proceed with caution.
If you have a custom recovery flashed, such as Orange Fox, TWRP, etc., you simply don’t need to transfer the root image to a PC. This file could be directly accessed via recovery and easily flashed from there.
However, this method isn’t reliable since you would still need a PC. You see, if you root a boot.img file, that file has to correspond to the actual version of HyperOS you’re using, and with updates being pushed out almost every month, using the custom recovery method might not seem as usable as it sounds.
READ MORE: APatchLite – How You Root Your Android Without Magisk in 2024 ➜
Conclusion
HyperOS is among the easier operating systems to root, and the steps outlined above provide a complete methodology to do so. Keep in mind that before rooting, you will need an unlocked bootloader and be willing to take the risk of voiding your phone’s warranty. For most people, the benefits of rooting clearly outweigh these compromises that come with it.
FAQs
Yes, unlocking the bootloader is a necessary step for rooting your HyperOS device. Be aware that the unlocking process itself can take up to a week to complete. It’s important to proceed with caution, as attempting to flash unverified files or modifying the unlocking procedure can potentially brick your phone too.
While superuser access comes with its own set of benefits, it carries a cost — security. This is why certain banking or streaming applications may fail to work on your device if it is rooted.
Yes, you can flash the file directly through your phone’s custom recovery (e.g., TWRP, Orange Fox). However, you’ll likely need a PC initially to obtain the boot.img file. This is because the boot image is usually included within the main recovery zip file. Even if you manage to find the boot image file for one use, it likely won’t work for rooting other similar devices. This is because the recovery image needs to be compatible with the specific version of HyperOS currently running on your phone.