WARNING: I'm not responsible for any damage to your device. Backup your data, do this at your own risk.
1. Download new firmware for your phone following the steps from this section: https://harrytang.xyz/blog/download-xperia-firmware-flashtool
2. Open the downloaded .ftf firmware using a zip application (7z, WinZip) and extract kernel.sin
.
3. Run Flashtool, open Tools -> SIN Editor, select extracted kernel.sin
from step 2 then click Extract data, you will end up with kernel.elf
.
4. Download rootkernel (v5.20) and extract it (credit to tobias.waldvogel).
5. Go to the extracted rootkernel folder, create boot.img
by running this command:
rootkernel kernel.elf boot.img
You will see the output like below:
- Unpacking kernel
Found elf boot image
Kernel version: 3.10.84-perf-gda8446f
Found appended DTB
- Detected vendor: somc (Sony), device: ivy (Xperia Z3+/Z4), variant: dsds
- Unpacking initramfs
- Detected platform: 64-bit
- Detected Android version: 7.0
- dm-verity is enabled. Disable? (Say yes if you modify /system) [Y/n] Y
Disabling dm-verity
- Sony RIC is enabled. Disable? [Y/n] Y
Disabling Sony RIC
- Install TWRP recovery? [Y/n] Y
Installing TWRP
Compressing TWRP image
- Found SuperSU-v2.79-201612051815.zip. Install? [Y/n] Y
Adding service entry for SuperSU
- Install DRM fix? [Y/n] Y
- Install busybox? [Y/n] Y
- Creating new initramfs
- Creating boot image
- Cleaning up
Done
6. Flash the download .ftf firmware using Flashtool, ensure that no option in the “Wipe” pane is ticked:
7. Enter fastboot mode (Poweroff, hold volume up and insert USB cable) to flash the boot.img
from step 5:
fastboot flash boot boot.img
Reboot your phone and enejoy new software without losing root :)