[Android General] stark4351:
SONY Xperia phones have unlocked bootloader which adds to the difficulty of rooting on top of MM.

#######All the works posted here are not mine but of various authors to whom I am gratful for helping me achieve root############

Requirements

Locked Bootloader Xperia z2

Stock SONY ROM

no root

Battery above 70(just to be safe)

Good internet connection

Now, we have lots to download because Flashtool dosen't work so, I had to download android sdk entirely.

#1

Obtaining the Bootloader Unlock Code

Note:Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Xperia Z2 you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

Open the Phone application on the Xperia Z2 and enter *#06# to obtain the device's IMEI, IDID or MEID. Save this for later use.

Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.

Put the device into fastboot mode:

Insert one end of the Micro-USB cable into your PC. Turn off the device and wait at least 5 seconds. Press and hold the Volume Up button and plug the other end of the Micro-USB cable in to your device.

Open a terminal on the PC and enter fastboot getvar version

If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.

Navigate a browser here

Select your device and click the 'continue' button at the bottom of the page.

Enter your email address, agree to the terms and select 'Submit'

Click the link from your email, enter your IMEI, IDID or MEID and continue

The unlock code should now appear, write this down for the next step.

In the PC's terminal, enter the following command: fastboot oem unlock 0xKEY

KEY corresponds to the unlock code you were given.

The Xperia Z2's bootloader should now be unlocked.

This should factory reset the phone, you may have to wait a while before reboot.

Source:https://wiki.cyanogenmod.org/w/Install_CM_for_sirius

How to check if your bootloader is locked or unlocked?

This tutorial is suitable for all versions of Android. We are provoding two different methods to check the status of your bootloader, use the one that works for you.

Method 1 :

This one is the easiest method and works with many device out there, you don’t require any use of PC, you just need to enter a spacial block of numbers in your keypad to check your bootloader’s status.

Step 1 : Open your device’s dialer (App where you enter telephone numbers to call someone).

Step 2 : Dial the below code, it will automatically open a new windows. (if it doesn’t opens anything then use the second method).

1

*#*#7378423#*#*

Step 3 : Now in that window go to Service Info >> Configuration, and see if there is :

1

2

Bootloader unlock allowed - Yes >> This means that your Bootloader is Locked

Bootloader Unlocked - Yes >> This means that your Bootloader is unlocked

Method 2 :

Step 1 : Download and install adb & fastboot package & drivers in your system (Google it for your device).

Step 2 : After successful installation of adb & fastboot, connect your device to your PC via USB cable in fastboot mode.

Step 3 : Now open the folder where your adb & fastboot package is extracted, press Shift key on your keyboard and right click in the folder and select “Open command prompt here“.

Step 4 : It will open a Command Prompt window.

Step 5 : Type the following command to check if the device was detected in fastboot mode.

1

fastboot devices

Step 6 : if you don’t get device it or anything it means that the drivers weren’t correctly installed or the device wasn’t connected properly, if this happens try reinstalling your drivers.

Step 7 : Next run the following command to check the status of your device’s bootloader.

1

fastboot oem device-info

Source:https://thebroodle.com/android/how-to-check-your-bootloader-is-locked-or-unlocked/

#2

After unlocking the device, rooting is done using Kingroot (easier), you can use either the windows app or android app.

Success rate of rooting however is very less, so you may need to do it more than a few time.

The rooting lasts only 2 restarts(for me), so you have to root again using king root.

android: http://xdaforums.com/devdb/project/dl/?id=19156

windows: https://kingroot.net/

Any problems with kingroot check the link : http://xdaforums.com/android/apps-games/one-click-root-tool-android-2-x-5-0-t3107461

#3

How to Install CWM 6.0.4.7 Recovery on Xperia Z2 D6503, D6502, D6543

Download Doomlord’s Z2_DooMLoRD_AdvStkKernel_FW-167-v07.zip

http://doomlord.xperia-files.com/download.php?dlid=WjJfRG9vTUxvUkRfQWR2U3RrS2VybmVsX0ZXLTE2Ny12MDc=

Copy the downloaded Advanced Stock Kernel.zip file to your phone’s SD card.

Extract the downloaded .zip folder on your PC, you will get a Boot.img file.

Place the extracted Boot.img file in the Minimal ADB & Fastboot folder that you created using our ADB & Fastboot Quick Setup Guide.

If you are using Android ADB & Fastboot full package, you can place the downloaded Recovery.img file in the Fastboot folder or in the Platform-tools folder.

Open the folder where you placed the Boot.img file. E.g Minimal ADB & Fastboot or Fastboot or Platform Tools.

Press and hold the shift key and right click on an empty area within the folder, and click on “Open Command Window Here”.

Turn off your Xperia Z2 completely.

Now press the Volume Up Key and while keeping it pressed plug in the USB cable.

You should see a blue light in the notification light of your phone, that means your device is now connected in Fastboot mode.

Now type the following command: fastboot flash boot boot.img

Hit Enter and it will quickly flash CWM 6.0.4.7 recovery in your Xperia Z2.

Once recovery is flashed, now issue this command “Fastboot reboot”

Your device will reboot now, as soon as you see the Sony logo, and the pink LED, press Volume Up key to enter recovery.

Once you’re in recovery, select “Install Zip > Choose Zip from SD Card > Advanced Stock Kernel with CWM.zip > Yes”. [Important]

This will flash the Kernel in your phone now. Once flashed, reboot your device.

Congrats! You should now see the custom recovery.

Source: http://techbeasts.com/install-cwm-recovery-root-xperia-z2-2301a0167-d6502-d6503-d6543/

Now, you have custom recovery, you can use this to flash ROMS. Caution to be taken when you flash a ROM you might loose your Kernel and recovery so use ROMs with inbuilt kernels or just flash after installing depending on ROM

For D6502 phone you will need to flash a fix zip after the ROM for getting network.

#4

http://www.xda-developers.com/how-to-install-twrp/

For installing TWRP follow the above guide.

Can't upload screenshots yet(don't have them, did this in a hurry)

(My internet connection is very slow)

CREDITS

All the authors of my sources

#########@@@@@@@Press that small little Thank You button:good:@@@@@@@@@############

-------------------------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>Should be here:):):):):):):):):):):):):):)