In order to keep the user protected Android devices have what they call a bootloader. In a locked state, it is responsible for making sure the software installed is authentically signed by the OEM. If your device is unlocked then this guide will show you how to lock (or relock) the bootloader of the Xiaomi Mi A2.
So last week I showed you how to unlock the bootloader of the Xiaomi Mi A2. I did this because a lot of people want to install software on their phone that isn’t signed by the OEM. Without doing that, we can’t install things such as TWRP, Magisk, custom ROMs and more. Some people don’t want to do any of that though.
In those cases, you will want to make sure the bootloader is locked. When you buy any Android phone brand new the bootloader is locked by default. But you may have purchased a used Xiaomi Mi A2 and noticed that the bootloader is unlocked thanks to the warning screen.
Or maybe you unlocked the bootloader yourself. Many people see these mods and want to experiment with a custom ROM or a custom kernel. That requires you to unlock the bootloader but maybe you’re done experimenting and would rather just go back to the way things were.
This is why I have created this tutorial. To show you how we can go back to the way things are.
Warning – Not only will relocking the bootloader of the Mi A2 erase all of the data from your smartphone (apps, games, pictures, videos, app settings, etc.), but it can also be dangerous to do if you have modded software on your phone. I personally recommend following an ‘unbrick’ or ‘return to stock’ guide before locking the bootloader of the Xiaomi Mi A2.
How to Relock the Bootloader the of the Mi A2
- Boot the Xiaomi Mi A2 into Fastboot Mode
- Connect the Mi A2 to the PC with a USB cable
- Open a Command Prompt or Windows PowerShell in the same folder as your ADB/Fastboot tools
- And then type in the following command. . .
fastboot flashing lock
- Then press the Volume Down button twice to highlight the Lock the Bootloader option
- Press the Power button to select this option
- Watch as the Xiaomi Mi A2 reboots on its own and wait
This first boot cycle will take a while since it performs a factory reset and then has to set everything back up again. So be patient and/or follow along with the video below.
So as I mentioned above, there will be two type of people who will find this guide useful. If you’re the one who did the bootloader unlock stuff on your own then this entire process should feel familiar. If that is the case then just be sure you follow through with the same steps.
The only difference here is that the process is actually much shorter. The unlock tutorial was 16 steps and this one is only 6. That’s because we don’t have to go through the OEM unlock toggle process. Speaking off, once you have relocked the bootloader of the Mi A2, you could go back into Developer Options and disable the OEM Unlocking option if you wanted to.
Just make sure you type in fastboot flashing lock instead of fastboot flashing unlock and you’ll be fine. You’ll see a similar warning screen appear on your Mi A2 and you will still need to use the Volume Up, Volume Down and power buttons to navigate through the menu.
How to Relock the Mi A2 Bootloader?
Now, if you purchased a Mi A2 from a friend or used from some online marketplace then things could be different. Firstly, you could be familiar with this process in general and just needed this guide to make sure you knew the relock command. However, this may be foreign to you and that can be worrisome.
The process is simple though (again, remember the actual tutorial is only 6 steps). However, you may not have ADB and Fastboot tools installed on your computer. You may not even have the proper USB drivers installed (although those should install automatically when you connect the phone to the PC).
If you’re in this segment then I recommend looking above the tutorial and installing the Minimal ADB and Fastboot tools that I have linked over on XDA. Not only will this get you the up to date tools that you need installed, but it also comes with a convenient icon shortcut that you can put on the desktop.
This way, when I say ‘open a command prompt in the same folder as your ADB and Fastboot tools’, you can just double click that shortcut that the program created for you. It will open up a Command Prompt in the same folder as your Fastboot.exe file and you can continue with the tutorial.
You could also navigate to where your ADB and Fastboot tools are located in via Windows Explorer though. Then hold the Shift key on the keyboard and right click on an empty spot of the folder. Doing this will make a new option appear in the context menu labeled Open PowerShell Window Here.
And this will effectively give you the same results (just with Windows PowerShell instead of the Command Prompt).
Hi great DIY Or Stuf the comamand “fastboot flashing lock” dose not run i have try “fastboot oem lock” and it worked
The command that you used worked (while mine didn’t) because you have an old version of ADB/Fastboot that needs to be updated.
These tools, for the most part, will work just fine if you don’t update them (other than command changes that you have encountered here), but some devices (like the Pixel phones) use commands that are only available in the newer version of ADB/Fastboot.
So I would look into updating your ADB and Fastboot tools if I were you.
Is it possible to lock the bootloader while running a custom rom? Or should I revert back to stock firmware?
do not do that. the point of locking the bootloader is to make sure the device is running officially signed software (which ROMs are not considered to be) and will result in the device not being able to boot up (at least in some cases).
it’s definitely not something that I recommend doing. revert back to 100% stock software before locking the bootloader
i locked the bootloader and it goes into a bootloop saying “your devices software can’t be checked for corruption, please lock the bootloader.
is it okay to relock bootloader after changing setprop on camera api? cz i want to install gcam with no twrp or magisk at all