yashsingh1/xdaforums huggingface dataset:
[Xperia Z Original Android Development] shoey63:
Does it matter if bootloader is unlocked or locked prior to restore? Also, can a similar approach be used to backup/restore bootloader partition?
[Xperia Z Original Android Development] RHBH:
A guy flashed his own TA partition on a Xperia S with locked bootloader and bricked the device, seems a hard brick.
[Xperia Z Original Android Development] Egan:
At least 3 people, rickwyatt, lhurtado and myself. But I recall some other people also did a restore successfully.

---------- Post added at 05:35 PM ---------- Previous post was at 05:29 PM ----------

No, on the Xperia Z it does not matter when you restore the TA backup, since that is the only partition which changes after an unlock of the bootloader. I think you can backup/restore any partition with this method, only be sure to restore the partitions which relate to each other together or else you may hard-brick your device. Did a backup and restore of the kernel (boot partition) to switch between DoomKernel and Sony Kernel, which worked just fine. Be aware that any restore of a partition can potentially (hard)brick your device. Dont take this lightly!
[Xperia Z Original Android Development] zeroed:
I've deleted my ta partition by mistake,thought i am formatting my sd card but picked wrong device via abd shell.Stupid mistake no doubts on that.I have backup on my ta partition,but i was unable to restore it since the device wasnt been detected by my pc.Phone has warranty and i have returned it to service.I didnt tell them how i bricked it,i just stated that it cant be turned on.My question is can it be repaired,i had root plus some other mods installed,locked bootloader,didnt have the chance to return it to stock because the phone was hard bricked,no led,no charging,unable to turn on.I am hoping to get a replacement device,but the question is can they see what i have done with the device?What are my chances of getting replacement one?Thanks.
[Xperia Z Original Android Development] RHBH:
If there is a way to check TA partition files without turning on the phone (usually they would do this for check if your bootloader is locked) you're screwed. If there isn't don't worry, they will give you a new one and write something like "sudden death".

Anyway you will probably have a new one, since even if they have such method, they won't find it and for lack of knowing interpret it as "wow this device is so dead that we can't even check if it's BL is locked or unlocked".
[Xperia Z Original Android Development] shadstheman90:
Dose flashing the TA relock the booloader. ??
[Xperia Z Original Android Development] Maddhouse:
Yes
[Xperia Z Original Android Development] pjgowtham:
I ve got a doubt..Will Sony patch the bl in his next update? If that's d case we can't relock bls or it ll still be void.so its better if we backup ta partition, unlock bl, install clockworkmod and use an .zip to update our firmware ?..hwz it?

I think it ll b better if u put up firmware compatibility list on the main post.
[Xperia Z Original Android Development] Egan:
Here is my latest version of the Backup-TA tool v7 (file > download). The following things have changed:

- Check Compatibility bug fix.

- Compatible busybox check.

- More output for better support when needed.

- Overall better checks.

- Instructions how to convert v4 backup to v6+.

NOTE: This is the recommended version of Backup-TA tool to use!

My advice is to not use any other version of this tool to prevent a possible brick.
[Xperia Z Original Android Development] deadman220:
i used version 4 on my xperia s and worked fine but with this just getting this message then nothing ???

Waiting for device...* daemon not running. starting it now on port 5037 *

* daemon started successfully *

OK
[Xperia Z Original Android Development] lilstevie:
Patching up this in the current iteration of hardware is probably not a high priority for sony. It isn't really that big of a deal. unlock and drm are still mutually exclusive which is the main point.

Sony don't seem to update bootloaders in the field, AFAIK the Xperia T received an update but it was the first time they had ever done so.
[Xperia Z Original Android Development] Egan:
Delete v7 you downloaded and download it again. I fixed a minor issue just now :).
[Xperia Z Original Android Development] lee480:
What the difference in backing up via flashtool and the tool above?
[Xperia Z Original Android Development] Egan:
Not much of a difference. The backup method is equal only the backup data may be in a different format. I believe it is better to use Flashtool instead of Backup-TA tool, since the later is already obsolete. The only reason for me to maintain Backup-TA tool is because I dont want people to struggle too much or even brick their phone when they find that tool first :).
[Xperia Z Original Android Development] deadman220:
i got this

=======================================

BACKUP TA PARTITION

=======================================

