yashsingh1/xdaforums huggingface dataset:
[Xperia Z5 Android Development] Masoud.Ser:
[MENTION=357342]tobias.waldvogel[/MENTION]

Yes, for me, is The same also

So why flash file dk.ftf is needed??

See below photo

(with flash rootkernel and without flash dk.ftf!!)--

(test on rom6.0-b185-z5-e6633)
[Xperia Z5 Android Development] tobias.waldvogel:
I answered this question already here http://xdaforums.com/showpost.php?p=66379946&postcount=322
[Xperia Z5 Android Development] tobias.waldvogel:
I think this is more an xposed related issue. I will have a look at this. Did you try wiping the dalvik cache?

Update:

It is xposed related. As these are add-on modules they don't get compile during startup. What you can do is:

- look in logcat for the crash and locate a line like the following one. (This is an example for the sticker app)

04-16 00:26:33.992 7992 7992 E dex2oat : Failed to create oat file: /data/dalvik-cache/arm/system@priv-app@CameraCommon@CameraCommon.apk@classes.dex: Permission denied

04-16 00:26:33.993 7992 7992 I dex2oat : dex2oat took 2.453ms (threads: 8)

04-16 00:26:33.999 7959 7959 W art : Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg /system/framework/XposedBridge.jar --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xnorelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/system/priv-app/CameraCommon/oat/arm/CameraCommon.odex --oat-file=/data/dalvik-cache/arm/system@priv-app@CameraCommon@CameraCommon.apk@classes.dex) because non-0 exit status

Now run the failed command manually via adb as root. In this example it would be:

/system/bin/dex2oat --runtime-arg -classpath --runtime-arg /system/framework/XposedBridge.jar --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xnorelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/system/priv-app/CameraCommon/oat/arm/CameraCommon.odex --oat-file=/data/dalvik-cache/arm/system@priv-app@CameraCommon@CameraCommon.apk@classes.dex

And you are good to go ;)
[Xperia Z5 Android Development] superlimau:
i read all 33 pages and can someone advise me if this work on SGP771(xperia z4 tablet)?
[Xperia Z5 Android Development] El_Rey:
[MENTION=2137208]superlimau[/MENTION]

ya, except (the functions in) twrp, thats because the touch doesnt recognize.

... But maybe Tobias will have a look...
[Xperia Z5 Android Development] superlimau:
so i can repack the stock kernel and flash it in but TWRP doesnt work?

i am having unlock bootloader so wondering if i can repack stock kernal and still get root?
[Xperia Z5 Android Development] Barthlon:
ok, i know i've seen one before but now i can't find it anymore.. can someone please point me to a step-by-step tutorial of the process of backing up ta, unlocking bootloader en applying drm fix (and any extra steps, if needed?[emoji14]

someone took the effort, i know that, but i really can't find it anymore...

thanks in advance! now that sony is bugging me with the mm ota update, it's time to unlock, root and really enjoy the phone [emoji41]
[Xperia Z5 Android Development] superlimau:
[MENTION=357342]tobias.waldvogel[/MENTION]

background, using androplus v23 kernel and TWRP-3.0.2-0-20160409.img.

Somehow i am encountering some freezing while playing clash of king/games.

decided to try your method and flash stock kernel.

Here's my step so far.

0. download rootkernel_v4.22_Windows_Linux.zip

1. downloaded original 32.1.A.1.185 for Z4T, extracted kernel.elf using flashtool

2 . rootkernel kernel.elf new_kernel.img [with SuperSU.zip and my bootloader unlocked, not backing up TA]

3. then connect via fastboot pressing volume up and connect usb. fastboot mode is active with blue LED.

4. fastboot boot new_kernel.img

5. C:\adb>fastboot boot new_kernel.img

downloading 'boot.img'...

OKAY [ 0.666s]

booting...

OKAY [ 0.558s]

finished. total time: 1.228s

6. fastboot is ok, startup with temp boot and tablet seems ok.

7. Once booted up, i got no mobile signal and using root checker, i got no root.

What am i missing here? :)
[Xperia Z5 Android Development] El_Rey:
[MENTION=2137208]superlimau[/MENTION]

You can repack your stock kernel.

With this patch from tobias.waldvogel you will be get root (SuperSU).

When you already have unlocked your bootloader and no backup of your TA, then you can't insert your DRM keys.. but everything else should work.
[Xperia Z5 Android Development] tobias.waldvogel:
I don't have this device but it should work as well. What you did sounds good so far. :)

