yashsingh1/xdaforums huggingface dataset:
[Xperia Z5 Android Development] najoor:
I tried RC3 on 186 stock kernel (log below). I get the same results; still no touch in twrp, and it freezes if I use vol dn instead of vol up to get into TWRP. What did you change in this build?

By the way, I know that [MENTION=5169444]AndroPlus[/MENTION] also had difficulties in getting the TWRP touch to work when he was compiling his (see http://xdaforums.com/showpost.php?p=62340549&postcount=19) but they sorted it out in that thread and fixed it quickly. It had something to do with including vendor files in the build but I don't remember the rest. You can ask androplus or have a look at that thread. The fix may be trivial.

- Unpacking kernel

Found elf boot image

Kernel version: 3.10.84

Found appended DTB

- Detected vendor: somc (Sony), device: karin, variant: row

- Unpacking initramfs

- Detected platform: 64-bit

- Detected Android version: 6.0

- Disabling dm-verity

- Sony RIC is enabled. Disable? [Y/n] Y

Disabling Sony RIC

- Install TWRP recovery? [Y/n] Y

Installing TWRP

- Found SuperSU-v2.71-20160331103524.zip. Install? [Y/n] Y

Adding service entry for SuperSU

- Install busybox? [Y/n] Y

- Install DRM fix? [Y/n] Y

Configuring tpm-service

Configuring credmgrd

Configuring secd

Configuring wvkbd

Configuring drmserver

- Creating new initramfs

- Creating boot image

- Cleaning up

Done
[Xperia Z5 Android Development] tobias.waldvogel:
Don't expect anything from vol down. The key to enter TWRP is vol up. Actually I added touch_fusion with the corresponding firmware, but it is difficult to test without the device. I will prepare another test tomorrow. Thanks a lot for testing.

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] Daniel_GB:
tnx for the great work,

everything went smoothly on my Z5p E6833 and I'm now rooted!

DRM related stuffs are also working after backing up TA partition and using your method;)
[Xperia Z5 Android Development] dr4go:
I made a rather big mistake when flashing back the kernel... :( Accidentally I typed...

fastboot flash recovery newkernel.img

...instead of "boot". Although everything seems to work fine... should I flash back the original firmware before closing the bootloader and restart the procedure? I guess, that I've replaced the stock recovery with some garbage data?

Thanks in advance and huge thanks for all of your efforts! A donation is flying out very soon... :)
[Xperia Z5 Android Development] tobias.waldvogel:
It is not really an issue, bit if you like you can open firmware .ftf file with a zip packer and extract fotakernel<something>.sin. Afterwards you can extract the contents of the .sin with flashtool (sin editor) and then flash it back. Anyway the contents if this recovery partition is only required for automatic OTA (over the air) Android updates from Sony.