4096+0 records in

4096+0 records out

2097152 bytes transferred in 0.127 secs (16513007 bytes/sec)

=======================================

GENERATE MD5 HASH OF TA PARTITION

=======================================

The system cannot find the path specified.

The system cannot find the path specified.

ECHO is off.

=======================================

GENERATE MD5 HASH OF BACKUP ON SDCARD

=======================================

The system cannot find the path specified.

The system cannot find the path specified.

ECHO is off.

=======================================

COMPARE MD5 HASHES 1/2

=======================================

=======================================

PULL BACKUP FROM SDCARD

=======================================

2745 KB/s (2097152 bytes in 0.746s)

=======================================

GENERATE MD5 HASH OF PULLED BACKUP

=======================================

=======================================

COMPARE MD5 HASHES 2/2

=======================================

MD5 hashes do not match.

*** Backup was unsuccesful. ***

Press any key to continue . . .
[Xperia Z Original Android Development] Egan:
I dont know from where you ran the tool or extracted it, but it appears the script wasnt able to create the Backup-TA\tools\tmpbak folder which is needed to save its temporary files. Try to run the script with admin rights (Left mouse click and then 'Run as administrator') :).

EDIT: I think I found your problem. It is when you run it as admin the issue arises. Let me find a solution.

EDIT2: Re-download the tool (v7), its fixed in there. When the script runs with admin rights it executes from c:\windows\system32, that caused it.
[Xperia Z Original Android Development] pjgowtham:
I'm basically from the motorola defy forums. So bootloaders are troublemakers for defy and the world knows about Motorola..
[Xperia Z Original Android Development] lee480:
Delete.
[Xperia Z Original Android Development] Osyx:
It's better to do that now, but that option didn't exist at the time of this thread and for those who did a backup with the old tool must use that to restore too, but if you haven't unlocked yet Flashtool is the best way to do it.

Edit: I see that Egan has answered your question once before :p
[Xperia Z Original Android Development] lilstevie:
bootloaders are the bane of most device hacking, Sony are the only oem that I have come across so far that don't update the bootloader with every update
[Xperia Z Original Android Development] jankhner:
how can I backup and restore TAs via flashtool?
[Xperia Z Original Android Development] Osyx:
Using latest flashtool, Advanced->Backup & Restore TA
[Xperia Z Original Android Development] RHBH:
With my Xperia S.

When I backup using the backup-ta v4 I got a file with 2048kb.

Now I backup with flashtool and the file size is 197kb.

Is this correct?
[Xperia Z Original Android Development] shinzi:
ok,i did restore my ta.img successful and my BE2 came back.

here is my setp

1,use flashtool flash a stock rom

2,unlock my phone

3,use Root_with_Restore_by_Bin4ry_v27 root my phone

4,copy busybox from backup-ta\tools to my phone

5,use rootexplorer copy busybox to data\local\tmp and set busybox's permission all ✓

6,go to settings,developer options,set usb debugging available.

7,open BACKUP-TA on your pc,2 to restore my ta.img 3 to close the app.reboot my phone.

now my BE2 came back,thank you.

sorry about my bad english.
[Xperia Z Original Android Development] mirhl:
if i'm not wrong this is due to different way those programs take the backup

backup tool use dd, so it dumps every bit of the partition, including 00 (blank and empty) sector

i think instead flashtool just copy the relevant information (and possibly it even compress them)

i hope someone more prepared than me could confirm
[Xperia Z Original Android Development] Egan:
That is not correct. The size of 2048kb of the image is correct. I do not know how you made the backup with Flashtool, but you should choose Advanced >> Trim Area >> Raw devices >> backup.
[Xperia Z Original Android Development] RHBH:
The issues persists, at least for me.

I found some references to "tmpbak" with the "/", remember that "/" is for linux and "\" is for windows.
[Xperia Z Original Android Development] Egan:
Here on Windows 7 it works just fine with '/'. What are you using for OS? When you run the tool, which version is displayed in the header of the menu?
[Xperia Z Original Android Development] RHBH:
I think I found the "solution".

I mannualy created all the TXT required for the script and the backup appears to worked.

Ps: Another bug, when I press "5" for exit, it doesn't close and sends a "beep".
[Xperia Z Original Android Development] Egan:
Glad you got it working. I will check tomorrow (utc+1) if the zip is correct. What have you done to fix it? What do you mean with 'manually created all the TXT'?

