Many of the smartphone users do not know what a bootloader is or what it does but software developers know what magic it holds. By unlocking the bootloader of your device, you can root it and flash custom ROMs on it. Some manufacturers and carriers do not allow unlocking of the bootloader, while some like Sony are developer-friendly and allow it.
Earlier, when Sony was Sony Ericsson, it used to lock the bootloaders of their devices but now they want to encourage developers and make it easy to unlock them. Sony has recently uploaded a YouTube video on its developers channel that shows how to unlock the bootloader of your Xperia device and make it custom ROM-ready.
In the video, the process of unlocking the bootloader is shown on an Xperia Z2 phone and it is demonstrated on a Windows computer. The process is not simple for novices and Sony warns that it is not recommended and it may void the original warranty of the device and/or any warranty provided by the carrier. Also, if you get it wrong, the custom ROM may not work properly and some of the pre-loaded functions may fail to work. As such, you may brick your phone.
Unlocking the bootloader involves multiple steps that include getting the unlocking code from Sony, checking if device is unlockable, find your IMEI, IDID or the MEID number, installing the Android SDK from Google, installing Fastboot driver, running it and unlocking the bootloader.
Here’s the video:
Via XDA Developers