Friday, 12 September 2014

Sony Xperia P: bootloader unlock, rooting, custom recovery, kernels, roms, flashing

Ok so my first tutorial is for sony xperia p LT22i. Its a great phone in a good price. Was my former Android Phone. Had fun in flashing custom roms in it. This tutorial will include how to unlock the bootloader, root your phone, installing custom recovery and kernel, flashing roms and flashing stock(original) firmware/rom.

Unlocking bootloader
Unlocking the bootloader is the first step in Android hacking. Before you start unlocking make sure to make a backup of all your data and apps as it will factory reset your phone. Also Charge your phone to upto 70%

Note: Unlocking Bootloader of Xperia P Will Void It’s Warranty Provided By The Manufacturer (Warranty Can Be Retained By Relocking The Same).
Disclaimer: We Have Made This Article Covering Each & Every Part Required For Unlocking Bootloader of Xperia P At Our Level Best. In Case if Any Damage Happened To Your Device (It Should Not Be), I Will Not Be Held Responsible For It.

Before unlocking bootloader, you need to check that if your device’s bootloader can be unlocked or not. For checking bootloader status dial *#*#7378423#*#* from phone dialer to access service menu.Find bootloader unlock status over there. If it is set to yes then only you can unlock your device’s bootloader otherwise it’s impossible to unlock it using this method and you will have to wait for me to post a method for this.

After this note down your IMEI by dialing*#06# or going to settings and about phone.
Now the drivers are to be installed. Download the fastboot package with usb drivers from the link below and extract the files on desktop. After this you will have two folders: fastboot and usb_driver.
Link
After that turn off your phone. After it is completely turned off press and hold volume up button and connect your phone to pc using a usb cable. A blue led will be lit in your phone and a window will open in your pc for driver installation. Choose manual installation and select android_winusb.inf from usb_driver folder. In windows 8 there are some issues in installing drivers. You can try installing drivers with this method: Press start button+R then type hdwwiz. It will open add a hardware then select show all devices the browse to Driver's and select android_winusb.inf. Open it and install.
Then go to the sony's official bootloader unlocking page:http://unlockbootloader.sonymobile.com. 
Scroll to the end and press continue. Then accept all agrrements and disclaimer. Then input your IMEI and email address. Then open the email received and click on the link to continue. Then at the top of the page your key will be written. Copy the key somewhere safe.
Then open a command prompt by pressing start button+R and typing cmd. Then type without the quotations "cd desktop" and press enter. Then type without quotations "cd fastboot" and press enter. Now again connect your phone in fastboot mode by powering it off and connecting it to pc while holding volume up button. Now type without quotations in the command prompt: "fastboot.exe -i 0x0fce getvar version". If value 0.5 is returned, it means the phone is connected properly. Now type without quotations: "fastboot.exe -i 0x0fce oem unlock 0xKEY" replacing the KEY with the key you recieved from sony's unlocking website. Then press enter. Congo you have an unlocked bootloader.
To relock the bootloader you have to use flashtool. Run flashtool and connect your phone in fastboot mode. Click BLU and select the model of the phone from list> Then click relock. It will relock your phone's bootloader. If it does'nt work there is an alternative method. Download the ftf file from the link and flash it in flashmode using flashtool. Reboot the phone and your bootloader will be locked. If there is a bootloop after flashing flash stock firmware using flashtool. Flashing using flashtool can be learned under the last topic that is flashing stock rom in the same post.
Relock bootloader  

Rooting
Now after unlocking bootloader you can root your phone. To root your phone first tick usb debugging in developers options in settings. Then download the file in the link below. It is the root tool compiled by bin4ry a recognized xda developer.
Link
After downloaing extract the files. Connect your phone and open RunMe.bat. Type 2 and enter and the script will root your phone. Congo your phone is rooted. 

Installing custom recovery/kernel
You can install custom recoveries and kernels on your phone after unlocking your bootloader. You must have read the purpose of flashing recoveries and kernels in Android hacking basics page. 
There are two main custom recoveries: Clockworkmod(CWM) and TeamWin Recovery Project(TWRP). For now i will only be posting for cwm as for twrp you need to learn extracting files from a stock firmware. Donload the file from below link for CWM.
CWM
To install CWM extract the files, connect your phone with debugging and run install.bat and follow the instructions.
Your device now has a custom recovery. Use it by powering it off and then on and keep holding volume up button until the recovery is booted.


To install a kernel just download it extract the boot.img in fastboot folder open a command window and cd to the fastboot folder boot your phone into fastboot and type:
fastboot flash boot boot.img
 This is a list of kernels for xperia p:
Nemesis Kernel V6.3
Sliding Kernel V9.0
Phantom Kernel V1.1.0B

【cm9】【stock】【kernel】Jan 10, ThP kernel v7.5 【3.0.58_RC-1】【xperia P】
[Kernel][Sony Xperia P][January - 11] Sliding_XP v7.1 Kernel [CM]
[Kernel][Xperia P] ICX kernel [oc, governess, I/O, Fast] V4-test
Xperia P Autoroot Kernel With Recovery for ICS !
[Kernel][Sony Xperia P][November - 28] Sliding_XP Kernel v4-A
[kernel] [P] Neuro kernel CM9 v1 Release
[Kernel][Xperia P]Xperia SSpeed kernel v4 released|Fast, stable, smooth, NTFS[02/08]
[KERNEL][Xperia P] Advanced Stock Kernel [Rel:v02][Dt:16/JUNE]
Advanced Stock Kernel for 6.0.B.3.184


Flashing custom ROMs
To flash a custom rom you must first make a backup of your data and apps. Titanium backup is a good app to backup apps. Then download the rom and place it in your sd card. Power off your phone and boot into cwm recovery. Choose install from sd card and choose the file placed in your sd card. Confirm and after flashing reboot your phone. But for some roms the kernel has to be flashed also in fastboot mode. I will post complete steps for some specific roms later.

Flashing stock ROM/Firmware
To flash a stock rom you need to download flashtool first. Download it from here: http://www.flashtool.net/index.php. Then install it and go to the directory where you have installed it and from the firmwares folder delete the file already present there. Then download the desired firmware and place the .ftf file in firmwares folder. Now start the flash tool and click on the flash button (lightning bolt button). Then choose flashmode and press ok. Now select the firmware and check all the options in the wipe box and click ok. Then it will ask you to connect your phone in flash mode. Do it by powering off your phone and connecting it to pc while holding volume down button. The green led will be lit and the flashing will start. Wait till it completes. DO NOT UNPLUG YOUR PHONE IN BETWEEN. After the process is completed unplug it and power it on. At the moment you will have to search for the firmware files. In a short time i will post the links.

No comments:

Post a Comment