I fixed the 5 quit issue, forgot to add 5 as choice option. You can download v7.5 from the usual location (same as before).
[Xperia Z Original Android Development] RHBH:
Dude, I don't know what I did, I tried again and having the same error again, tried to check compatibility and backup again (before remove the old backup.zip from the default location).

Anyways, I created the tmpbak and all txt, like this:

EDIT:

Now I found what did the trick:

Just create the folder "tmpbak" on C:\Backup-TA

The script seems to be unable to create the "tmpbak" folder, even if I just run or run as admin the issues persists.
[Xperia Z Original Android Development] Egan:
Ahh you pre-created them. Could be a permissions issue on your system. What if you run it as administrator?
[Xperia Z Original Android Development] jankhner:
Thanks but,

I have the latest flashtool and there is no "Backup & Restore TA" on advanced menu. Only "Trim area".
[Xperia Z Original Android Development] RHBH:
EDIT:

Now I found what did the trick:

Just create the folder "tmpbak" on C:\Backup-TA

The script seems to be unable to create the "tmpbak" folder, even if I just run or run as admin the issues persists.

For now this is ok, now look remember I'm running a Xperia S, look what the script gave me when I requested a compatibility check:
[Xperia Z Original Android Development] jankhner:
and this is what i got when i tried this script:
[Xperia Z Original Android Development] RHBH:
Check the following:

Is your phone rooted?

Do you have BusyBox installed?

Is ADB insecure active?

You can download adb insecure on my dropbox or as a forum attachment

https://www.dropbox.com/s/1othv24th65qxha/adbd-Insecure-v1.1.apk
[Xperia Z Original Android Development] jankhner:
Thanks!

rooted - Yes

Busybox - Yes

Adb insecuse - No, but i installed it.

After that, still not working.

=======================================
BACKUP TA PARTITION
=======================================
4096+0 records in
4096+0 records out
2097152 bytes transferred in 0.663 secs (3163125 bytes/sec)

=======================================
GENERATE MD5 HASH OF TA PARTITION
=======================================
The system cannot find the path specified.
The system cannot find the path specified.
ECHO is off.

=======================================
GENERATE MD5 HASH OF BACKUP ON SDCARD
=======================================
The system cannot find the path specified.
The system cannot find the path specified.
ECHO is off.

=======================================
COMPARE MD5 HASHES 1/2
=======================================

=======================================
PULL BACKUP FROM SDCARD
=======================================
2334 KB/s (2097152 bytes in 0.877s)

=======================================
GENERATE MD5 HASH OF PULLED BACKUP
=======================================

=======================================
COMPARE MD5 HASHES 2/2
=======================================
MD5 hashes do not match.

=======================================
CLEAN UP
=======================================

*** Backup was unsuccesful. ***
Press any key to continue . . .
[Xperia Z Original Android Development] RHBH:
Open the tool and before choose an option create a folder named "tmpbak" (this folder must be in the same path that "backup-ta.bat" is).

The tool removes the folder when run the clear command

rmdir tmpbak

so everytime you'll run a command create the folder again.

________________

[MENTION=2613436]Egan[/MENTION]

Found the problem:

There is a missing command line in some parts on the bat

mkdir tmpbak > nul 2>&1

During the busybox part everything is ok, but then you run a command and the mkdir command is missing and the folder was deleted by a previsouly rmdir command during the busybox check, so we get "the system cannot find the specified path... blabla".
[Xperia Z Original Android Development] Mr. Droid:
I backed up my ta and unlocked I'm afraid to restore. I can't afford a brick since I'm in Canada I wouldn't be able to get it fixed
[Xperia Z Original Android Development] RHBH:
[MENTION=2613436]Egan[/MENTION]

Two suggestions:

Add a function to kill adb.exe process that still running after exiting the bat.