What I did not understand is what you mean by "closing" the bootloader.
[Xperia Z5 Android Development] BlackArtsInc:
So correct me if I'm wrong but in order to use this tool you must first back up your original DRM keys and use them during the process? If so I'm unable to go back to stock kernel. I unlocked without backing up my keys. I'm on Androplus Kernel at the moment. It's OK but there is some battery drain from Android System and the kernel itself which were not happening with the stock 185 kernel... :(

Not sent by me!
[Xperia Z5 Android Development] Daniel_GB:
[MENTION=357342]tobias.waldvogel[/MENTION]

It could be just my imagination but after unlocking boot-loader, I think in-call sound quality is not the same as before!

Is that normal?

How can I check if I have done every step correctly and my device key is being used properly?

which features should I test to ensure everything is working?
[Xperia Z5 Android Development] RyTekk:
You can use this command to erase recovery partition,

fastboot erase recovery

As tobias said, FOTAKernel is totally useless after UB, on old BL you need a code in kernel ramdisk to load recovery from this partition, Sony has made this easier by updating BL to help us can load recovery in an easier way (but the recovery need to be compiled without lzma).
[Xperia Z5 Android Development] tobias.waldvogel:
Androplus is bundling using the initial release of my DRM fix. With my DRM fix most things will work without having your device key. (I don't have mine neither). Only certain things like widevide don't work. Just give it a try
[Xperia Z5 Android Development] fisheyes1:
For a complete noob like me it took me ages to actually figure out what to do what with all those pages! Here is what I did:

1. Follow this guide up to step 4.

2. Flash latest stock ROM (MM .185)

3. Extract "kernel.sin" from latest stock ROM, use flashtool to extract "kernel.elf" (in OP post)

4. Download rootkernel zip from OP. Extract to its own folder (I put mine in "C:\Users\MYNAME\Desktop\rootkernel"). Put "kernel.elf" in that folder.

5. Put TA backup img (had format TA-DDMMYYYY.img) in rootkernel folder.

6. Download SuperSU (SuperSU-v2.65-20151226141550.zip) and put it in rootkernel folder

6. Open CMD in that folder and ran:

rootkernel kernel.elf boot.img TA-DDMMYYYY.img

This output:

C:\Users\MYNAME\Desktop\rootkernel>rootkernel kernel.elf boot.img TA-04052016.img
- Unpacking kernel
Found elf boot image
Kernel version: 3.10.84
Found appended DTB
- Detected vendor: somc (Sony), device: suzuran (Z5C), variant: row
- Unpacking initramfs
- Detected platform: 64-bit
- Detected Android version: 6.0
- Disabling dm-verity
- Disabling SONY RIC
- Installing TWRP
- Found SuperSU-v2.65-20151226141550.zip
Adding service entry for SuperSU
- Configuring keyprovd
- Configuring credmgrd
- Configuring secd
- Configuring wvkbd
- Configuring drmserver
- Creating new initramfs
- Creating boot image
- Cleaning up
Done

8. Then I ran:

flash_dk TA-DDMMYYYY.img DK.ftf

7. Put boot.img into fastboot folder and opened CMD in that folder and ran:

fastboot flash boot boot.img

All steps ran without errors. And if I dial *#*#SERVICE#*#* -> Service tests -> Security. I get:

MARLIN [Key OK] [Active]
WIDEVINE [Key OK] [Active]
CKB [Key OK] [Active]
blah
blah
blah
FIDO_KEYS : Not provisioned, provision failed
Factory Reset Reason: No device reset information found.

I have functioning root and busybox. Can someone tell me:

Will my DRM functionalities work (do the [Key OK] things mean it worked)?

What is the actual function of the DK.ftf, and if I want to keep root should I flash it?

Sorry for all the questions. I am a complete noob and have no idea what I just did!

EDIT:

Tobias' answer:

Thanks for the help!
[Xperia Z5 Android Development] BlackArtsInc:
So how can I end up with the official kernel and root without my TA backup and DRM keys? Which steps do I need to take?

Not sent by me!
[Xperia Z5 Android Development] deconfrost:
maybe a silly question, but should I unlock the simlock first before I unlock the bootloader? this is my second z5, first z5, a week after bootloader unlocked, no network, no sim work in it, no TA backup :( but it does work in area with strong coverage, even on 4G+ with full signal

bit worry to do anything with the new one now
[Xperia Z5 Android Development] tobias.waldvogel:
Marlin and Widevine show status ok but do bot work actuallly. As soon as you flash your device key they will work and the fido key will be provisioned as welll. Flashing dk.ftf just writes your device key into the TA partition, nothing else.

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] tobias.waldvogel:
Well the steps written in the very first post. ;) Or the summary from the post before

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] da900:
Hi. Great script. Could you add Xperia Z3 Tablet Compact LTE (scorpion) to the script? Or, at least, describe how to add it manually by myself& Thanx a lot.
[Xperia Z5 Android Development] tobias.waldvogel:
The tablet Z3 seems to be very similiar to the Z2 (castor). I added the support in this test version:

https://www.dropbox.com/s/4gggmr72lu58410/rootkernel_v4.4_Windows_Linux_RC4.zip?dl=0

Please let me know if everything works ok. If you are unsure which options to include say yes to everything ;)

Just one more thing: In your signature you said Z3 with CM. I just want to make you aware that this is only designed and tested with stock firmware. On CM probably it does not have any effect.
[Xperia Z5 Android Development] da900:
Thanx a lot. No, I have just flashed latest stock MM firmware.[emoji4]

Will check when get home from the job.
[Xperia Z5 Android Development] deconfrost:
anyone got any advice on this?
[Xperia Z5 Android Development] tobias.waldvogel:
If that happend one week after unlocking your bootloader I can't see any connection between your issue and unlocking it. You should open a new thread for this as this is complete different topic.
[Xperia Z5 Android Development] deconfrost:
just want to know if I should do the network unlock first as this one is network locked
[Xperia Z5 Android Development] Daniel_GB:
Well I had some weird experience too!

LTE coverage is not strong here and I usually get 2 bars...before unlocking and using this script to get root and DRM fix everything was normal!

However, after unlocking my phone constantly dropped to 2G and I have to manually select LTE and it went back to 2G again a few minutes later...

The in-call sound quality also decreased and it was more noisy...

Now I have restored my TA backup (boot-loader re-locked automatically) and everything is normal!

in-call sound quality is back and no more dropping to 2G...