Just in case you may try to comment out the line add_drmfix at the bottom of rootkernel.sh (put a # in front). I don't think it is related but just to be sure.

It might be that there is a different SEpolicy on your device. Please PM me the following:

- output of /bootlog.txt

- output of dmesg
[Xperia Z5 Android Development] superlimau:
going out for dinner here in asia, will continue after some drink :D
[Xperia Z5 Android Development] superlimau:
I also test it and sim doesn't work on my sgp771. Once flashed is ??
[Xperia Z5 Android Development] slaskbak:
Not that I can see.

Began with making a TA-backup and created a DK.ftf that I flashed with Flashtool and it says [Key OK][Active] behind Marlin, Widevine and CKB under Service Menu/Service tests/Security.
[Xperia Z5 Android Development] superlimau:
PM sent. Mobile signal is ok now after i flash boot but still not root.

---------- Post added at 11:48 PM ---------- Previous post was at 11:41 PM ----------

[MENTION=2316345]El_Rey[/MENTION] which SuperSU should i pack inside?

I used the one in androplus provided which is BETA-SuperSU-v2.71-20160331103524.

I dont need TWRP to work for now, all i want is root for gaming.

Cheers,

SL
[Xperia Z5 Android Development] El_Rey:
[MENTION=2137208]superlimau[/MENTION]

I have packed v2.65 inside from chainfire here in the forum.

I have managed to get xposed installed. Now i've all that i need -> Root, Keys are working, SuperSU and Xposed .. so i can live without a working recovery for at least a while.

Cheers
[Xperia Z5 Android Development] superlimau:
is your device a SGP771?

i download the supersu from this link and i wonder if it's the same.

http://www.supersuroot.com/download.html

Can you point me to the link?

I dont even need Xposed, just need root and supersu... :)

SL
[Xperia Z5 Android Development] superlimau:
For SGP771 users, you need to flash the original ftf, then repack using tobias kernel repack with supersu v2.65 and you will get root with stock kernel. Do note that TWRP touch is not working.
[Xperia Z5 Android Development] josephnero:
Can someone please repack this for me?thanks a ton

http://www.mediafire.com/download/thl4e8y9xgcc8hz/JoeNero.zip
[Xperia Z5 Android Development] Mario.D:
Hi have sent you a pm with the link to the repacked kernel.

You should remove the file from mediafire as there are some sensitive info in the TA file.
[Xperia Z5 Android Development] josephnero:
Thanks a ton :)
[Xperia Z5 Android Development] zohaib0001:
[MENTION=357342]tobias.waldvogel[/MENTION]

Androplus update the recovery for z5, his previous recovery was 3.0.2.0 on 20160409

now he release 3.0.2.0 build on 20160417

Please update your mod also
[Xperia Z5 Android Development] tobias.waldvogel:
Well, it is the same version. Does it fix anything or is there a good reason to update? I don't want to confuse everyone by releasing an update every day without any need. ;)

Anyway if you are eager to try it, it is easy to integrate:

Run the following commands with the recovery image that you are interested in

bootimg unpackimg -i <reocvery image> -r rd.gz
busybox gunzip rd.gz
busybox mkdir ramdisk
bootimg unpackinitfs -d ramdisk <rd

Now you have got the contents of the initfs in the directory ramdisk. From there you can update the directory Android/twrp. Please update only existing files and don't add more, as this will probably break it.
[Xperia Z5 Android Development] Mazzeru:
Hello,

Thank you for your job :)

Edit : Resolved;
[Xperia Z5 Android Development] tomeei:
Hi Tobias and others, first of all many thanks for your great work and effort!

One thing is unfortunately unclear to me - the TA.img recovery.

(you can skip points 1-5)

What I did so far:

1. On stock KK, I managed to dump the TA file (2097152 bytes)

2. Upgraded to MM using SEUS/Sony PC Companion, all went fine

3. Extracted the kernel from an FTF downloaded from XperiFirm (FW release matches the one installed with SEUS)

3. Unlocked the bootloader

4. Used rootkernel. sh to patch the stock MM kernel/initramfs with SuperSU and TWRP, flashed with flashtool

5. After reboot - yay, everything is OK!

BUT:

I didn't restore the dumped TA.img. The instructions are unclear to me.

Should I grab the ftf used for flashing MM, and run: `./flash_dk.sh E5823_Customized CE1_1298(...).ftf TA-17042016.img` ?

All that the command produces is a file E5823_Customized CE1_1298-7258_32.1.A.1.185_R6C.ftf of 567 bytes size and contains only DK.ta (180 bytes) and MANIFEST.inf.

