[Xperia Z2 Q&A, Help & Troubleshooting] tooplanx:
For Z2 Marshmallow .291 and LOCKED bootloader.

Working for D6503. Seems to be issues for D6543 model. Not sure about D6502...

1. Firstly go to https://drive.google.com/file/d/0B6aEcBP7FwsWUGpQdHdvaVRCQlk/view and download the .291 kernel.

2. Then download SuperSU from here.

3. Put both these files on your phone's SD card.

4. Next download the .575 kernel here.

5. Before this can be used, you need to change it from a .zip file to a .ftf file.

- Go to the file location in the file browser.

- Click on the 'View' section in the top ribbon (Win 10).

- Check 'file name extensions' in the 'show/hide' section.

- Rename the kernel file, deleting the .zip and replacing it with .ftf instead at the end.
​

6. Download the Recovery for MM from here.

Extract the zip file.

7. Download the correct drivers for your phone: simplest way seems to be by installing Sony PC Companion and connecting your device.

8. Download and install 'Flashtool' from here. (The 0.9.18.6 version seems to have better compatibility).

9. Install the drivers for the flash- if you are on windows 10 or 8 you will need to turn off driver signing first:

A) Press the Windows key + R together and in the ‘Run’ box type: shutdown.exe /r /o /f /t 00

- This will take you to the advanced boot menu.

– Now make the following selections to boot into the Start Up Setting Screen: Troubleshoot > Advanced options > Start Up Settings > Restart

– Then, when the machine restarts, select number 7 i.e. “Disable driver signature enforcement”. Your machine will start with Driver signing enforcement disabled until the next reboot.

B) Now you can install the Flashtool drivers.

– Windows will warn that the driver is not signed and will require you to confirm the installation.

– Once the installation is complete, reboot the machine​

To install the drivers you need to go to the Flashtool install folder (e.g. C:\Flashtool) and go in to the 'drivers' folder and run the 'flashtool-drivers.exe'.

- From the menu select Flashmode drivers, Fastboot drivers, and then scroll down and select Xperia Z2 device drivers (not sure if this last one is necessary if you've done step 7 previously, but I did it and everything worked.)

- Click install, and click okay on the warning messages.​

10. Enable developer options on your phone (repeatedly tap on build number in 'About phone' in settings.)

Then make sure that USB Debugging is enabled, and in 'Security' that 'Allow Unknown Sources' is enabled.

11. Back up vital data (though you shouldn't loose anything), then power your phone off with it not connected to the computer.

12. Startup Flashtool and let it update etc.

13. While holding the volume down button on your phone, connect it to your PC.

Flashtool should respond and spew out a few lines of text ending with something like 'Phone ready for flashmode operations'.

14. Click on the lightning bolt, select 'Flashmode', and then in the next window browse to the location of the .575 .ftf kernel file you made. Select it, then click 'flash' at the bottom right. There should be more lines of text hopefully showing that this is completed successfully.

15. Close Flashtool, disconnect your phone, then turn on your phone.

16. Flash the recovery: Reconnect your phone to the PC and select MSC mode.

Go to the unzipped recovery and run 'install.bat' as administrator (if that doesn't work try not as administrator).

If the window that opens up stays on 'starting daemon...' for a while check on your phone as you may need to authorize the 'unknown source' connection from the PC.

The installation should complete with a 'press any key to continue'. Your phone should then automatically reboot in to TWRP recovery.

17. Install SuperSU: Once in TWRP go to 'Install' and select the SuperSU zip (you may need to select 'storage' and choose your SD card first). Swipe to install!

18. Reinstall the .291 kernel: still in TWRP do basically the same as for SuperSU but this time with the MM .291 zip.

19. Cross your fingers and reboot!

20. All being well you are now rooted, you can check root by installing 'Root Checker' form the play store.

21. Open a beer and relax!

(22. Install Cyberian camera!)

Please give me some thanks if I have helped you!

Credits:

Rocker00 and this thread: https://xdaforums.com/xperia-z2/general/tool-rooting-23-5-1-291-supersu-t3437280

Xperia Blog

Dr. Death

EDIT: Any chance of a sticky, moderator?