How to Root HyperOS Using Magisk in 3 Easy Steps [2024]

Key Takeaways
  • 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.

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.

Please be aware that the following information is provided for educational purposes only. Appuals cannot be held liable for any temporary or permanent damage that may occur to your device during this process.

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.

  1. An unlocked bootloader.
  2. A PC (for acquiring the boot.img file and later flashing it onto the phone).
  3. A USB cable (for data transfer). You can also opt for a wireless transfer if that is what you prefer.
  4. An active internet connection (to download required files).
  5. Platform Tools (to use Fastboot commands to flash the patched boot.img file).
  6. ADB Drivers.

↪ Enable USB Debugging

To enable USB Debugging, follow the steps below:

  1. Go to Settings and tap on “About Phone.”
  2. 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
  3. Head back to Settings and scroll down to find “Additional settings.” Tap on this.
  4. Scroll down to “Developer options,” and tap on it.
  5. Look for “USB debugging,” and turn the toggle on.Enabling “USB debugging” in HyperOS
  6. 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

  1. 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
  2. Extract the downloaded .zip file. Inside, you’ll find a file named payload.zip.
    Extracted Recovery.zip Folder
  3. 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)

  1. Download and install Python 3 (or newer) from the official website. During installation, make sure to check the option “Add Python to PATH.”
  2. Download the Payload Dumper Tool from its official website. This will be a .zip file that will need to be manually extracted.
  3. 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.
Make sure to check this box when installing Python

1.3) Acquire the “boot.img” File via Payload Dumper.

  1. Copy the payload.bin file, previously obtained from the recovery ROM zip, into the payload_input folder.
  2. Go to the parent directory containing the payload_input folder and run the payload_dumper.exe file.
  3. 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.
Acquiring the “boot.img” file

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.

  1. Download the Magisk Manager app directly on your phone from a reliable source (avoid third-party app stores).
  2. Open the Magisk Manager app. Look for an option like “Install.” Here, you’ll likely see a prompt to “Select and Patch a File.”
  3. Go to the location where you transferred the boot.img file on your phone’s storage. Select the file to patch it with Magisk.
Patching the boot.img file via 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

  1. Make sure you have ADB drivers installed on your PC.
  2. Head on over to the platform-tools folder and open a Command Prompt window.

3.2 Booting into Fastboot Mode

  1. Power off your phone completely.
  2. 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.
Xiaomi’s Fastboot Mode Screen — Old (Left) vs. New (Right)

3.3) Connecting and Verification

  1. Connect your phone to your PC using a USB cable.
  2. 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

  1. 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
Flashing the root image file

3.5) Rebooting Your Device

  1. Once the flashing process is completed, the Command Prompt will display “Finished.”
  2. 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

Do I need to unlock the bootloader before rooting my HyperOS device?

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.

Will all apps work perfectly fine after rooting my device?

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.

Is it possible to flash a rooted boot image file without a PC?

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.

ABOUT THE AUTHOR

Muhammad Qasim


Qasim's deep love for technology and gaming drives him to not only stay up-to-date on the latest developments but also to share his informed perspectives with others through his writing. Whether through this or other endeavors, he is committed to sharing his expertise and making a meaningful contribution to the world of tech and gaming.