Is that correct?

I should use that small ftf file to flash it with flashtool?

PS. My service screens look like that:
[Xperia Z5 Android Development] tobias.waldvogel:
Pricicesly this the idea. As I wrote in another post already this DK.ta just contains your device key (16 byte length) in order write it into a TA unit. This is a one time step, as it will not be overwritten by upgrades or resetting the device. ;)
[Xperia Z5 Android Development] tomeei:
Hi, thanks much for your reply. I was a bit confused about the MARLIN/WIDEVINE/CKB lines showing no errors, whereas other users reported they had problems with those.

In my case only the FIDO_KEYS entry has some complaints (I don't even know what that FIDO_KEYS is. A sort of TPM-on-chip for encryption?).

Moreover, the camera quality seems as good as OOTB, and I have the X-Reality and other stuff available that some users report to have lost.

So all this made me wonder whether I really need to restore the TA checksum - as in "if it works, don't fix it" :)

TL;DR:

So since I am using a *stock* kernel with patched initramfs (SuperSU and TWRP) and *stock firmware*, there is no real risk of hard-bricking the device by attempting to restore the TA backup image? Or is there?

(I read that some people managed to do actually induce brick/endless loop in some of the threads).

If anything goes wrong, will a full TWRP dump to SD be able to recover from failure? Or some other tool that does a 1:1 dump? adb AFAIK does not.

PS. I'd really like to spend more time on hacking this, used to do some funny things with P1, X1, MK16, but I need my phone fully working tomorrow as my Z1c died yesterday ;( Sorry about the rant.
[Xperia Z5 Android Development] najoor:
Thanks for the great work. Is it possible to make the addition of TWRP optional in your code? The reason I am asking is that Androplus kernel for tablet z4 has an entry point to a functioning TWRP but when it is patched using your code its TWRP breaks and the new TWRP doen't work.
[Xperia Z5 Android Development] jensema:
Same for me.

Z5C - E5823

backuped TA on E5823_32.0.A.6.200 (5.1.1)

then upgraded to E5823_32.1.A.1.185, extracted kernel, patched kernel, flasched kernel and flashed TA.
[Xperia Z5 Android Development] devilmaycry2020:
Hi all

My Z5D E6683 unlocked bootloader and running LL 1.52 got bootloop after i did following commands

1: fastboot flash boot rootedkernel.img

2: flash DK.ftf use flashtool.

My phone was backup TA ok

Do i have to integrated TA to kernel of flash DK.ftf separately ?

please help.thank you very much.

---------- Post added at 09:29 PM ---------- Previous post was at 09:19 PM ----------

i had same problem but my phone was Z5D E6683 and running LL .152. I don't want to upgrade to MM at this time. please help.
[Xperia Z5 Android Development] tobias.waldvogel:
You can run the script drm_only. This is desgined to add only the drm fix, nothing else.
[Xperia Z5 Android Development] tomeei:
You mean you also have the FIDO_KEYS "not provisioned"?

Btw. did you try encrypting your devices? I did not. Maybe it's somehow related to that entry?
[Xperia Z5 Android Development] tobias.waldvogel:
Well, it is difficult to give support to LL, as my device is already upgrade to MM. Why do you don't want to upgrade?

Probably your issue is one of the following:

SuperSU integration

I add this after upgrading to MM. You can easily test this by removing SuperSU from the script directoy (if you had it it there)

The kernel you patched does not match you version.

Double check that the kernel is really the one matching vour version.

You did not flash the complete image (all components) in your ftf.

If you did not flash everything entirely, especially the bootloader, then you might run into trouble.

At which time exactly does your device reboot? How far does it get?
[Xperia Z5 Android Development] tobias.waldvogel:
If you restore the TA then your device will get locked again and not accept the modify boot image anymore. You have then to flash the original unmodified stock kernel, otherwise your device will be in a bootloop. Anyway you can put it at anytime into fastboot mode and flash the stock kernel, so there is no risk of a permanent brick.
[Xperia Z5 Android Development] devilmaycry2020:
Thank you for your support.

1. no SuperSU in script directoy

2. the kernel is match. i extract from ROM ftf file

3. i only flash rootkernel.img

4. then i flash DK.ftf

5. And the phone boot to white sony logo then reboot

