This link can be useful as well. https://forum.xda-developers.com/cro...ackup-t3514236
The TA partition is where the DRM key is stored. When the bootloader is unlocked, the DRM keys are being wiped and therefore are lost forever. With the procedure mentioned above we can safely have a backup of the DRM keys, therefore being able to restore the Xperia to its 'like new' conditions in case of warranty repairs.

It is therefore important to backup the TA partition and DRM keys BEFORE unlocking bootloader first time.

The above procedure is based on an exploit present on Android < 7.0, corrected with the Nougat version. Therefore, if your device is shipped with Nougat pre-installed it takes a bit more time since you need to downgrade the phone first to a previous Android version.
I already did it with mine and I can confirm the procedure works.

Last edited by jurop88; 2017-08-14 at 09:26.
Reason: to highlight important thing

I can't get this working. Of course I'm not experienced with stuff like this. The phone came with Android 7.0.

In Windows I installed the Flash Tool (Emma), which did not connect automatically. On the Sony pages I found the X was not mentioned with a key to connect to Emma!? (https://developer.sonymobile.com/ope...ported_phones/)
(Edit: After connecting holding the volume up key some extra drivers were installed. Then Emma did connect when plugging the USB in while holding the volume down key. Need to unlock first.)

Then I found that the bootloader needs to be unlocked first. (OK, why not, never mind backing up the TA partition an DRM keys now.)

I decided to get my unlock key anyway. The description says to install the Android SDK, but only the command tools at the bottom. Fine, but this is only a zip file. The Extras folder where I should update a driver is not there, it's probably necessary to install the entire SDK...

I rest my case for now, I'll just wait for a more convenient tool from SailfishOS...

Then I found that the bootloader needs to be unlocked first. (OK, why not, never mind backing up the TA partition an DRM keys now.)

I decided to get my unlock key anyway. The description says to install the Android SDK, but only the command tools at the bottom. Fine, but this is only a zip file. The Extras folder where I should update a driver is not there, it's probably necessary to install the entire SDK...

I rest my case for now, I'll just wait for a more convenient tool from SailfishOS...

Don't unlock your bootloader before you make the DRM key backup! That's why you have to downgrade and execute the script to backup it, before you unlock... Because if you unlock your bootloader, you will lose your DRM key

Just wanted to reiterate if you are wanting to backup DRM partition and unlock the xperia x, the post above (and the dirty cow post it links to) are pretty good, and worked for someone like me who is still novice in these areas. The DRM image was successfully created.

My curent noob question is now that i have my DRM img successfully backed up, i'm not sure from those threads how to actually restore it back to stock if i wanted to (i have only unlocked, not rooted).

Do you just copy the TA/DRM backup img file to phone and use twrp to flash it, or are you supposed to connect the phone to computer and boot into fastboot mode where you run adb commands from the pc? Have been searching but not found any explicit examples, just mentions of 'flash with the drm img back to stock'.