Backing up of Trim Area - Sony Xperia XZ2 Compact Questions & Answers

I want to unlock my bootloader and install lineage OS, but first I would like to back up my DRM keys, but I don't know how to go about it, I would appreciate anyone who can tell how to do it

shezy14 said:
I want to unlock my bootloader and install lineage OS, but first I would like to back up my DRM keys, but I don't know how to go about it, I would appreciate anyone who can tell how to do it
Click to expand...
Click to collapse
I've backed up the TA partition on two XZ2 Compact H8324 phones successfully in order to preserve the DRM keys. But as far as I know, there hasn't yet been a way figured out to restore a TA partition. I followed this guide by Andrés Gómez https://blog.andresgomez.org/2020/0...u-linux-1-5-downgrading-sonys-stock-firmware/

Related

Ideas for Exploiting the Bootloader

I believe that with some work, the bootloaders could be exploited.
After reading this blog, Dan has managed to either bypass or unlock bootloaders based on the Qualacom chipset.
Motorola http://blog.azimuthsecurity.com/2013/04/unlocking-motorola-bootloader.html APQ
Samsung Galaxy S4 http://blog.azimuthsecurity.com/2013/05/exploiting-samsung-galaxy-s4-secure-boot.html
I'm thinking something along the lines of how the S4 was exploited for the reasons to preserve the DRM keys for Sony related application compatibility and to keep the Bravia Engine dynamic contrast algorithm intact. Since even unlocking it the official way removes these features.
Hopefully we can get a discussion going to get more developers to try and take a look at this.
MarlowXim said:
I believe that with some work, the bootloaders could be exploited.
After reading this blog, Dan has managed to either bypass or unlock bootloaders based on the Qualacom chipset.
Motorola http://blog.azimuthsecurity.com/2013/04/unlocking-motorola-bootloader.html APQ
Samsung Galaxy S4 http://blog.azimuthsecurity.com/2013/05/exploiting-samsung-galaxy-s4-secure-boot.html
I'm thinking something along the lines of how the S4 was exploited for the reasons to preserve the DRM keys for Sony related application compatibility and to keep the Bravia Engine dynamic contrast algorithm intact. Since even unlocking it the official way removes these features.
Hopefully we can get a discussion going to get more developers to try and take a look at this.
Click to expand...
Click to collapse
you are aware you can root and back up your drm keys right....
jug6ernaut said:
you are aware you can root and back up your drm keys right....
Click to expand...
Click to collapse
From what I understand once you restore your DRM keys from your backed up TA partition. It effectively relocks your bootloader thus your custom rom or kernel that isn't signed will not boot.
Checking at the FAQ of the Backup TA partition confirms this.
DevShaft said:
Q: Can I restore my TA while running a non-stock ROM or kernel?
A: Yes, but it will soft-brick your device and you need Sony PC Companion to fix it by flashing stock firmware. Best is to first return to a complete stock ROM and kernel before restoring the TA.
Q: Will it bring my DRM keys back on a non-stock ROM or kernel?
A: No, only on a complete stock ROM and kernel.
Click to expand...
Click to collapse
MarlowXim said:
From what I understand once you restore your DRM keys from your backed up TA partition. It effectively relocks your bootloader thus your custom rom or kernel that isn't signed will not boot.
Checking at the FAQ of the Backup TA partition confirms this.
Click to expand...
Click to collapse
Well that effectively rules out simply restoring the DRM keys. Looks like its time for Plan B.

Noob question for TA backups and Root