P/S: Now it boot no problem but my phone was relocked bootloader after i recreate d DK.ftf and flash it
[Xperia Z5 Android Development] tobias.waldvogel:
Did you try to flash the unmodified stock kernel in order to check if it boots?
[Xperia Z5 Android Development] devilmaycry2020:
not yet. can't boot to TWRP. only boot to phone
[Xperia Z5 Android Development] tobias.waldvogel:
I understood that your phone is not booting anymore. So the idea is to put it into fastboot mode and to flash the stock kernel. What do you want to do in TWRP?
[Xperia Z5 Android Development] devilmaycry2020:
my phone can boot normal but not TWRP (bootloop). i want to flash superSU to get root. but my phone now locked bootloader.

One strange is: i boot to fastboot to unlock bootloader but it said

FAILED (remote: Device is already rooted)

finished. total time: 0.017s
[Xperia Z5 Android Development] tobias.waldvogel:
Well, probably you should write it a little bit clearer. So the issue is only with TWRP. Probably this is related to the SEPolicy. And why do you think your bootloader is locked. Obviously it is not, otherwise it would not boot the modified kernel image.
[Xperia Z5 Android Development] devilmaycry2020:
OK. i've checked in services menu and it show Bootloader unlock allow "YES" and all DRM key are OK. just weird. and if i flash DK.ftf my phone auto relock bootloader?
[Xperia Z5 Android Development] tobias.waldvogel:
Well, this is the result of my DRM fix module and unlock allow does not mean it is locked.
[Xperia Z5 Android Development] jensema:
Exactly, I also had FIDO_KEYS "not provisioned.

Everything else is working.

What do you mean by encrypting?
[Xperia Z5 Android Development] devilmaycry2020:
so what should i do to get root and twrp work ?

And my phone actual unlocked bootloader but with DRM fixed? But not rooted, TWRP not work. Please fix that. thank you very much. cause there are too many peoples still running LL and waiting better MM version.
[Xperia Z5 Android Development] najoor:
That's what I thought, but unfortunately the drmonly script generates a non functioning kernel. I get a boot loop when I flash it.

PS: this is when I run the script on androplus kernel v24.

PS2: Actually neither of the scripts produce a bootable kernel when applied to androplus v 24 kernel.
[Xperia Z5 Android Development] ninestarkoko:
[MENTION=357342]tobias.waldvogel[/MENTION] could you please move this topic into Sony OEM cross section, or open another topic in the Z5C/Z5P section, pointing here?

Because it seems that many people is not informed about recent updates regarding DRM restore functions. Thank you

---------- Post added at 06:23 PM ---------- Previous post was at 05:29 PM ----------

Unfortunately latest packages from Tobias does NOT fully support Lollipop and he is not able/don't want to give support anymore to LL. He has already stated this and we must respect his choice.

You can still flash the modded LL kernel using latest 4.22 and it should boot.

(If i understand well, you have already modded your LL stock kernel using 4.22 package and also done the whole instructions to restore DRM functions, including .ftf file flashing)

As you verified, on Lollipop, included TWRP will not work and will go in bootloop (you'll need to reenter fastboot and reflash kernel).

If you want to install SUperSU you could try downloading a TWRP image LL compatible from you specific device forum (see in Android development and Original android development) and "fastboot boot recovery.img" to try if it boots and if successfully booting, flash SuperSU .zip package.

Note that Supersu installation in /System (not system-less) might give bootloop. In this case you can use UnSu.zip package you can find here http://xdaforums.com/showpost.php?p=63615067 to remove SuperSu and you can try to force a System-less installation (you can find instructions in SUperSu zip or ask here).

In any case, before trying these steps, BACKUP your files, medias, photos,...because there's always a small chance that things get worse than you expected.
[Xperia Z5 Android Development] tobias.waldvogel:
I had a look on this and the issue was that the permissions on custom directories (like /bootrec) were lost. This is adressed in V4.23 now.
[Xperia Z5 Android Development] tomeei:
Do you mean that "by restoring the TA" the device will:

1) not accept any new custom unsigned kernels (that is obvious to me) OR

2) not boot with the stock MM kernel that it is using now? I thought that the rootkernel-v4.22 script embedded SuperSU and TWRP into the initrd and not the kernel itself? So the checksum of the kernel had not changed, only the initrd contents did? But I don't know much about how Android bootloaders work...

Or maybe the SuperSU and TWRP (which now both work OK, and I have a kernel extracted from stock ftf) that were implanted there with the rootkernel script were extracted from the initrd on 1st boot and now I can re-lock the bootloader, revert to vanilla/original kernel (or use any other vanilla/original kernel), since the SuperSU and TWRP will still work as they are already implanted into the device filesystem?

