[Sony Xperia X Guides, News, & Discussion] FoxTheLegend:
[UPDATE]: USE THIS ONLY FOR NOUGAT 7 OR 7.1! THERE IS A DIFFERENT GUIDE FOR ANDROID OREO!

https://xdaforums.com/xperia-x/how-to/root-xperia-x-f5122-android-n-34-2-2-47-t3594502 (Written by YasuHamed, not me!)

If you are not interested in android Oreo, or you want to go back to Nougat, this guide is still valid! :) [End of Update]

This is a guide for newbies or for people that are simply confused. If you have any questions, you can always ask me, and I will reply. but please make sure you haven't made mistakes and do not ask about things that are already stated here. Let's go!

BEFORE DOING ANYTHING, NOTES

-make sure you have installed ADB : https://xdaforums.com/showthread.php?t=2588979

-make sure ADB can read your phone with the correct drivers installed. If you have trouble with that, read "DRIVERS" section

!It is absolutely necessary to install the drivers correctly!

-Backup your stuff if you have any, you will need to delete everything from the phone

-Enable USB debugging

-Note: some of these instructions apply to

Windows OS only!

-Note: links to downloads have been shortcutted as much possible to make it easier for you!

-Find some stock roms here! https://xdaforums.com/xperia-x/how-to/sonyx-f5121-downgrade-8-0-0-to-7-1-1-to-t3754986

(Credit: HEKER510)

-Warning: you will lose your warranty!

-I am not responsible for any damage done to your device.

BACKUP DRM KEYS (OR WORKAROUND)

You may want to unlock your bootloader. If you unlock it without backing up the DRM keys, you will lose them. I did that mistake and I regret it.

If you already did, there is an alternative solution, skip to step 8.

1) If you are running android 7 nougat, you will need to downgrade to MM.

If you are running MM, skip to step 7.

2) You will need to wipe everything before rolling back, so if you have any data back it up

3) Download any stock MM 6.0.1 firmware for the xperia X. You can find one here : https://mega.nz/#!1xRj2CYS Decryption key: !qBVi7yky8AL84eUF3bpTTGQ2YmN0ePCjc-eSDZGIZCI

Watch out: if you have the dual SIM model, F5122, you need to download accordingly!

For more firmwares, check "BEFORE DOING ANYTHING"

4) Download the latest flashtool: http://www.flashtool.net/downloads.php

Upon installation, tick on fastboot, flashmode drivers! If it didn't ask you, go to the installation folder and run Flashtool-drivers.exe. Please read "DRIVERS" section!

5) Flash the .tft file

6)If your phone bootloops, try flashing again or a different firmware and make sure you followed the steps correctly.

7) Once your phone successfully boots android MM, use Dirtycow to get your DRM keys out: https://xdaforums.com/crossdevice-dev/sony/universal-dirtycow-based-ta-backup-t3514236

8) If you unlocked the bootloader before backing up your keys, you can use DRM kernel fix. You can get it here: https://xdaforums.com/xperia-x/development/kernel-drm-fix-nougat-t3530849 Before using it check out the custom rom that includes this fix and other things.

UNLOCK BOOTLOADER

This is relatively easy and you can follow official sony instructions to do it.

1) Go to your phone settings, developer options, and enable OEM unlock

2) If you haven't already , install ADB fastboot and configure drivers (Link on top )

3) Follow the steps on the Sony website to get your unlock code: https://developer.sonymobile.com/unlockbootloader/email-verification/

4) After unlocking, a warning message on boot is

normal

!

INSTALL RECOVERY

Installing TWRP on your xperia X is very important, since you can flash zips and img files so easily, plus wipe, backup and other features.

1) Download the TWRP .img file: https://androidfilehost.com/?w=files&flid=197369 (Credit: eagleeyetom )

2) Make sure you have USB debugging enabled

3) Open your downloaded twrp folder

4) Run CMD in that folder (shift + right click inside the folder, Open CMD here )

5) Connect your Xperia X to your PC

6) Type these lines:

adb reboot bootloader

fastboot flash recovery recovery.img [where recovery.img is your twrp file name]

fastboot reboot

7) If no errors, twrp is now installed. Once your phone boots , turn it off,. To access TWRP recovery hold power button and volume down button until the TWRP menu appears.

STOCK ROM, ROOT

If you just want to root and not interested in additional features and tweaks, you can simply flash SU through TWRP to get your phone rooted.

Note: Current best stock ROM available: 7.1.1 (252) - better features than older ver, and good battery life.

0) Install your desired stock firmware using the

exact same previous instructions,

(under DRM section) with flashtool.

1) Download SuperSu

Or magisk, using YasuHamed guide mentioned on top, but I have not tested with anything other than Oreo 8.0

Use magisk if you want more stability / root features (like hide root from apps, modules )

2) copy it anywhere on your phone

3) Run TWRP

4) Tap on install

4) Flash the file

5) Reboot, you are now rooted

6) Insert your DRM keys if you have them

Custom ROMS

After unlocking the bootloader and installing TWRP this is the best way to go in order to get full root, tweaks.

https://xdaforums.com/xperia-x/development/rom-xperia-x-pexorom-v1-0-0-f5122-f5121-t3590552

^ This is a very good custom ROM made by prmk74. You can see its features in his thread.

1) Download the rom and copy it to your phone

2) Run TWRP

note: It is recommended to wipe dalvik, cache, data ( your storage partition doesn't need to be wiped)

3) Tap install, find your downloaded file and execute

note: It is recommended to wipe dalvik, cache, data ( your storage partition doesn't need to be wiped)

4) Follow on-screen instructions, do not stop the booting after finishing the installation, it will take some time

5) Insert your DRM keys if you have them

6) For those who lost their keys: Now the functions like vivid image mode are working properly.

DRIVERS

For Windows 8/8.1/10 users, how to solve driver problems:

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

– 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. Go to the flashtool install location and run the drivers.exe again, check fastboot and flashmode

– 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 CONCLUDE:

This is what you may want to do to get the most out of your new xperia x:

1) Backup DRM

2) Unlock BL

3) Install TWRP

4) Flash Persian (or a different rom) through TWRP (And subscribe to the thread so you receive updates)

5) Restore DRM

Notes:

None of the links, tools are of my work, I'm just writing a guide for my fellow XX owners :D:D:D