Sorry if this is a dumb question. Can someone please explain what it means that Bravia in Album will no longer work if I unlock the bootloader? I've been reading through many resources and have seen some old and new reports that either make no sense or contradict one another. This is my first Sony device so I'm not used to having to backup a TA partition or anything like that. My goal is to have a fully functional rooted stock firmware. I'm mainly sticking with stock to preserve the camera app since I will use it the most. From the sound of it, It seems like I'll be breaking something by rooting my device. Is this the case? If so, what gets broken and is there a way to root the stock firmware otherwise?
Xentar712 said:
Sorry if this is a dumb question. Can someone please explain what it means that Bravia in Album will no longer work if I unlock the bootloader? I've been reading through many resources and have seen some old and new reports that either make no sense or contradict one another. This is my first Sony device so I'm not used to having to backup a TA partition or anything like that. My goal is to have a fully functional rooted stock firmware. I'm mainly sticking with stock to preserve the camera app since I will use it the most. From the sound of it, It seems like I'll be breaking something by rooting my device. Is this the case? If so, what gets broken and is there a way to root the stock firmware otherwise?
Click to expand...
Click to collapse
Rooting doesn't require unlocking bootloader. Unlocking bootloader is when you will need to start worrying about TA and DRM and such. Just root using this method and you won't need to worry about backing up TA first: http://forum.xda-developers.com/showthread.php?t=2784900
camaro is right, as long as the root exploit works (i.e. as long as the upstream aosp kernel bugfix isn't merged) an unlocked bootloader is only required to flash a different kernel.
Thanks guys, every thing worked great
camaro322hp said:
Rooting doesn't require unlocking bootloader. Unlocking bootloader is when you will need to start worrying about TA and DRM and such. Just root using this method and you won't need to worry about backing up TA first: http://forum.xda-developers.com/showthread.php?t=2784900
Click to expand...
Click to collapse
So I'm probably going to go the next step and unlock the bootloader soon. I'll do a TA backup before, for sure. Does unlocking the bootloader break any of the apps or services?
Xentar712 said:
So I'm probably going to go the next step and unlock the bootloader soon. I'll do a TA backup before, for sure. Does unlocking the bootloader break any of the apps or services?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=2745704
Sent from my D5503
camaro322hp said:
http://forum.xda-developers.com/showthread.php?t=2745704
Sent from my D5503
Click to expand...
Click to collapse
Cool, thanks! So basically just the X-reality(Bravia engine) will be gone. Not sure if I need that so maybe I'll take a spin with it off for a few days and see if I like it still. I read somewhere that Netflix was broken from it but that report was old so I'm guessing it's fixed now.
Xentar712 said:
Cool, thanks! So basically just the X-reality(Bravia engine) will be gone. Not sure if I need that so maybe I'll take a spin with it off for a few days and see if I like it still. I read somewhere that Netflix was broken from it but that report was old so I'm guessing it's fixed now.
Click to expand...
Click to collapse
You may want to resurrect that old thread to see if anyone else has input. I never unlocked bootloader as the stock ROM rooted was sufficient for me, so I can't say for sure what gets lost.
Sent from my D5503

[Q] Root/Unlock bootloader discussion

Hello everyone,
I am new to android family, as recently i bought an Xperia M, now i would like to ask a few questions and please bear with me since my English are not good enough.
My first objective was to immediately wipe that xperia OS and change it to stock like experience. [the closest i could find is CM11],
so after some searching i found out that in order to do that, i had to unlock the bootloader. But since the phone is new i also would like to not loose warranty, so i read i had to backup TA partitions Before even unlocking the bootloader, but in order to do this i have to root using an exploit. So please enlighten me:
1] wich rooting program should i use since i read many complains on many rooting programs
2]witch program should i use to backup the firmware before taking action [i do not care about photos and contacts]
3]if something goes wrong where do i download the official firmware of my divice to restore it back to normal? [similar to itunes that no matter what happens it restores your device back to normal]
(*) another question: after i root my phone and backup TA partitions, next step should be to unlock my bootloader [that means i only need to install a superuser.apk to gain root access again, right?] or just flash the cm11 and gapps and not worry about rooting?
Thanks in advance guys!
Querd said:
Hello everyone,
I am new to android family, as recently i bought an Xperia M, now i would like to ask a few questions and please bear with me since my English are not good enough.
My first objective was to immediately wipe that xperia OS and change it to stock like experience. [the closest i could find is CM11],
so after some searching i found out that in order to do that, i had to unlock the bootloader. But since the phone is new i also would like to not loose warranty, so i read i had to backup TA partitions Before even unlocking the bootloader, but in order to do this i have to root using an exploit. So please enlighten me:
1] wich rooting program should i use since i read many complains on many rooting programs
2]witch program should i use to backup the firmware before taking action [i do not care about photos and contacts]
3]if something goes wrong where do i download the official firmware of my divice to restore it back to normal? [similar to itunes that no matter what happens it restores your device back to normal]
(*) another question: after i root my phone and backup TA partitions, next step should be to unlock my bootloader [that means i only need to install a superuser.apk to gain root access again, right?] or just flash the cm11 and gapps and not worry about rooting?
Thanks in advance guys!
Click to expand...
Click to collapse
ok, first of all you need to unlock your bootloader first, check in here http://forum.xda-developers.com/showpost.php?p=46489205&postcount=1, after unlock bootloader and second if you want try to root and install custom recovery you can find in here http://forum.xda-developers.com/showpost.php?p=51414331&postcount=1, this will install cwm recovery on your phone so you can access recovery mode on your phone that you can do backup for your current rom, and for stock rom you can find in here http://forum.xda-developers.com/showpost.php?p=53315273&postcount=1. ok have fun with android ok
Nicklas Van Dam said:
ok, first of all you need to unlock your bootloader first, check in here http://forum.xda-developers.com/showpost.php?p=46489205&postcount=1, after unlock bootloader and second if you want try to root and install custom recovery you can find in here http://forum.xda-developers.com/showpost.php?p=51414331&postcount=1, this will install cwm recovery on your phone so you can access recovery mode on your phone that you can do backup for your current rom, and for stock rom you can find in here http://forum.xda-developers.com/showpost.php?p=53315273&postcount=1. ok have fun with android ok
Click to expand...
Click to collapse
thanks a lot my friend, but the main question has not been answered yet. before unlocking the bootloader i need to backup TA partition so i won't lose warranty, But in order to backup them i need root first! so i still dont know witch program of rooting should i trust because i have no experience. in other words i need to root using an exploit before actually unlock bootloader and root again
Querd said:
thanks a lot my friend, but the main question has not been answered yet. before unlocking the bootloader i need to backup TA partition so i won't lose warranty, But in order to backup them i need root first! so i still dont know witch program of rooting should i trust because i have no experience. in other words i need to root using an exploit before actually unlock bootloader and root again
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?p=53565495, here you are Bro, try to find root in locked bootloader condition bro
hello again, i still got a problem, i try to install fastboot drivers for my xperia m device, and even though the installation finish with success, my computer does not recognize the device properly, [on device manager its yellow] btw i use windows xp