Long story short:

Honestly, I only have concerns about the FIDO_KEYS saying "not provisioned, provision failed". I want to encrypt my phone's storage but I am a bit worried that it might lead to trouble if parts of the TA/DRM stuff are missing...
[Xperia Z5 Android Development] devilmaycry2020:
Thanks for helping me. I've used 4.22 tool to create rooted kernel,maybe I'll reflash kernel if it work or not

p/s : tried to use 4.23 version but no luck, still got bootloop on LL. Very disappointed
[Xperia Z5 Android Development] Frontier3:
While using Titanium Backup Pro on root it says it is uninstalling the system apps I choose, but when I reboot they are still there. So it's like TiBu is not actually getting access to the system folder, but it's not throwing any errors. I've manually deleted some apks from system/app in root explorer but this is a dangerous way to uninstall things, plus I cant find the APKs for a lot of the things I want gone.

I backed up my TA partition, then upgraded to .163, pulled the kernel and applied the fix on it, then I re-injected the kernel into the phone, ran the TA restore script from the instructions. Then I upgraded MM to the .185 firmware and installed xposed.

I haven't gotten any errors but clearly something isn't working right. Has anyone had any problems with Titanium Backup or with proper system access?

Thanks
[Xperia Z5 Android Development] tobias.waldvogel:
I wrote this already in my FAQ because I am getting a little bit tired of repeating it over and over again:

If your bootloader is locked and you touch a single bit of the boot image (kernel or initfs) then signature does not match and your phone refuses to boot.

If you modify the system partiton the original kernel package will refuse to mount it so you have to choose:

Keep your phone unmodified and locked or unlock it and modifiy it.

This is not related to phone encryption. Anyway FIDO keys will not work until you flash your DK.ftf.

One more comment on this: The moment you unlocked your phone you made it insecure. Anyone can boot any alternative kernel/recovery to extract your data. Encrypting the phone doesn't help as the key is stored in the phone.
[Xperia Z5 Android Development] ninestarkoko:
Do you have root access with other apps? If you flashed .185 stock kernel again during the upgrade, then you have to repeat the kernel modding again (.ftf excluded, as it's a one-time step).

If you have root access and the only problematic app is TB then try to uncheck the option "mount space name separation" in SuperSU settings. This fixed my problems with Titanium backup.

Let me know
[Xperia Z5 Android Development] tomeei:
I am sorry if I offended you, my questions were due to the fact, that there is not much information on Z5c rooting etc, and the ones I found are often self-contradictory.

Now I think I understand it correctly.

One more question if I may, the point about system partition, the kernel will refuse to boot if the system partition IMAGE was modified before flashing it? Or the kernel will refuse to boot even if the /system partition was modified on the device BEFORE flashing that new kernel (and only the kernel is being flashed)? BusyBox etc. usually installs itself to /system, does that mean that installing a stock kernel will cause the device to not boot?
[Xperia Z5 Android Development] tobias.waldvogel:
The complete firmware image contains amongst others two items: the system partition and the kernel package (kernel+initfs). The stock kernel mounts the system partition with dm-verity, which means it compares the hash of whole system partition against the value in the kernel package. So as long as dm-verity is on, your phone will refuse to mount system partition if it is was changed in any way at any time.

So again

modifying the system partition requires dm-verity off

deactivating dm-verity means modifying the initfs (what my script does)

booting a modified bootimage requires unlocked bootloader
[Xperia Z5 Android Development] acabreram:
Hi Tobias!

Noob question bro

until now I only have unlocked my bootloader, which will be the next step? i am with the stock kernel right?

how to apply this package if i don´t have a recovery installed and I can´t see a .img package to flash through cmd
[Xperia Z5 Android Development] yChoon:
Just asking,

I already use the method provided by Monx to root my E6683 and i haven't flash Xposed yet. Should i flash this 1st then only flash Xposed? Or I can straight flash Xposed?

Ps: a newbie on Sony phone tho, was hoping their rooting method is easier :/
[Xperia Z5 Android Development] Arturiuz!:
try download the AndroplusKernel(perhaps),extract it & you'll have the boot.img from it.flash it using cmd,reboot to recovery,then you can already flash this kernel from sir Tobias!

tbh,i haven't heard/known about Monx root method but,do you already have recovery installed now on your device?i pressume not yet.if so,then flash this first then the Xposed.
[Xperia Z5 Android Development] juupke76:
I have the same problem. Only reboots.

What can I do?