Upload the adb-insecure apk that I linked here (http://xdaforums.com/showpost.php?p=41343968&postcount=471) this is needed for correct detection and work of the tool.
[Xperia Z Original Android Development] Egan:
Thanks for digging so much. That rmdir tmpbak shouldn't be there and must have been the culprit indeed.

I fixed it and added the kill adb request at the end. You can re-download from the same location as before. However I can't add adbd-insecure because it's not a free app. Why do you needed?

---------- Post added at 05:33 AM ---------- Previous post was at 05:31 AM ----------

Then don't restore and keep it safe for when you really need it.
[Xperia Z Original Android Development] race4life:
[MENTION=2613436]Egan[/MENTION]. does this also fix the issue when you are comparing the backup to check if the TA backup is consistent. I have also seen that a lot of the script references to /sdcard/ . Do we have to copy the backup zip file to sdcard and extract the files ?

Sorry have read through the whole topic and couldnt find the ans anywhere..
[Xperia Z Original Android Development] jjwrongjj:
It working perfect
[Xperia Z Original Android Development] Egan:
Yes, It does check the integrity of the backup after backup and before restore. The backup is saved to Backup-TA\backup as a ZIP file. It needs to be in that place before doing a restore. You do not have to push the backup to sdcard and extract or anything like that.

---------- Post added at 08:42 AM ---------- Previous post was at 08:41 AM ----------

Good to hear.
[Xperia Z Original Android Development] Maddhouse:
Sorry if I am being stupid but where is that when I go onto your Google drive I can only see v7 which I have already downloaded not the one you have fixed or have you just replaced it and not called it v7.1
[Xperia Z Original Android Development] Egan:
Its actually 7.x, so you download from the same location as v7 only its updated (easier this way, since I have no thread of my own). You can see the version number in the header of the menu when you run the tool :).
[Xperia Z Original Android Development] jankhner:
thank you, the latest version finally worked! or atleast is says so :) not going to restore that unless i have to return the phone.
[Xperia Z Original Android Development] shoey63:
Well I have done it rickywatt way, flashtool way and now I will try this. (can't have enough TA backups). As for restoring, well I might put that on the backburner for now.....
[Xperia Z Original Android Development] arvin2212:
Planning to use another kernel so I have to unlock my phone.

Can I confirm that once I restore the TA partition, there will not be any difference between my phone and a retail model? I have not unlocked my bootloader so my DRM keys are in tact.

Basically:

1) Once I restore my TA partition and flash a stock ROM, my phone will not be different than the retail model?

2) Once I restore my TA partition, Bravia Engine for both pictures and videos will function as on a stock model ?
[Xperia Z Original Android Development] Osyx:
Yes and yes. Flash stock first, it's better that way.
[Xperia Z Original Android Development] arvin2212:
Thank you very much.

By flashing stock first, do you mean that I should flash to a stock ROM first and then do a backup of the TA partition or should I restore the TA partition only when I am on stock ROM , or both?

:)
[Xperia Z Original Android Development] Osyx:
Restore to stock before restoring TA partition ;)
[Xperia Z Original Android Development] RHBH:
It's included with the v4 of tool on the first page, when I get home I'll look at the new script and check if adbd-insecure is really needed.

Also for some people asking about flashtool, at least for me flashtool created a TA image with 197kb, while this method created a TA image with 2048kb, I'm afraid of restoring also, specially that this "trick" was initially proposed for XZ and ZL and I'm using a XS (not sure about what restore can do).
[Xperia Z Original Android Development] lilstevie:
Just remember you cannot run a custom kernel and have DRM intact at the same time

Correct, when you unlock there are a few changes made to the trim area to indicate that it is unlocked, and neuter drm.

when you restore your TA backup it will be returned to the pre-unlock state

Yes, once you restore your backup it is as if you never unlocked. All traces of the unlock are removed, but it is up to you

to restore the device to a stock state using pc companion/emma/flashtool/etc. to return to 100% stock
[Xperia Z Original Android Development] DevShaft:
This is me [MENTION=2613436]Egan[/MENTION] under my new account.

Yes, adbd-insecure is in v4 because rickwyatt put it in. I removed it since its a non-free app and I believe it isn't needed. The reason rickwyatt put it in is to push busybox, while I do not want to install something like busybox on someone's device. I would rather set busybox as a requirement and when it fails give the advice to install the latest busybox. To be honest with you, I think that people who do not know how to install busybox should not use Backup-TA anyway or unlock their bootloader all together. But maybe that's just me. So in my version at least there will be no adbd-insecure or busybox :).