BTW, my phone is Z5 premium dual E6833!
[Xperia Z5 Android Development] da900:
Tried the new tool. TWRP - works fine, but seems like all imags are for bigger resolution. Cann't boot cause of the boot-loop. :(
[Xperia Z5 Android Development] tobias.waldvogel:
This odd. The resolution is the same as my Z2, and there it looks good. Could you send a picture of the TWRP menu?

Regarding the bootloop please try the following and check if it boots:

- Build an image without TWRP: Install TWRP recovery? N, everything else Y

- Build an image without DRMFix: - Install DRM fix? N, everything else Y
[Xperia Z5 Android Development] deconfrost:
thanks for the info, my first z5 was unlocked before ta backup was available, I be sure to backup and restore this time :)
[Xperia Z5 Android Development] da900:
Tried the following configs:

1. Without DRM fix - bootloop

2. Without TWRP - bootloop.

BTW, could factory reset help to resolve bootloop?

TWRP looks this way (screenshot)
[Xperia Z5 Android Development] tobias.waldvogel:
Did you just test the image with fastboot boot or did you write it to the boot partition with fastboot flash?

Could you paste the first lines from the output of the tool? The ones with detected device and kernel.
[Xperia Z5 Android Development] da900:
Everytime I have flashed via "fastboot flash boot".

Here is the first lines:

D:\ANDROID\Xperia_Z3_TabComp\rootkernel>rootkernel kernel.elf stock_kernel_Z3TC_04.elf
- Unpacking kernel
Found elf boot image
Kernel version: 3.4.0
- Detected vendor: somc (Sony), device: scorpion, variant: row
- Unpacking initramfs
- Detected platform: 32-bit
- Detected Android version: 6.0.1
- Sony RIC is enabled. Disable? [Y/n]

:p
[Xperia Z5 Android Development] tobias.waldvogel:
"row" is good. That means you have the model with SIM card. The other variant would be "windy", which means WiFi only.

I'm surprised to see that TWRP shows up in portrait. The config files in the Android\twrp_scorpion folder are landscape.

Regarding the bootloop you can try to put the stock kernel (the elf file) if you did not modify already something in the /system partition.

When you flashed MM I guess you downloaded it via xperifirm and flashed it with flashtool. Are you sure that you did not ommit anything? In particular the bootloader update? You can open the .ftf file as zip file. There should be a boot directory in there and a boot_delivery.xml
[Xperia Z5 Android Development] da900:
Sems like everything is done right n my side. I did not modify th system, all parts of ftf you told about are inside the file. Screnshot attached.

P.S. Could be the reason of bootloops the fact that I booted into the TWRP right after the flash of kernel and flashed SuperSU via recovery?
[Xperia Z5 Android Development] tobias.waldvogel:
Your ftf looks good indeed. SuperSU might be the reason. The easiest way is to let my script integrate SuperSU already. I did all my tests with SuperSU 2.7.1. All you have to do is placing the zip in the same directory and to make sure that the name starts with SuperSU (case sensitive).

I would try to flash the whole ftf one more time in order to make sure that the system partition is ok.
[Xperia Z5 Android Development] Daniel_GB:
[MENTION=357342]tobias.waldvogel[/MENTION]

is there any difference between these two commands?

rootKernel kernel.elf boot.img TA.img

and

rootKernel kernel.elf boot.img
[Xperia Z5 Android Development] tobias.waldvogel:
The first one is from an ealier version and obselete (a 3rd parameter would just be ignored). I wrote all the steps in the very first post:

rootKernel kernel.elf boot.img

to produce the boot image, which need to be flashed with

fastboot flash boot boot.img

To flash your device key for the DRM fix you run

flash_dk <TA backup> DK.ftf

and flash this DK.ftf afterwards with flashtool
[Xperia Z5 Android Development] da900:
Finally booted!!!! :laugh: Config is: all function are "Y" + superSu 2.71 included.

Thnx a lot.
[Xperia Z5 Android Development] tobias.waldvogel:
Thanks for the feedback :highfive: I will leave the Z3 Tablet then in the list of supported devices.
[Xperia Z5 Android Development] deconfrost:
got a link to SuperSU 2.7.1 zip? I can't seem to find it

thanks
[Xperia Z5 Android Development] da900:
http://xdaforums.com/showthread.php?t=2868133
[Xperia Z5 Android Development] da900:
This is great. About the TWRP: recovery works as it should, but as the default orientation for Z3 Tab is portrait (8 inch display), could you update the images?
[Xperia Z5 Android Development] tobias.waldvogel:
Just one more quick question to be sure: You have used volume up to enter recovery, not volume down, right?

