yashsingh1/xdaforums huggingface dataset:
[Xperia Z5 Android Development] langeveld024:
No, this zip package is meant to flash from recovery. It unpacks and modifies your current stock kernel.

You can fastboot flash recovery.img first and then flash this or just flash andro-kernel followed by the Drm restore zip from tobias's other thread.

BTW for root you should flash supersu from recovery (source: http://download.chainfire.eu/supersu-beta) and for working busybox (you gonna need that too) install busybox installer from playstore and let it install once u got root.
[Xperia Z5 Android Development] tobias.waldvogel:
This is the source for unpackelf. I am reorgnizing the source in order to create a multicall binary with all tools for unpacking/creating kernel images and initfs, which compiles for Windows/Android/Linux.

The next version of the rootkernel tool will be available for running in recovery or on Windows .

Once it is finished I will publish the whole source.
[Xperia Z5 Android Development] tobias.waldvogel:
No, but the new V3 does ;)
[Xperia Z5 Android Development] tobias.waldvogel:
V3 should work without any problem on Z3+
[Xperia Z5 Android Development] tobias.waldvogel:
V3 supports now 6.0 ;)
[Xperia Z5 Android Development] blakwhite:
Thanks but test fails:

FAILED (remote: dtb not found)
[Xperia Z5 Android Development] celderic:
Doesn't reach the bootanimation, bootloops.

Seems to work, can boot into recovery although the orange led doesn't turn off after entering recovery like previous versions.

Here, hope this helps. boot.img is the original, and bootnew.img is the output file.

https://mega.nz/#!DUcl0JSQ!gguy0AEN5U2PneRVnFR4TPA3Qd0MIn2fvqn6OMYm-Ss

Edit-

I should add that my system partition has been modified, I assume dm verity was disabled correctly? I've not had time to check it yet, just uploaded it quickly for you.
[Xperia Z5 Android Development] tobias.waldvogel:
I think you missed a few steps. You have sent me the kernel.sin. Before you can use my tool you need to extract the boot image from the .sin file. You can do this with flashtool as described:

In flashtool use the menu entry Tools->Sin Editor and then select your kernel.sin. After using the "Extract data" button you should end up with a file kernel.elf. This file can be uses with my tool.

So afterwards run e.g.

rootkernel kernel.elf newkernel.img

and then try to run it with fastboot boot newkernel.img

I just did these steps with your kernel.sin and it worked perfectly well.

Cheers,

Tobias
[Xperia Z5 Android Development] blakwhite:
I actually had followed all the steps but test failed and so didn't flash the kernel. Could it be that test fails but it boots successfully?

Can you send me your successful kernel from the elf I sent you.
[Xperia Z5 Android Development] tobias.waldvogel:
Sure, here you go: https://mega.nz/#!XNkBhLKJ!X35U46V1GkPkMZm75FHMJw0r1ANrjSVYrgQ3FTGoBNs

It boots perfectly well on my E6683

Cheers,

Tobias
[Xperia Z5 Android Development] tobias.waldvogel:
I tried your bootnew.img and it boots perfectly well on my phone. Yes, dm-verity is disabled and I also have some changes on my system partition.

Which kind of changes did you do?

Cheers,

Tobias
[Xperia Z5 Android Development] tobias.waldvogel:
Source of bootimg

Here is the source of bootimg for the who are insterested in it. In the V3 package you will find the binary version for Windows and Android.

It includes the following commands:

unpackelf, unpackimg, mkimg, unpackinitfs, mkinitfs, getarch, seinject

Unpackelf and unpackimg are for unpacking boot images and mkimg creates an Android boot package again.

Unpackinitfs and mkinitfs are for the init ramdisk. The difference to other implementations is that links are create as text files with the ending __lnk__ in order to make to compatible with Windows (Windows has not soft links).

Getarch returns whether a Linux executable is 64 or 32 bit

Seinject adds rules to SELinux policies. Many thanks to Joshua Brindle for this https://bitbucket.org/joshua_brindle/sepolicy-inject

Cheers,

Tobias
[Xperia Z5 Android Development] blakwhite:
Thank you. But interestingly, this one fails, too.

I can't figure out what but there's something wrong with my phone. I experienced the same problem with Androplus kernel too. Before 6.0, I could root perfectly and flash any kernel. But now, none of the kernels boot.

