Though all the instructions are updated, you may want
to read through all comments.
For Oreo (both models), patch this after flashing custom kernel
in the recovery BEFORE booting into system.
Before start you need to install USB driver (for Windows). If it's not working, try using Androxyde's driver instead.
To flash stock image (not required, just for newer firmware or fingerprint support)
1. Download latest Flashtool. *make sure you patch x10flasher.jar to latest version by replacing it in your installation directory (mine was 0.9.23.2).
3. Extract the file to "C:\Users\<username>\.flashTool\devices\G82XX" .
4. Launch Flashtool, select Devices > Manage > Import. It should say "Loaded 95 devices" (before is 94).
2. Thanks to Androxyde, device list now includes G82XX on github so skip those steps.
3. Click Xperifirm icon (XF rightmost icon below toolbar), find and download firmware.
4. Tools > Bundle > Create. Select your firmware, choose all content then Create . If it says "a fsc script is found..." click Yes. (I tried choosing no and I cannot flash system partition (system.sin finished with errors).
5. Start devices in flash mode (hold vol. down and connect USB until LED blinking green).
6. Click Flash icon (first one) in Flashmode, select all content from bundle you created then Flash. Again, if it ask to use .fsc script, click Yes. It should finish without error.
7. Done, you can try booting to test if it works.
Starting from locked bootloader
1. Check "OEM unlocking" under developer options.
2. Unlock bootloader - follow instruction from this link. *Select Xperia XZ, it requires same unlock code as XZs. ** Data including internal storage will be wiped like typical Sony unlocking. Make sure you do
3. Enter fastboot - press vol. up the moment you connect USB. LED should be blue light.
4.1 Flash kernel with DRM patch *the kernel is specific to firmware version (not customizations) , so it will bootloop if you flash the wrong version.
41.2.A.4.35 dual sim
4.2 Flash TWRP (XZ still work perfectly) as recovery.
For new people, you can use Minimal ADB and Fastboot. Do "fastboot flash recovery <twrp_name>.img" and "fastboot flash boot <kernel_name>.img".
5. Once you installed recovery, give it a try. Enter recovery by holding power and vol. down when the phone is off (no LED).
6. Root your phone - Transfer SU flashable zip (only systemless for now, either Magisk with sony fix or SuperSU) to anywhere in the phone (MTP in recovery, OTG, external, or just boot up and download)
7. Install zip in recovery. If you can't mount internal and install SU, doing factory reset (format data) will remove encryption and do the trick. Magisk might work with encrypted data*see note below about magisk installation
(September 15 2017) To install Xposed
Don't install it with TWRP. Just install the module in Magisk Manager and you'll be fine.
(August 20, 2017) To disable force data encryption
I think I passed safety net by install magisk inside /data (with patched kernel).
Take a look at my thread. I also wrote how to modify it, so you can just download .img or do it yourself.
(July 31, 2017) To fix the green camera & other rooting problems on any firmware version ie. To use rootkernel tool (thanks tobias.waldvogel) to patch drm/ric fix.
Follow instruction from his thread.
- Download zip in the attactments and extract.
- Extract kernel.sin (using any archive manager eg. 7zip winrar) from your .ftf firmware.
- In Flashtool, use tool -> sin editor and extract your kernel.sin into .elf.
- Move your kernel image.elf in the same directory you just extracted.
- (Windows) Shift + right click -> open command windows here in the extracted directory and run "rootkernel <extracted elf> boot.img" (Linux) Just use terminal, cd to that directory and do the same.
- Select Y for everything except busybox.
- Done! you got patched kernel image.
(July 11, 2017) To make it compatible with magisk 13+
- Use the kernel with both DRM and RIC Protection patches so that it works well with magisk 13.1 and gets working camera.
Make sure you uninstall old version using uninstaller through TWRP or flash fresh kernel, wipe cache, install new one, then install latest magisk manager because it was made only for newer version.
If you have question or something goes wrong, feel free to ask me or other nice guys on XDA!
Thanks for everyone who contributes these contents.