One mor thing you could try is to remove the folder /sdcard/TWRP

It could be that an earlier version stored there a setting with portrait mode. The TWRP settings which I included for your tablet are for lanscape mode. This is why the images look bad.

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] Barthlon:
either you are just lazy, or not ready to indulge in modifying your phone :D

if you google supersu it's the first hit you get.
[Xperia Z5 Android Development] deepongi:
[MENTION=357342]tobias.waldvogel[/MENTION]

theres still issues with RIC and/or dm-verity

C:\Users\infected_\Desktop\rootkernel_v4.4_Windows_Linux>rootkernel.cmd kernel_S1-SW-LIVE-F936-PID1-0006-MMC.elf boot.img
- Unpacking kernel
Found elf boot image
Kernel version: 3.10.84
Found appended DTB
- Detected vendor: somc (Sony), device: sumire (Z5), variant: row
- Unpacking initramfs
- Detected platform: 64-bit
- Detected Android version: 6.0
- Disabling dm-verity
- Sony RIC is enabled. Disable? [Y/n] Y
Disabling Sony RIC
- Install TWRP recovery? [Y/n] Y
Installing TWRP
- Install busybox? [Y/n] N
- Install DRM fix? [Y/n] N
Skipping drmfix
- Creating new initramfs
- Creating boot image
- Cleaning up
Done

C:\Users\infected_\Desktop\rootkernel_v4.4_Windows_Linux>fastboot flash boot boot.img
target reported max download size of 536870912 bytes
sending 'boot' (19812 KB)...
OKAY [ 0.440s]
writing 'boot'...
OKAY [ 0.203s]
finished. total time: 0.643s

C:\Users\infected_\Desktop\rootkernel_v4.4_Windows_Linux>

i had supersu in system mode with androplus kernel, plus some modified files on /system

with that repack ive shown on log, the device gets kernel bootsplash, but right after gets stuck, red led blinking and reboot/bootloop.
[Xperia Z5 Android Development] tobias.waldvogel:
The issue seems to be with SuperSU in /system mode. Another user reported something similar. Please remove it before using this script
[Xperia Z5 Android Development] deepongi:
ok.. but so whats the point of disabling dm-verity and sony ric, repacking the kernel and flash, if we cant modify system ?

i got it too boot, with the repack of the kernel, but i have system in read only. going to make some tests now.
[Xperia Z5 Android Development] shoey63:
Doesn't Androplus kernel already include recovery? Maybe you should try without adding twrp? Or strip it back to to pure ramdisk without recovery and try again. (I see you have moved on from Shinano devices. Good luck to you:good:)

[MENTION=357342]tobias.waldvogel[/MENTION]. Works great on my Z3, just had to change FOTA NODE to 179 (maybe not required?) and /dev/block path to mmcblk0p16.

Edit: And obviously add Leo/Z3 to twrp folder and rootkernel.sh.
[Xperia Z5 Android Development] devilmaycry2020:
Hi @tobias.waldvogel

My Z5 E6683 can't use Sony Album . it frozen and i can't view image. i've tried to clear data but didn't help. i used v4.4 to make rootedkernel (in Install DRM fix? i choose Y) and the preview picture in Display setting X-reality turn black. Before v 4.3 i didn't have this problem.please help.
[Xperia Z5 Android Development] tobias.waldvogel:
Of course you can modify /system (xposed etc) It is just SuperSU in /system, which is causing the issue, probably related to SELinux rules. As SElinux is our last line of defense in case of a kernel security issue we do not want to weaken it by additional rules.

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] tobias.waldvogel:
Thanks for commenting this. You are right, I never adapted it when I changed the parameter syntax for bootimg. I am currently 2 weeks on vacation. I will adapy it as soon as I'm back

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] deepongi:
I'm running a repack with supersu in systemless mode, and with all kernel repack options enabled.

Have you tried to open kernel adiutor? I get stuck reading cpu info and it's options. Even being a stock kernel, having root I should have access to that section and not stall there. Same happens with other kernel managers.

edit: [MENTION=357342]tobias.waldvogel[/MENTION] got it to work, it was selinux troubles indeed also on this.

heres the zip if anyone whats to use it:

http://www.mediafire.com/download/6c9ezomd0enqbgi/byeselinux_flashable.zip

regards.
[Xperia Z5 Android Development] acabreram:
Is tiene a way to get root ando Android pay? Thanks!
[Xperia Z5 Android Development] tobias.waldvogel:
I do _NOT_ recommend deactivate SELinux under no circumstances unless you want to have your phone infected by some malware. It seems that lately there is more activity in Android randsomware. A secure way to implement your changes would be running your commands with su -c <your command> or adding an explicit exception to SELinux. In order find the rule look for the avc denied entries in dmesg.
[Xperia Z5 Android Development] Klaus N.:
I've rwad tge last 15 pages and the startpost as well, but I didn't find an answer: Does this work on a Z3 (D6603)?