After flashing this one, phone didn't turn on, just a weak vibration when I tried to power on. But I flashed the kernel only from the original ftf through flashtool and it booted.
[Xperia Z5 Android Development] tobias.waldvogel:
Just a quick question: You unlocked your bootloader, right? Otherwise anything else than the original file signed by Sony won't work.
[Xperia Z5 Android Development] blakwhite:
Yes, not that rookie.
[Xperia Z5 Android Development] tobias.waldvogel:
I'm sorry, I didn't mean to offend you ;). But it could happen that your phone get relocked with an update.

So you still getting the message then that DTB wasn't found? This is really strange. On which model are you trying to boot it?

Cheers,

Tobias
[Xperia Z5 Android Development] blakwhite:
No problem, you didn't offend me :)

It's an E6603. That relocking thing came to my mind but didn't see a possibility. But I will try re-unlocking although I still see it as unlocked in config.

I got the same error when I tested, nonetheless flashed just to have tried.
[Xperia Z5 Android Development] celderic:
You let it boot up fully? I have the E6653.

I can confirm even after a full data wipe including internal storage, this does not boot (the bootnew.img, i've not tried with another as you said this definitely works) I've tried many times, and it can't even display the boot animation, it gets to the start of it and freezes before the text can be displayed, the red led flashes a few times and the display goes black and loops doing this over and over.

I'm using my rom posted here

This is the exact rom i am using, my 6.0 release, i've not created a new thread for it yet.

Androplus kernel v20 is included and boots fine, just updated to v21 and that is okay too

Here is the rom if anybody else could test please?

There are no specific mods to the system partition, only supersu added, the rest are just apks removed so i don't think it is a problem with my rom as this is basically stock just debloated.

I will try stock 6.0 now, (flashing as we speak) but like i say my rom is stock just debloated and rooted, not even busybox added.

Edit-

Still the same,

Here is the base i used for my rom, and the same stock image i just flashed to test with.

E6653_32.1.A.1.163_1298-5496_R6C.ftf (Customized UK)

I'm going to try and build it again to to make sure the bootnew.img was okay, although you said your device booted.

Edit2-

Very strange, i built it again and flashed only the stock system partition with flashtool and it booted.

Will update if i have any more problems.

Edit3-

The bootloop i mentioned only happens when supersu is installed on the system partition, but installed systemless in the kernel it is fine.
[Xperia Z5 Android Development] blakwhite:
Yeah, strange really. I tried re-unlocking but it said already done. I tried downgrading to 5.1.1 and rooted successfully. Then updated again to 6.0 only to get the same errors in the fastboot process.

I downloaded some other firmware (6653 this time), fastbooted on some other pc but still the same. I haven't used a phone without root for the last 4 years, other than a few weeks waiting period, and go mad really :(
[Xperia Z5 Android Development] tobias.waldvogel:
I can totally understand that, this also why I spent quite a lot of time the last two in this project.

I had some more thoughts on your problem and I can see only two possible explainations:

- Your fastboot is outdated.

I'm using the one from official Android SDK (size 319,488)

- Your bootloader has not been updated.

The boot image file format has changed since 5.1.1 and is using now appened DTB. The original format provided by Sony is in ELF format and the image in Android boot image format. Sony ELF can't be created as it requires a digital signature from Sony. I assume you used Flashtool to flash the Marshmallow image. What you could double check is that your ftf containts also the bootloader.
[Xperia Z5 Android Development] tobias.waldvogel:
As the fido keys are reporting an error it seems that you did not produce the dk.ftf from your TA backup so far. If you have a TA backup you should flash your device key as explained in the first post.

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] williamgrant:
Yes, the "Yes" is equal "Igen" in hungarian language. :) Thanks for your reply!
[Xperia Z5 Android Development] devilmaycry2020:
@tobias.waldvogel

Hi . Is it tool make rooted kernel with init.d support ? I tested with Universal int.d app and i saw init.d folder created in system/etc but Universal int.d app said that my kernel don't support int.d . Why ? Please help. Thanks.
[Xperia Z5 Android Development] tobias.waldvogel:
In system less mode SuperSU does not use /system/etc/init.d, but a folder below /su. Anyway my installer does not use the /su overlay in order to be more secure. For this you should build an image without SuperSU and then install it via TWRP. May be you need to create a link from /system/etc/init.d pointing to /su/etc/init.d

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] devilmaycry2020:
Thanks. My phone still running 5.1.1 so rooted kernel didn't have supersu integrated, I can copy script files to system/etc/init.d but I didn't know if it work or not
[Xperia Z5 Android Development] Raskaipika:
Hi, I'm newbie!!