Help with stock restore

Hi all,
Appreciate this may have been asked several times in different ways. However, I've got in over my head with this one so want to make sure the method is right for how I initially rooted my phone.
Essentially I followed the cyanogenmod wiki page which showed me how to unlock the bootloader and install cyanogenmod.
However, I now need to revert back to stock. Problem i'm having is that any guide I find talks about TA back ups (not mentioned in the original guide) and uses a tool called flashtool.
I used the flashboot method for my install so i'm just a bit confused as to how to go back. Is it true that Sony will be able to tell I modified it as I may need to return it for a warranty issue.
Useful info:
UK phone
Not locked to a network
Many thanks
They will if you didn't backup your DRM keys and are unable to restore them after relocking your bootloader
Ahh thats really irritating that their main guide mentions nothing about DRM then.
What am I likely to have lost in terms of losing that partition then? Will I definitely have lost it doing it via fastboot? It seems strange that they don't mention anything about that.
What does it mean by a DRM key anyway? is it a code for something or an actual bit of software?
How would I go about getting it back to stock?
Many thanks
You can back to stock without DRM keys but... Still you will don't have things like bionz and x reality if you don't have backup DRM keys you are screwd because you lost it forever you can't use DRM keys from other z1c
mosespl said:
You can back to stock without DRM keys but... Still you will don't have things like bionz and x reality if you don't have backup DRM keys you are screwd because you lost it forever you can't use DRM keys from other z1c
Click to expand...
Click to collapse
Thanks mosespl.
What is the best method of going back to stock when originally I used flashboot? Looking to relock the bootloader too.
The sony stuff was rubbish anyway, I got nothing but bug bug bug with it, its the main reason I rooted. What is a DRM key? I saved a code that I needed to unlock but i'm guessing that isn't it?
DRM keys are write on specific partition on your phone which is unvisible and once you unlock your bootloader without backup DRM keys you lost it. And if you relock your bootloader you won't be able to use bionz processor (photos in bad condition will be worst) and x reality. In cross device section in thread for stock Roms to revert this options but I don't know if its working you need to check. But in many thread was posted that before unlock bootloader everyone have to back up DRM keys I don't know what about good program to unlock or relock bootloader but everyone uses flashtool I think
This is the thread that mosespl is referring to. It's quite lengthy but might be worth reading and trying. You've nothing to lose I suppose (as you've already lost them).
http://forum.xda-developers.com/showthread.php?p=56541777
Thanks guys, i'll check it out.
I wish I had that guide in the first place! Can't believe such a big rom didn't even hint at it!

Tips before flashing XZ1c

Hi,
I should receive my XZ1c this week. Before unlocking bootloader, flashing recovery and ROM, should I perform a system dump/backup? I heard that flashing may cause lost of DRM keys, so also other stuff may also be lost.
If I have to do a backup, which tool should I use? I also read that after flashing the camera takes green pictures, is that common to all non official ROMs?
Thanks!
fl0wfr said:
Hi,
I should receive my XZ1c this week. Before unlocking bootloader, flashing recovery and ROM, should I perform a system dump/backup? I heard that flashing may cause lost of DRM keys, so also other stuff may also be lost.
If I have to do a backup, which tool should I use? I also read that after flashing the camera takes green pictures, is that common to all non official ROMs?
Thanks!
Click to expand...
Click to collapse
I wouldn't be in a rush to unlock your phone, it comes with all sorts of problems, but the biggest one being breaking the camera.
If you have a contract phone from a major provider there's a chance that you won't be able to unlock it, the unlock feature will be disabled. This is so they don't have to deal with any warranty claims of 'Waaaa, I unlocked my phone and now it's broken'
The battery life out the box is pretty amazing and customisation can be done without root, these were always the main things that drove me to root in the past, so it's not as necessary as it used to be. You can't do a backup of your DRM keys, when you unlock the phone they will be lost and are unrecoverable. With persistance you can mount a DRMfix, that fools the phone into thinking DRM is present and all the higher functions contiune to work as stock. But you can no longer easily update, you will have to reflash everything each time there is a system update. I have rooted my phone and everything works perfectly, but I sort of wish I hadn't now as the benifits are small and the hassle of keeping it up to date with firmware rollouts is huge, in fact I've given up.
If you are determined to go down that route I would recomend paying sToRm// $20 for his Xperiafix. It's the simplest way to do it and his version 3 has come along leaps and bounds from the early versions and as long as you get the right drivers (err, no easy task) and can follow instructions, you'll get there.
For backing up what's on your phone I'd recomend Xperia Transfer, does what is says on the tin.
Unfortunately, there isn't a way to backup the DRM keys yet so should you unlock the bootloader, your DRM keys are completely and irreversibly gone forever.
As for the camera issue, when unlocked, you can either continue to use the Sony ROMs but with a DRM fix (e.g. using Storm's Xperifix tool) or you can use a custom ROM which has a DRM fix. Long story short: whatever ROM you use (official or unofficial), you'll need to make sure you have a DRM fix for it.
Edit: Nevermind, Didgesteve beat me to it!
Thanks for your replies guys!
I bought the phone without contract so no SIMlock
If I flashing back stock ROM I wouldn't be able to get DRM keys back, right? The fact is I love RR-OS ROM, so easy to customize, and I'd like to easily restore my apps with Titanium Backup.
The only reason why I personally would root nowadays is Titanium Backup.
fl0wfr said:
Thanks for your replies guys!
I bought the phone without contract so no SIMlock
If I flashing back stock ROM I wouldn't be able to get DRM keys back, right? The fact is I love RR-OS ROM, so easy to customize, and I'd like to easily restore my apps with Titanium Backup.
Click to expand...
Click to collapse
Unfortunately, that's correct - going back to stock won't restore the DRM keys. Once they're gone, they're gone forever.
fl0wfr said:
Thanks for your replies guys!
I bought the phone without contract so no SIMlock
If I flashing back stock ROM I wouldn't be able to get DRM keys back, right? The fact is I love RR-OS ROM, so easy to customize, and I'd like to easily restore my apps with Titanium Backup.
Click to expand...
Click to collapse
DRM keys gone forever, yup.
Titamium will work on magisk rooted phone, but you might struggle to get some of the apps working on a new OS.
You'll be in for less headaches if you can bite the bullet annd do a clean install.
But you're in good hands with russel5's RR build, he's really helpfull and takes part in the thread.
If I root using Magisk, will I have to unlock bootloader?
fl0wfr said:
If I root using Magisk, will I have to unlock bootloader?
Click to expand...
Click to collapse
Yes - you'll have to unlock the bootloader because in order for Magisk to work because it modifies your phone's boot partition (and it can only really do that if you unlock your phone's bootloader).
moofesr said:
Yes - you'll have to unlock the bootloader because in order for Magisk to work because it modifies your phone's boot partition (and it can only really do that if you unlock your phone's bootloader).
Click to expand...
Click to collapse
Okay but I won't have to flash ROM or install another bootloader?
fl0wfr said:
Okay but I won't have to flash ROM or install another bootloader?
Click to expand...
Click to collapse
You don't have to flash another ROM - in fact, you can stay on the stock Sony ROM if you prefer. But you'll want to flash something (DRM fix) because the moment you unlock your bootloader, your camera will stop working.
For what it's worth, you can't install another bootloader.
moofesr said:
You don't have to flash another ROM - in fact, you can stay on the stock Sony ROM if you prefer. But you'll want to flash something (DRM fix) because the moment you unlock your bootloader, your camera will stop working.
For what it's worth, you can't install another bootloader.
Click to expand...
Click to collapse
Damn... The camera issue always happens when unlocking bootloader?
fl0wfr said:
Damn... The camera issue always happens when unlocking bootloader?
Click to expand...
Click to collapse
I'm afraid so! Sony are simultaneously very open-source friendly and very dev-community hostile.
That's why the DRM keys are such a big deal for Sony devices and why everyone talks about DRM fixes
The camera on the XZ1C uses some proprietary elements and the moment you unlock your bootloader, the proprietary elements stop working and every photo you take will just be green.
In an ideal world, we would backup the DRM keys before unlocking the bootloader and then restore the DRM keys after unlocking the bootloader and the camera (and other DRM key dependent phone features) would be working as usual again. However, the 2017 line of devices has no working method of DRM backup-restore, hence the need for DRMfix to 'trick' the phone into thinking the DRM keys still exist.
Well I guess I'll stick to the stock ROM. I'll try at least SMS/MMS restore using Titanium, I hope it won't need root...
Thanks for your replies, I really appreciate it!
fl0wfr said:
Well I guess I'll stick to the stock ROM. I'll try at least SMS/MMS restore using Titanium, I hope it won't need root...
Thanks for your replies, I really appreciate it!
Click to expand...
Click to collapse
Xperia transfer is an easy way to transfer texts, files and programs (and settings)
Didgesteve said:
Xperia transfer is an easy way to transfer texts, files and programs (and settings)
Click to expand...
Click to collapse
Interesting, I'll give a try!
Didgesteve said:
... You can't do a backup of your DRM keys, when you unlock the phone they will be lost and are unrecoverable....
Click to expand...
Click to collapse
Your post is from July 2018, while since May 2018 there is a topic regarding XZ1C DRM keys backup & restore here on XDA:
https://forum.xda-developers.com/xperia-xz1-compact/development/devonly-exploits-temp-root-to-backup-t3795510
Or do I miss something I haven't gone through all the 40+ pages of the topic above yet, but it looks like a proper backup&restore solution, not a drmfix only that fools the system.
Doman said:
Your post is from July 2018, while since May 2018 there is a topic regarding XZ1C DRM keys backup & restore here on XDA:
https://forum.xda-developers.com/xperia-xz1-compact/development/devonly-exploits-temp-root-to-backup-t3795510
Or do I miss something I haven't gone through all the 40+ pages of the topic above yet, but it looks like a proper backup&restore solution, not a drmfix only that fools the system.
Click to expand...
Click to collapse
The exploit thread has indeed been going since May, but when I wrote the post in July there was still no easily accessible way for the average user to attempt the exploit.
Have you tried to back up your DRM keys with the exploit? Good luck with that.
But with Pie we don't need any exploit, the camera is fixed without any DRM manipulation.
Didgesteve said:
The exploit thread has indeed been going since May, but when I wrote the post in July there was still no easily accessible way for the average user to attempt the exploit.
Have you tried to back up your DRM keys with the exploit? Good luck with that.
But with Pie we don't need any exploit, the camera is fixed without any DRM manipulation.
Click to expand...
Click to collapse
Appreciate the explanation. I haven't done DRM backup yet. I just got my XZ1C this week, so now I gain the knowledge and prepare for modifications. I wonder if I need the DRM backup for the future though, as I plan to use Resurrection Remix or AEX, either dedicated or Treble version. But I think I will try to back it up anyway just in case.
And what do you mean about Pie in the last sentence? With Pie and bootloader unlock we still loose TA partition and DRM, but the camera still works fine? Or what happens?
Doman said:
With Pie and bootloader unlock we still loose TA partition and DRM, but the camera still works fine? Or what happens?
Click to expand...
Click to collapse
With Pie the camera works with unlocked bootloader, no fix required. So you can unlock and root and don't need any 'fix'
Sony obviously don't want anyone making money out of DRM (Xperiafix)

Categories

Resources