The backup image itself should always be 2048kb on the Xperia Z. So when Flashtool returns an image of 197kb there is either something wrong with Flashtool (I doubt that) or it's not the raw TA backup.
[Xperia Z Original Android Development] Osyx:
Why did you change? :P
[Xperia Z Original Android Development] arvin2212:
Just to support your post. Did a TA backup via flashtool and my "ta.dd" file is at 2,048kb
[Xperia Z Original Android Development] Androxyde:
Flashtool provides 2 kind of TA backup. One using S1 protocol and one using dd command to dump partition content. 197Kb is probably the S1 mode backup. This backup does not contain the whole TA. Some crypted parts are not dump using this method.
[Xperia Z Original Android Development] DevShaft:
Because I wanted my nickname to also be my GitHub, GMail and domain name for everything community development related. Egan was already taken and DevShaft was not :).

Another positive side effect is that I became junior again. Too bad about the 'thanks' though ;).
[Xperia Z Original Android Development] Osyx:
Aha I see, yeah that makes it a lot easier for both you and the community :) haha true gave you two for a starter :P
[Xperia Z Original Android Development] DevShaft:
Thanks a lot m8! Much appreciated :)
[Xperia Z Original Android Development] arvin2212:
Guys, I did a TA backup when i was using a custom ROM. Then I did a TA backup on a stock ROM. The MD5 values are different from the Custom ROM (ROMAUR) and the stock Rom. Stock Rom was restored using sony update tool.

Will this be an issue when I plan to restore my TA partition? Say my Stock Rom is Malaysia 434 and next week 454 is released (example), can I still restore my TA partition when i am on 454 or must i revert to 434 to restore my TA partition?
[Xperia Z Original Android Development] RHBH:
The recommendation is to backup and restore when you're running stock kernel and stock rom.
[Xperia Z Original Android Development] Osyx:
Shouldn't be a problem as long as Sony doesn't update the bootloader, but better check with a more educated person about this :P
[Xperia Z Original Android Development] DevShaft:
That's correct. However Sony is not known for changing the bootloader with every update, unlike other vendors.

Still when there is a big update, there are always devs who look for the more low-level changes and tell you when the bootloader is one of these changes.
[Xperia Z Original Android Development] arvin2212:
Thank you all.

I was just afraid that since I flashed using the sony update tool, once they release a new update, I wouldn't be able to revert to the original stock rom where the TA partition was backed up. I tried making a FTF but it didn't work as it wouldn't flash.

I dug up a Singaporean 434 FTF and flashed my device with it. Made a TA backup and again the md5 values were different than the one on the Malaysian Stock Rom. At least I have the FTF file. When it comes to restoring, I could just reflash the singaporean FTF file and then restore the TA partition. :good:
[Xperia Z Original Android Development] DevShaft:
Some parts (boot logging and such) of TA change frequently, thus a different md5 as result. You can still restore your TA backup, its all fine. As a side note, TA is not ROM or kernel depended. You can always restore when you can access ADB Shell, no matter the state your device is in at that moment. However when you restore it with custom kernel it will soft-brick, since a locked bootloader expects a Sony signed kernel, but that can be resolved by flashing stock ROM through Sony Flash Companion. The reason people advice to first revert to stock before restoring is just to prevent that soft-brick.
[Xperia Z Original Android Development] jankhner:
my TA-backup-zip is 96 048 bytes, is that correct?
[Xperia Z Original Android Development] gm007:
No it should be 2048kb.

[MENTION=5261329]DevShaft[/MENTION]

Do you think that compressing TA.img to a zip file will not loose any binary?
[Xperia Z Original Android Development] DevShaft:
That is not correct. Whats inside the ZIP?

---------- Post added at 08:52 PM ---------- Previous post was at 08:42 PM ----------

Why would it loose binary? I do agree that there is a higher chance of corruption, but its always good to keep an extra copy. I will think about using no compression or no archive at all. Maybe making it compatible with Flashtool is a good idea for future restore. I did make an archive because its easier to transfer and keep everything related centralized. I will discuss this with Androxyde.
[Xperia Z Original Android Development] jankhner:
TA.img 94 KB

TA.md5 1 KB

edit: just realised that the uncompressed size of TA.img is 2048 KB.. so everything is ok?
[Xperia Z Original Android Development] RHBH:
Yes, at least for my XS 2.097.152 bytes.