Hi guys, first of all thanks to

tobias.waldvogel

for this fantastic job.

Info:

Well, I'm newbie in the android and XPERIA Z5 scenes because I've an Iphone and a good friend gaves me his XPERIA Z5 for take a look to the root process and other things, for the moment, I tell you the things that I've done and where I'm now.

1. Install all the required software and drivers.

2. Downgrade the firmware to an old version.

3. Make a backup of the TA Partition with iovyroot 0.4

4. Unlock the bootloader with Flashtool

5. Upgrade the firmware to the last version available for my country (Spain), this is the generic version because the smartphone is free.

Until here everything seems to work properly, I've used this fantastic tutorials for noobs made by _LLJY (thanks mate), I've done everything except the step about to flash the kernel.

Problems with this tutorial / scripts (remember, I'm newbie in this scene):

1. About the kernel boot image, I obtained the last firmware available for this Z5 (E6653) with XPerifirm and flashtool, I followed the method1, open the TFT file with 7zip and extract the kernel.sin file and then extract from the kernel.sin the kernel.elf file with flashtool.

Now I've the kernel.elf but I don't know what I've to do with this file in this tutorial (remember, noob).

2. About the TA Partition backup made with iovyroot 0.4, I don't know what I've to do with the TA.img file because in this tutorial, the auyhor talks about DK.tft but I don't have that file or I've to do something more.

3. Other thing is how to execute the scripts of this tutorial/tool, I've copied to a new folder with the files of this tutorial/tool the next files from the andoid sdk platform tools directory:

adb.exe, AdbWinApi.dll and fastboot.exe

Is this correct???

Thank you so much for your help and patience and sorry for my english, is not my native language.
[Xperia Z5 Android Development] Learnincurve:
Noob to E6553 (ivy): how to flash

Hi,

First off, thanks for the fastastic work, it looks like this kernel fix will install everything I need. I'd really like to try it, especially in light of the encrypted bootloader that SONY is now pushing with OTA updates.

So far, I flashed 32.1.A.1.185 using flashtool and the rootable kernel by moonbutt74. I was going to flash TWRP manually when I found the link to this thread.

If I understand right, the scripts patch the "existing" kernel image with root/TWRP and some other enhancements, then re-flash to the kernel partition. What I don't understand is if this will only work from the stock 32.1.A.1.185 kernel, or if it's okay to start from moonbutt74's rootable 32.1.A.1.163-based kernel.

I did try extracting the kernel.sin file from my 32.1.A.1.185 .ftf and converting to kernel.elf using flashtool, then, from Linux:

FlashTool$ rootkernel_V4.41_Windows_Linux/rootkernel.sh kernel.elf boot-patched.img

but get:

kernel.elf: kernel.elf: cannot execute binary file

I lost my DRM keys when unlocking the phone, but do see two .ta files in my .flashTool registeredDevices directory. Is there any way to test the device against these (without bricking if they're wrong). The file-dates suggest they are for the right device, but I have flashed some fw to another E6553 in the meantime, so don't want to risk anything.

Sorry for noobish questions.

BR.
[Xperia Z5 Android Development] Raskaipika:
It's me again

Hi again guys.

1. Thanks to the last post of Learnincurve I've been able to make the kernel.img with the next command in Windows (of course, being in the repack folder):

rootkernel kernel.elf kernel.img

The kernel.elf file has a size of 29.6 MB but the new file generated by rootkernel (kernel.img) has a size of 22.2 MB, is this normal????

Other strange thing for me is that when I connect the Xperia Z5 in fastboot mode (blue light) and execute the commands:

fastboot boot kernel.img or fastboot flash kernel.img in the CMD only appears the next message:

Waiting for any device and nothing happens

I've been waiting for 5 minutes but nothing happens, I don't know if this is because of I've made something wrong creating the kernel.img file or the sintaxis of the commands is incorrect, can you answer me please????

2. Talking about the DK.ftf file, I've copied the TA.img file created by iovyroot 0.4 ( 2 MB file) into the repack folder and maked the DK.ftf file with the next command:

flash_dk <TA.img> DK.ftf

but the file generated has a size of 47 bytes, not like tobias.waldvogel said (500 bytes), Is this normal????

I hope that you can help me guys, I know that these are noob questions, but I'm noob in Android and Z5 scenes, thanks for your help people.
[Xperia Z5 Android Development] tobias.waldvogel:
I do not recommend to mix kernel and android images of different versions.

Sounds strange. I'm currently in Malaysia on holidays and can't reproduce it. But you can try to run it directly with bash. I.e. bash rootkernel.sh ......

Forget about this. The device key unit is blocked in the S1 protocol. Flashtool can't extract the device key. I'm afraid your key is lost (same as mine). Nevertheless most things will work even without.

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] tobias.waldvogel:
We had this question already several times: yes

Problably you don't have the drivers for fastboot mode installed. Look in Windows device manager for unkown devices.

47 bytes sounds too small. If you open this ftf file as zip, which files do you have inside?

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] Learnincurve:
Thanks for your reply. I should mention that when I say "running from Linux" I mean that I'm executing the commands from the bash shell on my Linux desktop. Not inside the android shell.