Thanks in advance!
[Xperia Z5 Android Development] shoey63:
Did you read this post from a page or 2 back?

http://xdaforums.com/showthread.php?p=66740460
[Xperia Z5 Android Development] tobias.waldvogel:
You may try to delete the contents of /data/credmgr and reboot

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] nabeelrazanaqvi:
Hi there, thanks for the good tutorial, i want to ask that i want to have clean kernel without root and without TWRP, and I also want to Restore the TA-xxxxxxxx.img to the kernel like you did at the end but without root and custom recovery, how can i do that kindly help me out as i am from pakistan and can not have help easily from surrounding. So thanks in advance and sorry for my Noob Question, I have Tried the Tarestore.bat file but it either it says aborted or says I is at wrong place.
[Xperia Z5 Android Development] williamgrant:
Hi Thomas!

I just want to report a Windows bug with your great kernelroot tool. I'm a hungarian guy, with a HUN specialized Windows and keyboard. The main problem:

In my language the Z and the Y buttons are changed on the nationality kebyboard. I try to change the windows language to EN(US) but the script doesn't work. Only i hear an error beep sound when I try to press Z or Y.

Finally I modified the rootkernel.sh batch, changed the Y to I in the ask() part, and It's works for me now.

I hope you have an idea to fix it. :)

Cheers,

Williamgrant - Prohardver Team

Hungary
[Xperia Z5 Android Development] Klaus N.:
Is there any advantage - compared to that tool: http://xdaforums.com/showthread.php?t=2930672 - if I don't have backed up the drm-keys of my z3?

Thanks in advance!
[Xperia Z5 Android Development] tobias.waldvogel:
It seems that the choice command is locale dependant. In V4.41 I added the parameter to ask always for y or n. ("I" was probably for igen in hungarian)
[Xperia Z5 Android Development] tobias.waldvogel:
The Z5 version of this thread is an older version of my drm fix library with an older credential table. So some new Sony functions might not work. If you decide to use the outdated version then please don't post any problem reports to this thread.
[Xperia Z5 Android Development] devilmaycry2020:
Thank you very much. I dont know if it work or not. I delete contents of /data/credmgr and reboot ,the phone itself auto recreate contents of /data/credmgr. But i reflashed the rootkernel i've made by v4.3
[Xperia Z5 Android Development] tobias.waldvogel:
Yes, this is precisely the idea, that the phone recreates it. It can get corrupted if you boot a kernel without DRM fix. It may also happen if you boot the androplus kernel without using this script on it, as it comes with an older version of my library. Anyway cleaning the /data/credmgr folder fixes this normally.

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] StingeR116:
Please turn on your phone z1c amami.
[Xperia Z5 Android Development] Klaus N.:
Only to clarify that for myself: This thread has the new version, while the thread of Team EXR from china and Team THS has the old one. Is that correct?
[Xperia Z5 Android Development] tobias.waldvogel:
Probably I should take english lessons if I'm not able to write my answers clearly enough

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] ramone01:
v4.41 is not working on me, only root choice not working. My phone sucsessfully flashed new kernel and sucsessfully boot but root is not working fully (eg. selinux permissive, es file explorer, busybox). Im trying 4.3 and it is working fully.

My windows 10 is not english language. Thank you for your job i hope you fix that problem :)
[Xperia Z5 Android Development] Klaus N.:
I consider this as humour, and not as sarcastic ;) Sry, that was my fault.

I believe, you must confuse me with someone: I'd never cry in

your

thread, when I would have problems with something in

another

one!

Never mind - thank's alot for your awesome work and kind help :good:
[Xperia Z5 Android Development] tobias.waldvogel:
Don't get me wrong, I wrote that just in case because my older version installs into the /system partition, which means it will be still active if you use afterwards this script. It might be then very difficult to find the root cause of any issue. As I'm trying to help everyone who reports an issue I just want to keep it supportable ;)

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] Klaus N.:
[MENTION=357342]tobias.waldvogel[/MENTION]

Thank you very much for pointing that out for me, now I got it!
[Xperia Z5 Android Development] VBBoston:
KEYS

Hi,

When I dial *#*#7378423#*#* and go to service tests/Security I get this (please see screenshot). Could anyone give some explanation what all these keys mean and whether I need to flash anything more. Root and Xposed are working. Thank you