[Sony Xperia XZ Guides, News, & Discussion] korom42:
Stock Kernel + ROOT + TWRP + DRM Fix​

** Your warranty is now void.
**
** I am not responsible for bricked devices, dead SD cards,
** thermonuclear war, or you getting fired because the alarm app failed. Please
** do some research if you have any concerns about features included in this MOD
** before flashing it! You are choosing to make these modifications, and if
** you point the finger at me for messing up your device, I will laugh at you.
**

Update July 31, 2018

This thread is marked as discontinued. This means that It won't be updated so don't bother asking and I will not publish any more posts here or contribute to the general discussion. However, I might add files from time to time if necessary.

Requirements

If you haven't unlocked bootloader yet check this guide

Good News ! If you have TA.img backup of your device I highly suggest using this tool to patch stock kernel using your own TA image to have drm working with latest Magisk 16.3. Follow TA_POC METHOD instructions below .

- Kernel (boot.img) + Magisk + DRM fix patch

https://drive.google.com/open?id=1wv-Djz38wT_gywlJZPFPG13dATP90-E8

- Latest TWRP from

here

And obviously :

- ADB and FASTBOOT : https://xdaforums.com/showthread.php?t=2317790

- Xperia XZ drivers : https://developer.sonymobile.com/downloads/drivers/xperia-xz/

- FlashTool : http://www.flashtool.net/downloads.php

What are DRM Keys ?

Kernel features

this is pure stock kernel of the mentioned above firmware with

- RIC disabled

- added DRM patch support

Instructions

Before proceed backup all you important data like pictures, files to another device.. !

Make sure you follow all steps carefully with caution .. !

NEW! TA_POC METHOD

(Magisk 15.3+ ONLY / For those who have TA.img backup)

After downloading and extracting this tool and these files just copy them to the tool folder and put yout TA.img (case sensetive) there as well

Open command prompt in rootkernel tool folder

or

Open cmd --> cd "rootkernel tool dir" for ex for my case I extracted to the c: drive to make simple for you

cd C:\rootkernel_v5.23_Windows_Linux_UNOFFICIAL_2.5_OREO

Then run this code

rootkernel kernel.elf boot.img

TWRP asking for decryption code / Internal Storage showing 32GB only for XZ DUAL

Turn off the phone (from TWRP if you can or hold vol up and power button till the phone vibrates 3 times)

Enter Fastboot and format user data partitions using this code

fastboot format userdata

If you are getting error try from TWRP recovery > WIPE > Swipe to format data

Now start your phone and set it up the issue should be resolved.

If still storage is not showing correctly

- Do steps 1-2-3 exactly as listed above

- Boot your phone and compelete the setup wizard, go to settigns and check if storage is not 64gb

- If yes turn off the device and enter TWRP and choose WIPE > Swipe to format data

- Boot your phone again and compelete the setup wizard, go to settings and check if storage it should be 64gb by now

- Now go back to TWRP and complete steps 4-5-6

To check drm keys type *#*#7378423#*#* on your phone and go to Service Test > Security

If you have all [Key OK] they are OK! like the pictures I attached below

Extras (Recommended)

- LXT (Battery Life | Speed Tweaks)

- [MOD][THERMAL FIX] FSC™ 4.0 Improve performance & Eliminate heat

- [XZ/XZs/XP]V1 Dontbelive XPERIA XZ1 StereoMOD

- [Magisk][Module] SELinux Manager by Jman420 (Set to permissive)

- [Magisk][Module] Unified Hosts Adblocker

- [Magisk][Module] Youtube Vanced [Official]

Must have apps

- Gboard - the Google Keyboard

- Brevent

- Kiwi Browser - Fast & Quiet

Credits

@serjar for unofficial rootkernel update

Old DRM restore by @tobias.waldvogel

Magisk by @topjohnwu

SafetyNet Cleaner by @sceryavuz

TWRP by TeamWin