Enjoy your holiday! I'll be away for a few days myself first half of next week, but would be very happy if we could sort it out when we're both back.
[Xperia Z5 Android Development] Raskaipika:
Thanks for your answers, welll, about the fastboot mode drivers, in the device manager (Windows 7 x64 SP1) ther is nothing without the correct driver and if I connect the Z5 in fastboot mode the PC recognizes the smartphone like "S1Boot Fastboot" and appears like Sony ADB Interface in device manager.

About the dk.ftf file, if I try to open the file (47 bytes), winrar and 7zip tell me that they can't open the file.

I've checked the flash_dk.cmd with notepad ++ and ther is a reference to the flash_dk.sh file (for Linux I think), is this correct or not??

Thanks agin for your excellent job and help, regards.
[Xperia Z5 Android Development] tobias.waldvogel:
flash_dk.cmd calls flash_dk.sh with busybox, in order to be able to use the same script on Windows and Linux.

You could paste the output of the following command in order to figure out what's happening:

busybox ash -x flash_dk.sh <ta_image> dk.ftf

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] Raskaipika:
I've used your last posted command and the result is the same, 47 bytes file that can't be open by any compressor/decompressor program, I've opened the file with notepad ++ and shows this:

Usage: flash_dk <ta image backup> <flash file>

(My TA partition file name is TA.img)

I don't know but I think that this isn't normal but you're the expert hehehehe, and talking about the fastboot mode drivers, is correct all the information posted by me in my last post???, maybe I've to use other drivers????

P.S.: Thi is the text showed by CMD executing your last recommended command

+ TA_IMAGE=

+ FTF=

+ BOOTIMG=./bootimg

+ which ls

+ [ ls == ls ]

+ BB=./busybox

+ TMP_DIR=dk_tmp

+ [ -z ]

+ ui_print Usage: flash_dk <ta image backup> <flash file>

+ perform echo -n -e Usage: flash_dk <ta image backup> <flash file>\n

+ [ ! -z ./busybox ]

+ ./busybox echo -n -e Usage: flash_dk <ta image backup> <flash file>\n

+ exit 1
[Xperia Z5 Android Development] tobias.waldvogel:
Which command did you ran exactly? It sounds like you typed something with ">". Just in case, <name> just means it is not a literal and should be replaced with your actual name. So the command is e.g.

flash_dk taimage.img dk.ftf

Regarding fastboot: if the led is blue then your phone is in fastboot mode. If the fastboot command does not detect your phone then probably you have the wrong driver.

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] Raskaipika:
You're right, I'm idiot because I typed the TA file name with the <> symbols, without them, everything is correct, file

a size of 567 bytes.

About the the process to flash the kernel.img file generated (from the kernel.elf file), I've turned on the usb debugging option in the phone (again, I'm idiot hehehe) but the result is the same, I will test to uninstall the fastboot mode drivers installed and reinstall the correct, which is the best way to make this task???

Thanks again for your help mate, not everybody has the enough patience with the noobs of the scene.
[Xperia Z5 Android Development] Learnincurve:
Solved patching issue not able to execute elf.

The isssue must have had something to do with my elf interpreter on my office machine, becuase it went fine from home. I now have two boot images: one with and one without RIC.

