[Sony Xperia M] hitlerII:
Unlocking/Relocking Bootloader

Install Kernel (CMW)

Install Root

Install custom ROM

I've made this tutorial because I haven't found all, complete and put together information regarding fully debugging Xperia M phone. And now that my phone is up and running beautifully I can share my experience.This is all the info in one place, for any problems you may encounter during rooting/installing custom roms.

First you will need the following (you have the link attached to this thread):

Download and install FlashTool - Linux version is recommended. I never could use all the FlashTool options and drivers on Windows (XP and 8). Do not use Sony Flashtool, Emma - it's rubbish. Don't use any other software that promise to root/unlock bootloader with one click.

Download kernel

Download SuperSU

Download drivers for windows - if you're doing this on Windows (not recommended). For Linux you know need no additional drivers. You can also find drivers in FlashTool folder at c:/FlashTool/Drivers.

Download ROM and Apps

Download FTF original firmware

Note: Final FTF download is not necessary if you're not in bootloop or don't have any other bricking problems.

Step 1. Unlocking bootloader.

Warning: Do not use the official Sony method because this will cause your phone to enter in bootloop. In case your phone is already bootlooping see below.

- Install all the drivers and then start FlashTool.

- Power off phone

- Connect USB cable to PC. With the phone powered off keep pressing the volume up button while plugging the other end of the usb cable into the phone. Now your phone is in bootloader mode and the blue led is on.

- Press the BLU button in FlashTool

- Choose the correct phone model (Xperia M) from the list. Double click on it.

- Your phone's IMEI will be automatically be copied into FlashTool, all you need to do is hit Unlock.

- You can then disconnect your phone from PC and boot it up. Now your bootloader is UNLOCKED.

Step 2. Flashing Kernel.

- Power off phone.

- With FlashTool running connect the USB cable to PC

- Now you will have to put the phone in FLASHMODE: this time you will hold the DOWN volume button while plugging the other end of the USB cable into phone. The led will be off. Now you're in FLASH MODE.

- Click on the thunder button in FlashTool, select Fastboot

- Click on Select kernel to flash and from the open windows, on the bottom, select the .img file type.

- Choose one of the kernels you've downloaded in the above link.

- Flashing will be made automatically. You can now manual restart your phone or choose Reboot into system option from FlashTool.

- Your recovery is now installed. You can enter into recovery by pressing 2 TIMES very quickly the DOWN or UP volume button at boot when the purple led is on. Depending on the kernel, you will have to use either the Up or Down volume button.

Step 3. Rooting.

- Copy the SuperSU on SD card

- Enter recovery mode

- Install from zip

- Done

Step 4. Install custom ROM and Apps.

- Copy ROM image and Apps zip on SD card

- Enter recovery.

- Wipe all data, cache and Dalvik

- Install from zip, first ROM and then Apps.

- Optional, depending on the ROM, you can choose during Rom setup if you want to keep the kernel or install another one.

IN CASE YOU'RE IN BOOTLOOP (phone restarting over and over again or boot image stays on forever without the phone completing bootup).

This can happen if you have used the official Sony bootloader unlocking.

To fix the problem you will have to re-lock your bootloaded, flash the original firmware and then unlock the bootloader again using the correct way (FlashTool).

Relocking the bootloader is the same as unlocking (see Step 1), but instead of Unlock button you will have the Relock button.

The you will have to flash the original firmware (see download list).

- Power off and disconnect your phone from PC.

- With FlashTool runing connect USB cable into PC

- Copy the FTF file into c:/FlashTool/firmwares

- Press the thunder button in Flashtool and choose Flashmode. You will see the image you just put in /firmwares in the list. Choose it and hit FLASH.

- FlashTool will prepare the firmware. In a few minutes you will be asked to connect the phone in FLASHMODE. (Connect usb cable while presing the volume Down button)

- Now flashing will start automatically. At the end disconnect your phone and reboot.

Now, you're fresh and funky with a stock phone. To root your phone start from step one and unlock bootloader with FlashTool.