How To Install Android 5.1.1 Lolipop (Cyanogenmod 12.1) On Sony Xperia M (C1905) [Step-by-step]

Step by step guide, how to install Android 5.1.1 Lolipop on Sony Xperia M (Android 4.3). Tested on my Xperia M (C1905).
What You Need:
1. Root Your Phone / Unlock Fastboot (Your warranty is now void)
2. Android Studio [Download]
3. Java SE Development Kit 7 [Download]
4. USB Fastboot Drivers for Xperia M - best to use it form Sony site what they will give you but you can use my: [Download]
5. CWM [Download]
6. Android 5.x (CM12 (5.0) or CM12.1 (5.1.1) ROM)
[Download-CM12-Final] or [Download-CM12.1]
7. GAPPS [Android 5.x - CM12 - CM12.1 - Download]





* I am not responsible for bricked devices, dead SD cards or anything else. Please do some research if you have any concerns about features included in this ROM before flashing it! I did not make these ROM i just want to tell you how to install it and use it... how i did it.. YOU are choosing to make these modifications, and don't try to point the finger at me for messing up your device. *

GLHF!

Let's Start...

Before these I use Android 4.3 on my Sony Xperia M (Don't know did will these work on other versions like Android 4.1 or 4.2 etc...)

Before all Download version of Android you want to install on your Sony Xperia M,
I use 20150613 build of  Cyanogenmod 12.1- That means Android Lolipop 5.1.1 [Download]
or Download Latest Build [Here] (always use latest build - recommended)
Most Recommended Build is Cyanogenmod 12-Final [Download] - Android Lolipop 5.0.1
Now you will need GAPPS, if matter what version you choice you download GAPPS:
GAPPS for Cyanogenmod 12.1 or 12 [Download] or [mirror]
(don't make mistakes, if choice CM12 download GAPPS for CM12 or 12.1, don't use GAPPS of CM11 or any other version.)
After download all these what you choice, copy it in your SD-card.

Now first go to Sony [Go-to-Sony] - Select your device (Sony Xperia M) and click continue.
(Note! First check if it is possible to unlock the boot loader of your device in the service menu by following the steps below:
 1. In your device, open the dialler and enter *#*#7378423#*#* to access the service menu.
 2. Tap Service info > Configuration > Rooting Status.

 3. If Bootloader unlock allowed says Yes, then you can continue with the next step.
 4. If it says No, or if the status is missing, your device cannot be unlocked.)
 Enter your email address, accept terms & conditions and click submit.
Go to your email and click on link they send to you, Enter your phone IMEI number (to check IMEI call *#06#). and follow instruction they give to you to fast boot or follow me...
Now you will need Android Studio [Download]
and
Java SE Development Kit [Download] or [mirror]
Download All And Install it... after install go to Android SDK folder: (Windows 7 x64) in my case they was in:  C:\Users\{user name}\AppData\Local\Android\sdk\extras\google\usb_driver (Download fastboot driver they give to you on webpage and extract and replace in usb_driver folder)
If there is not usb_driver - folder then first [Download] and extract these in google folder, then download fastboot driver they give to you and replace it.
Now you need to connect phone in Fastboot.
a) turn off your phone
b) press and hold Volume UP button
c) connect phone with your data-cable to PC (don't use damaged cable you will brick your phone)
d) when light is blue release button
e) when asked for a driver point to the usb_driver folder where you placed the android_winusb.inf-file (file what the give to you to download)
f) When your device is connected, go to Android SDK folder and go to the platform-tools folder. (if there is not platform-tool folder [Download] it and extract in SDK.
g) open platform-tool folder on blank space hold "Shift" on keyboard and click right click and click "Open command windows here" - CMD is open.
h) type: "fastboot devices" if there is your device that's OK (if not you missed something Go back again).
i) now type: "fastboot -i 0x0fce oem unlock 0x{HERE YOUR UNLOCK CODE - (on the top on page)}"
something like these: "fastboot -i 0x0fce oem unlock 0xFE453632B96C85AA"
and press Enter
(Now you unlock boot loader but you Void your warranty )

Next Step is it to flash boot... After downloading CM12 or CM12.1 mode you choice you need to open with WinRAR or some another archiver and extract "boot.img" in platform-tools - folder. You can use that "boot.img" but i recommended CWM [Download] - Because i have problems with other boot's (Stuck on boot animation loop - FiX).

Now go back to CMD and type:
"fastboot flash boot boot.img"
after that finished type:
"fastboot reboot" - and disconnect your phone or reboot manually.
If phone won't start don't panic and relax :D
take off battery,  put in your SD card (where is ROM you want to install) put battery back...
Power On Phone, when light is "pink" press and hold Volume UP button until light come "blue" then release button and now you are in CWM mode...
Finally Last parts:
Now you need first "Wipe data/factory reset", "Wipe cache partition" and "Wipe media" - (if there is Wipe Media),
Then go to apply updates... choice SD-Card and Choice first CM12 or CM12.1 (wait it will take some time)
Then go and install GAPPS for CM12... after finish ... reboot system (phone)
and wait to start phone... that can take a 5-10 min or more... but if that take more than 20 min.. something goes wrong you miss something... try some last steps again or contact - comment for help and solutions. be warn don't try anything stupid... that may brick your phone!

GLHF :D

Video Tutorial: [Soon]