At the moment, the phone has TWRP installed to the recovery partition (at least that's where I flashed it with fastboot and the DRM fix and SuperSu are flashed from TWRP (presumably to system). Kernel is "[Rootable Kernel SXZ3+ IVY/IVY_DSDS Marshsmellow ] [32.1.A.1.163] By moonbutt74..

Do I need to clean up or reinstall any of this before flashing the patched kernel with everything built in?

BR.
[Xperia Z5 Android Development] Raskaipika:
Hi again mate, finally the job is done, I flashed the smartphone with the kernel.img and with the DRM Keys, the problem with the process to flash the kernel was a driver conflict but now everything works like a charm.

To check that the DRM Keys are working, I go to service menu and in Security tab only Marlin, Widevine and CKB have the "KEY OK Active", the rest have nothing about key or active status, is this normal???

Other thing, is it recomendable to make a new DRM Keys backup now???

Thanks mate.
[Xperia Z5 Android Development] VBBoston:
Unfortunately I had my phone rooted long before this thread and do not have TA backed up. What are the consequences of it, what does not work on the phone because of it? Can anything be done at this point? Thank you
[Xperia Z5 Android Development] RyTekk:
Still got FIDO Key: Not provisioned, SUNTORY error even I flashed DK.ftf, device E6683.
[Xperia Z5 Android Development] tobias.waldvogel:
That sounds like my current library is not loaded. Could it be that you installed my old drmfix from another thread before?

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] tobias.waldvogel:
Yes, it is.

I would be very curious to learn how you can back up the DRM keys [emoji6]

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] RyTekk:
I'm using zach's kernel and he told me that he has implemented your drmfix. So what should I do now? AFAIK drmfix does restore MARLIN, WIDEVINE and CKB keys, right? TA backup to create a ftf to restore FIDO key (?).
[Xperia Z5 Android Development] tobias.waldvogel:
My drmfix library looks first for the key which you extracted from the TA backup. If it is not there then it has another fallback function to restore at least everything, which is based on credentials. So it sounds like you have an old version. Just for curiosity, why do you prefer a different kernel? Don't get me wrong, you can use whatever you want, I'm just curious. The vendor does a lot of testing, so usually the stock kernel is the most stable you can get.

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] RyTekk:
ATM Zach's kernel is the only thing that makes me to unlock bootloader, I'm not a kind of modify person so UB to get root is meannessless for me. According to you so that my phone will get FIDO key provisioned if I use the kernel which is created from your tool right? But I see you mentioned about "old version", so what version does use new one?
[Xperia Z5 Android Development] tobias.waldvogel:
Well, this script always uses the newest version, as I am the author of the drm fix. I have no idea what zach modified in his boot image. Nevertheless if you use this script with your boot image and you say "y" for drmfix it should overwrite the old version delivered with this bootimage.

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] RyTekk:
Do you mean that I use your tool with zach's kernel? I intended to do it but I'm afraid it won't work, if you said so then I would give it a try.
[Xperia Z5 Android Development] tobias.waldvogel:
It should, if you say only yes to the drmfix and no to everything else

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] RyTekk:
Thank you so much, FIDO key is provisioned now, I have to reflash SuperSU since the new boot image broke the systemless root, not important. Btw, [MENTION=3037651]zacharias.maladroit[/MENTION], I tag you to let you know about the update of new drmfix, hope you would implement it in new kernel as well.
[Xperia Z5 Android Development] zacharias.maladroit:
Link to uploaded boot.img please :)

Otherwise: if it's personalized boot.img with DRM keys in ramdisk, I won't do those,

can't build individual kernels for everyone out there ...
[Xperia Z5 Android Development] tobias.waldvogel:
My library is now reading the extracted device key from an alternative TA unit rather than a file. Precisely in order to avoid to have a different image for everyone. I changed that approx. one month ago ;)

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] zacharias.maladroit:
Fine work !

How does this express itself in the ramdisk ?

Previously we used a dmverity file, and now it's a script ?

I've taken a quick glance at the extracted contents of your zip-file but didn't see anything related,

I'm maybe distracted too much by the other work I'm currently doing to see it :confused:

Thanks
[Xperia Z5 Android Development] tobias.waldvogel:
The relevant part is in the function add_drmfix of the script rootkernel.sh

Gesendet von meinem E6683 mit Tapatalk
[Xperia Z5 Android Development] RyTekk:
I mean in next updates, not the present. If you're too lazy to update, I would do it myself :laugh: