relock bootloader xiaomi

How to Relock Bootloader on Xiaomi Devices

In this guide, we will show you the steps to relock the bootloader on your Xiaomi device. When it comes to custom development, then it goes without saying that the likes of Xiaomi/Poco/Redmi/Mi are among the most popular players in the town. From flashing custom ROMs and recoveries to gaining administrative access by rooting your device, the possibilities stand endless. However, this is just one side of the coin as carrying out these tweaks has its fair share of issues.

Some of the noteworthy ones include the likes of SafetyNet getting tripped thereby resulting in your inability to use banking and payment apps to WideVine L1 Certification getting downgraded to L3, well, the list goes on. To overcome all these roadblocks, your best bet is to switch over to the stock ecosystem and then relock the bootloader on your Xiaomi device. So without further ado, let’s show you how this could be carried out.

How to Relock Bootloader on Xiaomi Devices

The below process will wipe off all the data on your device, so please take a complete device backup beforehand. Droidwin and its members wouldn’t be held responsible in case of a thermonuclear war, your alarm doesn’t wake you up, or if anything happens to your device and data by performing the below steps.

STEP 1: Remove All Modules

Your first course of action should be to remove all the modules installed on your device. These include the likes of Magisk mods, LSPosed, LSPatch, etc. For instance,

  • In the case of LSPosed: launch LSPosed > go to Modules > long press on a module and select Uninstall.relock bootloader xiaomi
  • In the case of Magisk: Launch Magisk > go to Modules > tap on Remove next to each of the modules.relock bootloader xiaomi
  • Likewise, also remove any rooted app that might impact the system component in any way, such as Viper4Android.

Once you have removed all the modules, restart your device for the changes to take place. Your device will still reboot to the rooted environment but with all the mods disabled. So let’s now proceed ahead and remove root from your device

STEP 2: Unroot Xiaomi Device

  1. Launch the Magisk App and tap on Uninstall Magisk.
  2. Then tap on Complete Uninstall and wait for the process to complete.
  3. Once done, hit Reboot. Your device will now reboot to the non-rooted OS.relock bootloader xiaomi

STEP 3: Remove TWRP Recovery [If Installed]

If you know the partition to which the TWRP recovery is flashed [such as recovery, vendor_boot, boot, etc], then our job will be quite easy and short [as shown below]. So if you have flashed the TWRP in the recovery partition, then simply flashing the stock recovery.img might get the job done.

On the other hand, if you had flashed it in the boot partition, then you’ll have to flash boot.img and a couple of other files [vendor_boot and dtbo]. It’s highly recommended that you go through the below linked guides once if you are unsure of the partitions to which you have flashed TWRP:

  1. First off, download and extract Android SDK Platform Tools on your PC.
  2. Then download the Fastboot ROM and extract them onto your PC.relock bootloader xiaomi
  3. Now extract the partition to which you have flashed the TWRP Recovery.
  4. Then place those files in the platform-tools folder.
  5. Now connect your device to the PC via a USB cable. Make sure USB Debugging is enabled.
  6. Then head over to the platform-tools folder, type in CMD in the address bar, and hit Enter. This will launch the Command Prompt.Unlock Bootloader Pixel 7 Pro
  7. Type in the following command in the CMD window to boot your device to Fastboot Mode
    adb reboot bootloader

    relock bootloader xiaomi

  8. To verify the Fastboot connection, type in the below command and you should get back the device ID, as shown in the image.
    fastboot devices

    Relock Bootloader Android

  9. If you are not getting any ID, then install the Fastboot Drivers on your PC.
  10. Now flash those stock files to their respective partitions. For example, in the case of Poco F4 which does not have a recovery partition, I’ll have to flash boot, dtbo, and vendor_boot files.
    fastboot flash boot boot.img
    fastboot flash dtbo dtbo.img
    fastboot flash vendor_boot vendor_boot.img

    relock bootloader xiaomi

  11. Once done, reboot your device to the OS via the below command
    fastboot reboot

STEP 4: Relock Bootloader via Mi Flash Tool

Now that we are in a completely non-rooted stock ecosystem, we could proceed ahead and relock the bootloader on your Xiaomi device. In this regard, it is highly recommended that you flash the same firmware [or its higher version] that was earlier installed on your device in order to avoid Anti Rollback Protection.

relock bootloader xiaomi

Once you have got hold of the Fastboot ROM, you could refer to our detailed guide on How to Flash Firmware on any Xiaomi/Redmi/Poco via Mi Flash Tool. Just make sure to select the clean_all and lock option while flashing. As soon as flashing is complete, your device will boot to the OS and the bootloader will be locked.

STEP 5: Check out the Results

Now that you have checked all the prerequisites, you may check out the results. While there are five ways of verifying if the Bootloader on your device is locked or unlocked, but the easiest way of doing so is via the Developer Options. So head over to Settings > Developer Options > OEM Unlocking should be set to: Allow the bootloader to be unlocked. hi signifies that the bootloader has been locked on your Xiaomi device.

relock bootloader xiaomi

So these were the steps to relock the bootloader on your Xiaomi/Poco/Redmi/Mi device. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.

About Chief Editor

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.