[Sony Xperia XZ Premium Guides, News, & Discussion] sToRm//:
+++++++++++++++++++++++++++++++++++++

THIS IS JUST A BACKUP OF MY FIRST POST!

I WILL UPDATE THE FIRST POST WITH MY TOOL AND LET THE OLD INSTRUCTIONS HERE FOR EVERYONE WHO WANT'S TO DO THINGS MANUALLY!

+++++++++++++++++++++++++++++++++++++

##### WARNING: ########

Please note that the modification can result in a loss of warranty. I accept no responsibility for any damage that may occur and do not guarantee the functionality of the modifications. I have created this modification for myself and I just want to make it available to other users. If you have no idea of these things, please keep your fingers away. This hack may - in case of incorrect application - destroy your phone. Please keep to the instructions and report errors right here in the thread.

##### INFO: ###########

I' m providing a complete guide here, explaining how to unlock and root the Sony Xperia XZ Premium. In addition, I offer my hack for the DRM problem. You can root your device and still use the full functionality of the camera. Please note: DON'T flash the fix of other devices/versions to your phone! There are patched system files in my fix, which are only for the related phone/version! I will create different patches for other devices and firmware versions in the future!

Sony has worked on the newer devices on the security functions and made it more difficult to crack the DRM protection. Hidden checks were implemented to make cracking more difficult. The old DRMfix by Tobias Waldvogel no longer works with newer devices. I therefore spent a lot of time (a few weeks) and cracked the protection. Since this was my first time with Sony and I had previously no experience with it, it was a very hard job for me. But okay... finally I did it. And here are my 5 cents...

##### INSTRUCTIONS: #####

Before you start:

PLEASE CHECK THE RIGHT VERSION OF YOUR FIRMWARE!!!

Settings -> About the phone -> Model & Build number

Don't flash a kernel that doesn't match your build!

1. Unlock your bootloader

Visit: https://developer.sonymobile.com/unlockbootloader/ Choose "Xperia XZ" from the list of the devices and follow the instructions to unlock your bootloader. Please note, that as soon as you unlock your device, your unique device keys are lost (forever!) and there is NO way back anymore!

2. Install custom recovery (TWRP)

The custom recovery is required to flash packages. You must have "Fastboot" on your computer. For Windows, there is a simple solution here (if you have not installed it yet): https://xdaforums.com/showthread.php?t=2317790 After you downloaded and installed it, you can start the tool. Copy the twrp.img file from my package (folder "1 - Recovery") to the program folder, where ADB and Fastboot is installed.

Turn the phone off completely and unplug the USB connector, if connected. Now hold down the VolumeUP(+) key only and plug the USB cable to PC and mobile phone. The device is in "fastboot mode" now. Okay... Let's flash the custom recovery to the phone. In Fastboot (on your PC) type:

> fastboot devices

Your phone should be listet with a serialnumber and fastboot mode. If it's there, you can flash the recovery.

> fastboot flash recovery twrp.img

Done. Now you have a custom recovery installed. Easy huh?

Now unplug your USB cable again and turn of the phone.

3. Flash rootable kernel (sToRm_restore Kernel)

To flash my patched kernel (required for DRMfix!) you can start TWRP recovery. To do this, just hold down the VolumeDOWN(-) key and press the power key. Hold the VolumeDOWN(-) key until the TWRP splash screen shows up. Dude... You are now in your custom recovery. Great!

Now plug in your USB cable again. On your PC you can now open the phone's memory and drag the needed packets to the mobile phone. Whether you use the internal memory or the external memory does not matter. Please copy the following folders with the included zip archives to your device:

-> 2 - Kernel

-> 3 - Root

-> 4 - DRMpatch

Once the archives are on the phone, you can take your phone back into your hand and install the packages in TWRP. To do this, choose "Install" in the TWRP recovery. Now look for the archive with the kernel (example: XZP_45.0.A.7.137_R7A_ROOTABLE_DRMABLE.zip) in the folder "2 - Kernel" which you copied to your device. Select the archive for the installation and wipe to the right to install the package. After that, DON'T REBOOT your phone! First, go back (back button) and continue with the following point...

4. Flash root (Magisk)

Just as the kernel was installed, you can now install Magisk. Search the archive for Magisk (Magisk-v14.0.zip) in the folder "3 - Root", which you copied to the mobile phone. Select the archive for installation and swipe right again to install the package. Then go back again without a reboot and continue with the next point!

5. Flash DRMfix (sToRm_restore DRMfix)

As with the Kernel and Magisk, you can now also install the DRMpatch (DRMpatch-sToRm.zip) from the folder "4 - DRMpatch". Select the archive for installation and swipe right again to install the package.

Finally, you can "clear cache & dalvik" aaaaaaaaaaaand REBOOT!

Congratulations!

You now have an unlocked, rooted XZ Premium with my DRMpatch and can use your camera and other functions again without ugly green pictures! Wohoooo... Easy going, huh?

Let's be quiet for a moment and imagine the faces of the developers, who wanted to prevent a DRMfix with the new firmware versions and complex encapsulated security functions:

Cheers!

//sToRm (Heiko Frenzel)

##### FAQ: ################

Can this patch bring back the device key?

No! It simulates the key and a locked device without root. If you unlock and root your device, the unique device key is gone forever! There is not turning back!

Can I use another kernel with this patch?

No, my patched kernel has some lines in, which are required for the DRMpatch! If there is another kernel and other users want the fix in it, too, I can mod this kernel and release it in this thread.

Can I use another root method with this patch?

Yes! You can use SuperSU or something else if you want to. I myself have Magisk installed, because it works super smooth and the SafetyNet status is okay.

Can I use the patch for other devices or versions?

No! Please don't try this! In my patch I had to fix a system file which is different between the devices and versions. If you flash the wrong version, it could brick your phone! I will create other versions of my patch for other devices, too. So be patient!

##### DOWNLOADS: ##########

Model: G8141 @ Android: 7.1.1 @ Build: 45.0.A.7.137_R7A

Model: G8142 @ Android: 7.1.1 @ Build: 45.0.A.7.137_R5A

Model: G8141/G8142 @ Android: 7.1.1 @ Build: 45.0.A.7.137_AndroPlus_v06

-> sToRm_restore_PACK [DOWNLOAD]

Optional kernels for older versions:

(Note: This is optional for older versions - only the kernel! You also have to flash the DRMpatch and Magisk from the sToRm_restore_PACK above!)

AndroPlus_v04 @ 45.0.A.7.90 for G8141 & G8142

[DOWNLOAD]

AndroPlus_v05 @ 45.0.A.7.120 for G8141 & G8142

[DOWNLOAD]

##### SUPPORT / DONATION: #####

If I could help you with my work, I would be glad if you give me a small thank you. You can DONATE HERE. This would also support further development for newer versions and other devices. Big thanks!