yashsingh1/xdaforums huggingface dataset:
[Xperia Z5 Android Development] mingkee:
Actually, is there any manual method to do same procedure?
[Xperia Z5 Android Development] alexebodno:
freeze at xperia logo . . .

hi and thanks for your great tool .

i have use this for my xperia z5 E6633 android 7.1.1 .

i said Y to all options (not to sony IRC and dm verity) included busybox , twrp , dm , kcal and superuser and permisive .

i have downloaded my rom from xperifirm(customized SA 32.4.A.0.160).

i unlocked bootloader from flashtool .

but after fallowing steps , my phone freeze at xperia logo . whta can i do to restore DRM keys ?

--------------------------------------------

EDIT 1 : i tried this options and my phone isn't freezing now ; but i want android 7.1.1 :D

all options in creating boot.img -> Y

android : 32.2.A.5.11(customized MEA , unlocked bootloader)

--------------------------------------------

EDIT 1.5 : in android 6 (32.2.A.5.11) , xreality and . . . dosn't work , why ? :|

--------------------------------------------

EDIT 1.5.5 : in android 6 (32.2.A.5.11) , after installing xposed (from TWRP) and working with it , xreality and . . . working correctly , BUT I STILL WAN'T ANDROID 7.1.1 :( (thanks again for your great tool :D)

--------------------------------------------

EDIT 2 : i have a noob question :) if i update my phone from android 6 (32.2.A.5.11) with all options (ric and dm and ...) Y , my drm keys still correct ? i mean , if i update my android (OTA) ,xreality and . . . still working ?

--------------------------------------------

EDIT 2.5 : after successfully downloading update from software update app (OTA) , i touched the install now button and my phone restarts and in the app , i had this error :"could not install" . . .

now what can i do ?

--------------------------------------------

EDIT 3 : NOW I HAVE ANDROID 7.1.1 :D

i don't know how , but i flash android 7.1.1(32.4.A.0.160 Customized SA) with flashtool and use that tool for DRM , and my phone isn't freezing now ; but i can't go to TWRP . can anyone help me ? :)

--------------------------------------------

EDIT 3.5 : EVERYTHING IS GOOD :D

all of my problems have been solved , bu flashing an image of TWRP after EDIT 3

THANKS A LOT for this VERY GREAT tool .
[Xperia Z5 Android Development] toadjaune:
TWRP for 32.4.A.0.160

Hi everybody !

So, I just got a Xperia Z5 Compact, and want to flash it with a Nougat ROM, rooted and with TWRP.

Thanks to this tool, I could without any issue build and flash the following combinations :

- Sony official image build number 32.2.A.5.11 (Android 6.1.1), with SuperSu and TWRP added.

- Sony official image build number 32.4.A.0.160 (Android 7.1.1), with SuperSu but without TWRP.

When I try to build the root image corresponding to the second build, instead of the choice to include TWRP, I have the following error message :

- Skipping TWRP recovery. No kernel modules for 3.10.84-perf-g5e25a09 available

So, after reading the source code (line 503 of the rootkernel.sh script, sorry, I'm not allowed to post github links yet), and from what I understand, we need to add kernel modules for this specific kernel version in the `Android/twrp_common_kmodules` directory.

This is where my knowledge of Android and TWRP ends. I have no idea what these modules are used for, nor how to build/find them.

However, if somebody can point me out any resource explaining it, I'd be glad to try and learn it :)
[Xperia Z5 Android Development] Klaus N.:
This one may help you out: https://xdaforums.com/showpost.php?p=69869590&postcount=1484
[Xperia Z5 Android Development] toadjaune:
Thanks for this, I was really sceptical about just copying the modules and hoping that the ABI would just be compatible, but it ended up working, and so far everything seems fine.

I did propose a PR to include this change, but I'm still really sceptical about this approach.

Anyway, it works for me, so thanks again !
[Xperia Z5 Android Development] mceyhan4:
may i excract the modified kernel from the new created boot.img file ?
[Xperia Z5 Android Development] ytheekshana:
You dont need to extract........

boot.img is the kernel.

Flash it directly with flashtool
[Xperia Z5 Android Development] mceyhan4:
i've just wanted to immerse the modified kernel to the ftf file. so , i will be flash the rom and kernel in the same time. is it possible ?
[Xperia Z5 Android Development] ytheekshana:
No need. First flash the original ftf, then flash the kernel. Thats it
[Xperia Z5 Android Development] sheraro:
used 5.23 on latest E5823_32.4.A.1.54 firmware of Z5 compact :

Skipping TWRP recovery. No kernel modules for 3.10.84-perf-g99119bc available

-> kernel.elf in zip attached
[Xperia Z5 Android Development] riedenthied:
Did you read post #2735? It was not written years ago...
[Xperia Z5 Android Development] sheraro:
Followed the method you linked before asking :

boot.img with all 'Y' (choosed superuser instead of SuperSu) and folder created for missing modules and the results are :

- working twrp

- NO root -> tried to flash superuser.zip with twrp after that -> root OK but twrp didn't work afterwards (superuser.zip installation detected some problems in recovery and recreated boot.img!)

even if I flash a boot.img without root in the first place then flash superuser.zip after that, the result is the same -> root working and recovery broken

Perhapes that the manual changes done in the post you linked are not so great thus I gave my kernel.elf if it can help
[Xperia Z5 Android Development] dermaze:
There is a better method to get the appropriate kernel modules for every version by extracting it from the system.sin of each android version as described in this post.

I created my boot.img for 32.4.A.1.54 on z5c with the following options, using superuser.zip (meaning you'll need this app, not SuperSU, for root), TWRP 3.0.2-0 included:

Rootkernel V5.23

- Unpacking kernel
Found elf boot image
Kernel version: 3.10.84-perf-gda8446f
Found appended DTB
- Detected vendor: somc (Sony), device: suzuran (Xperia Z5 compact), variant: row
- Unpacking initramfs
- Detected platform: 64-bit
- Detected Android version: 7.0
- dm-verity is enabled. Disable? (Say yes if you modify /system) [Y/n] y
Disabling dm-verity
- Sony RIC is enabled. Disable? [Y/n] y
Disabling Sony RIC
- Install TWRP recovery? [Y/n] y
Installing TWRP
Compressing TWRP image
- Install kcal kernel module? [Y/n] n
- Found superuser.zip. Install? [Y/n] y
# Make su permissive (Permits any action as su)? [Y/n] y
Adding service entry for superuser
Adjusting SE Linux policy for superuser
- Install DRM fix? [Y/n] y
- Install busybox? [Y/n] y
- Creating new initramfs
- Creating boot image
- Cleaning up
Done

But here comes the bad part: It seems that rootkernel does not work with .1.54 any more. The only thing I got was a bootloop, entering TWRP at the second boot. I tried many different configurations (answering no to some of the options), but always the same result.

So if anyone has a working method or might probably know what I did wrong, please tell me. :)

EDIT: Problem was in front of the keyboard, not with rootkernel script - see post #2750.
[Xperia Z5 Android Development] sheraro:
in the logs you have "Detected Android version: 7.0" , are you sure you are using .1.54 kernel (7.1.1) ?

I'll try to extract the kos with the methode you posted and let you know if it worked ! thanks
[Xperia Z5 Android Development] dermaze:
Yes, I'm sure I had the right system.sin extracted etc.
[Xperia Z5 Android Development] sheraro:
I made a boot.img with the latest modules from the latest firmware E5823_32.4.A.1.54_1299-1743_R5E.ftf (customised FR)

it has all options 'Y' and no root :

- right after flashing and before booting the phone, go to twrp (vol+) and flash phh's superuser.zip, you'll notice some errors like in the image attached and a message telling that a new boot.img was flashed but don't worry, twrp will remain untouched

- reboot

- now you have root with twrp on 7.1.1

I flashed xposed 88.1 and it's working great

the only probleme I have with phh's superuser is that some apps doesn't detect its root methode like FolderMount, I don't want to use SuperSu because I found somewhere that its a ressource hogging app but I hope someone will prove me wrong ...
[Xperia Z5 Android Development] dermaze:
Thanks for sharing, I'll give it a try.

By the way, did the rootkernel log also show "Android version: 7.0" in your case?
[Xperia Z5 Android Development] sheraro:
NOP it shows 7.1.1
[Xperia Z5 Android Development] dermaze:
Oh boy, how stupid of me - when trying again today, I realized that I had extracted the right kernel.elf, but not copied it over to my rootkernel working directory. So an old kernel.elf was used.

Now everything worked fine, and I incorporated the superuser.zip directly. Here's my boot.img.

Used configuration:

Rootkernel V5.23

- Unpacking kernel
Found elf boot image
Kernel version: 3.10.84-perf-g99119bc
Found appended DTB
- Detected vendor: somc (Sony), device: suzuran (Xperia Z5 compact), variant: row
- Unpacking initramfs
- Detected platform: 64-bit
- Detected Android version: 7.1.1
- dm-verity is enabled. Disable? (Say yes if you modify /system) [Y/n] y
Disabling dm-verity
- Sony RIC is enabled. Disable? [Y/n] y
Disabling Sony RIC
- Install TWRP recovery? [Y/n] y
Installing TWRP
Compressing TWRP image
- Found superuser.zip. Install? [Y/n] y
# Make su permissive (Permits any action as su)? [Y/n] y
Adding service entry for superuser
Adjusting SE Linux policy for superuser
- Install DRM fix? [Y/n] y
- Install busybox? [Y/n] y
- Creating new initramfs
- Creating boot image
- Cleaning up
Done

TWRP 3.0.2 and root are functional, no problems detected so far.
[Xperia Z5 Android Development] sheraro:
did you add the ko modules from 32.4.A.1.54 ?

why you didn't have the choice of kcal option in the configuration ??

I made a boot.img with the same configuration + no_kcal + latest modules but the boot.img resulting have a different size from yours !
[Xperia Z5 Android Development] dermaze:
Yes, the modules are in place.

But it's an interesting question, why I didn't have the option for kcal, that's true. Although I am not using it normally.

My ftf was the localized_DE variant, but I'm not sure whether that would result in a different boot.img size. I would guess it is the included superuser.zip.
[Xperia Z5 Android Development] YasuHamed:
i have Z5p and after flashing kernel with NOTWRP no SUPERSU

i flashed recovery via adb, twrp3.1.1

booted in to recovery,

flashed magisk

wiped cache and

reboot in to system...

https://xdaforums.com/z5-premium/de...883-32-4-1-t3686024/post74091218#post74091218
[Xperia Z5 Android Development] sheraro:
I found why you didn't have kcal choice, you must add the same folder you added to twrp_common_kmodules to \Android\kcal in rootkernel folder

I have a question : if you try to flash a zip in recovery say for exemple xposed or anything, do you have an error in the installation log (like the image I attached in post #2747 ?) also do you have any root detection problem from some apps like adaway (copying host file failed...)
[Xperia Z5 Android Development] militiaOfDeath:
Anyone who's managed to include xposed-v88.1-sdk25-arm64.zip to the boot.img with rootkernel v5.23; when trying I never get the option to include it, which is weird. All zip-files in rootkernel dir, no changes to filenames. It detects superuser.zip, but not xposed for some reason. Phone is a Z5c (E5823). Trying to update to E5823_Customized NOBA_1298-7782_32.2.A.5.11_R20C.

Update: checked the source (rootkernel.sh) and seems like it's only SDK23 that's supported as of now?
[Xperia Z5 Android Development] chinmoy32:
[MENTION=357342]tobias.waldvogel[/MENTION]

Thank you for your work , I really appreciate it...

I was wondering is it possible to integrate latest TWRP v 3.1.1-0 to your script like the TWRP v3.0.2-0 is integrated now.

It would be great if you could do that in your next version of the tool or tell me how to extract the necessary files from the official TWRP v3.1.1-0.img and replace the stock files with the new ones in which directory of your tool.

Thanks in advance and looking forward to your reply
[Xperia Z5 Android Development] YasuHamed:
- latest twrp

- magisk support

- xz support plz

- munjini's ToC suport in case TA.IMG to be used instead of drm fix

- SOMETHING to be done for XZP , now sony is no longer storing drm keys those parititions where it used to be so the xzp kernel can never have drmfix.

---------- Post added at 10:48 PM ---------- Previous post was at 10:46 PM ----------

can't you flash it using twrp?

I tried installing xposed using magisk (the same version) but it failed.

so my guess this particular version / architecture isn't supported :(
[Xperia Z5 Android Development] militiaOfDeath:
I had the impression that you need to include it in the kernel for it to work, but I'm no expert in this, so might be.
[Xperia Z5 Android Development] YasuHamed:
on the contrary when xposed is install on Android, it will ask you to install (further) , once you click yes it will reboot your device , patch it in kernel. but if the correct architecture / version isn't found, it will fail.
[Xperia Z5 Android Development] militiaOfDeath:
Makes sense, when you put it like that. I'll probably try within the next week or so, just need to make a full backup just in case things doesn't go as expected and I need to go back the 6.x version I'm on.
[Xperia Z5 Android Development] tuanck2004:
I can't download the new FW because XF 'ERROR: Invalid update information received' can anyone help me - tks
[Xperia Z5 Android Development] Berni-0815:
Are you trying this by using the flashtool and the integrated xperifirm tool? Then it has to work fine...
[Xperia Z5 Android Development] tuanck2004:
yes, it has XF :( but XF only a line: ERROR: Invalid update information received'

so, can you try on your flashtool 1 again ... and result? pleaze
[Xperia Z5 Android Development] militiaOfDeath:
Download newest XF. Had the same error myself before using 5.1.
[Xperia Z5 Android Development] Berni-0815:
Yes, that's it... A few days ago the elder version's still working...
[Xperia Z5 Android Development] mamad_avril:
ok, here is the thing

im using F3212 Xperia XA Ultra and Stock ROM Noghut 7.0

this is my RootKernel containing Folder :

after a few seconds Rootkernel freeze Forever! Here :

please tell me what to Do, i really need that DRM features gets back asap!
[Xperia Z5 Android Development] tuanck2004:
today, XF has worked fine, but Win 10 Fall Creator don't reconize my e6883 :crying:

anyone help me!

---

its solved:

- re-install 'adb driver' by '15 seconds ADB Installer v1.4.3'

- re-install Sony driver
[Xperia Z5 Android Development] YasuHamed:
Sony Xperia XA Ultra ( F3211/F3212/F3215/F3216 & F3213 ) are on Mediatek MT6755 Helio P10

this script works ONLY on Qualcom snapdragon devices

the script will freeze and produced boot.img (if any) may brick your phone.
[Xperia Z5 Android Development] alex.do:
will this still work on the latest update of XZ? Android O?
[Xperia Z5 Android Development] juanpirulo:
hi, i tried on last xz oreo fimware with no luck, i wonder if someone can check what is wrong. I attached the kernel and the error on console. cheers

wonder if [MENTION=3989065]serajr[/MENTION] ot [MENTION=357342]tobias.waldvogel[/MENTION] could have a look at this.
[Xperia Z5 Android Development] korom42:
XZ premium already achieved root with drm fix on oreo .. take a look here

Maybe this can help
[Xperia Z5 Android Development] Infy_AsiX:
AOSP N function

Has anyone else tried or managed to get the DRM fix working on a AOSP N kernel? I'm trying to get it working on a Z3C because I found when using Elitekernel stock MM which has the libdrmfix.so method, the camera can be TWRP Nandroid restored across devices. As far as I've read a lot of Xperia cameras go black if restored to another device. Being able to restore a backup to another device is time saving and very convenient in the case of a broken device. I use two Z3Cs so I'm able to test a difference immediately.

Rootkernel tool gets stuck before detecting N, after detecting 32-bit for the LOS14.1 kernel I'm trying. At the moment I'm trying to copy and edit the changes made to a stock MM kernel to the LOS14.1 kernel ramdisk without success.

Alternatively I've tried Munjeni's TA PoC method but that doesn't stop the camera going black after a restore device change, even with separate TA-PoC modded images for each. I also tested TA-PoC on stock MM to find it doesn't work on Z3C.

EDIT: It seems I've found a simple solution for AOSP. Deleting the /data/credmgr files in recovery got the camera working again easily across devices. I guess that's a little benefit of AOSP ROMs.
[Xperia Z5 Android Development] YasuHamed:
brother [MENTION=3989065]serajr[/MENTION]

xz has got oreo now, is there anything can be done by you to add support for kernel 4.4 ?

I tried but the script hangs at "Detected Oreo... line"

now seriously worried about update to oreo and having root access on XZ and soon to be on X

i have been heavily using your script

---------- Post added at 07:19 AM ---------- Previous post was at 06:59 AM ----------

Good day Sir [MENTION=357342]tobias.waldvogel[/MENTION]

could you please add support for oreo kernels ? plz

---------- Post added at 07:19 AM ---------- Previous post was at 07:19 AM ----------

Good day Sir [MENTION=357342]tobias.waldvogel[/MENTION]

could you please add support for oreo kernels ? plz
[Xperia Z5 Android Development] serajr:
I think so, just gimme some few days! Got oreo update this morning on my x performance!

Stay tuned!
[Xperia Z5 Android Development] juanpirulo:
now fstab.qcom is not in kernel is in root directory. As i compare from previus nougat fstab.qcom system and user data is diferent.

Nougat

/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1,discard wait,verify

/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,forceencrypt=footer,resize

oreo

#/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1,discard wait

/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,noatime,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer

Hope this can help you and save you time. cheers

could this mean that dm verity is disable allready and the forceencrypt ?
[Xperia Z5 Android Development] fmauNeko:
Actually this is the system partition's fstab, which means /system is already mounted (and verified), and /data still has forceencrypt, at least on my own ftf.

The ramdisk fstab.qcom is now hidden in the kernel's dtb part, which bootimg already knows how to extract. If you're looking at how to patch it, Magisk's zip already knows how to do it, it may be helpful.
[Xperia Z5 Android Development] juanpirulo:
you know how to extract fstab.qcom from dtb part? i cant find any tutorial about this. cheers
[Xperia Z5 Android Development] fmauNeko:
Kinda hard. This is how Magisk does it https://github.com/topjohnwu/Magisk/blob/master/jni/magiskboot/dtb.c#L63
[Xperia Z5 Android Development] tge101:
You're trying to (or have gotten) stock camera working on Lineage based ROMs? Is that correct?
[Xperia Z5 Android Development] Infy_AsiX:
Got it working again after a TWRP restore where it normally turns permanently black.

edit: I mean to another device, like a replacement
[Xperia Z5 Android Development] tge101:
With the stock quality too??
[Xperia Z5 Android Development] devilmaycry2020:
Why DK.ftf is so small size ? just 567 bytes . So is it ok?

And what wrong in this command below ?

C:\rootkernel_v4.2>rootkernel.cmd kernel.elf rootedkernel.img TA-12042016.img
- Unpacking kernel
Found elf boot image
- Unpacking initramfs
- 64-bit platfrom detected
- Disabling dm-verity
- Disabling SONY RIC
- Installing TWRP
- Found SuperSU_2.71.zip
Adding service entry for SuperSU
source type fsck does not exist
Could not add rule for perm: dac_override
source type fsck does not exist
Could not add rule for perm: write
source type fsck does not exist
Could not add rule for perm: create
- Configuring keyprovd
- Configuring secd
- Configuring wvkbd
- Configuring drmserver
- Creating new initramfs
- Creating boot image
- Cleaning up
Done

C:\rootkernel_v4.2>

---------- Post added at 09:15 PM ---------- Previous post was at 08:44 PM ----------

So that's mean after use tobias method restore TA the phone still unlocked bootloader state. Right ? SO one word. no root on locked bootloader at all. if we want root and DRM function working we have to leave our phone unlocked bootloader.
[Xperia Z5 Android Development] tobias.waldvogel:
Yes, the key is just 16 bytes in size, but as it is in ascii and some metadata it gets 567 bytes.
[Xperia Z5 Android Development] tobias.waldvogel:
I have to admit that I did not perform that much tests on Linux. I will have a look
[Xperia Z5 Android Development] rolo143:
I've installed rootkernel v4.0

If I want to update to latest version what do I do? I already have the kernel.elf file from the firmware I'm using. Do I have to follow the same steps? I just create an img file using the tool and I flash the kernel again?

If I reflash the kernel will I lose root? I also have SuperSu and Xposed framework installed, do I have to delete them before flashing the kernel again?

Sorry if I ask to many questions, hope you can help.

Thanks
[Xperia Z5 Android Development] anjelz2012:
You can perform the same procedure to restore a key drm kernel modified?
[Xperia Z5 Android Development] yannik~:
Hi [MENTION=357342]tobias.waldvogel[/MENTION], you wrote that you would provide sources for your bootimg tool in the OP, where can I find those?

Thanks in advance

Edit: Found it: http://xdaforums.com/showpost.php?p=65931376&postcount=52

Is this the up to date version or is there a newer one? Maybe you could put it on github, that would be great!
[Xperia Z5 Android Development] tobias.waldvogel:
I updated the Linux binary in version 4.21. This is the only change in this version.

Some background:

I'm developing my bootimg in VisualStudio and have a post step to compile it with the Android NDK for ARM as well. For the Linux version I also just use the Android NDK, as the x86 toolchain is also included. Therefore it is compiled using bionic libc. The problem was in the filetime conversion routine, which throws an error if the time zone data is not available. As a dirty fix I'm just not setting the file times insde the ftf on Linux. They are not needed anyway.
[Xperia Z5 Android Development] tobias.waldvogel:
Here you go. I had to rework that a lot of times to make it suitable.

In order to compile it you need to adjust the paths in global.props in to point to you Android NDK.

Although I'm not quite sure why you want to recompile yourself. There is already a Windows, X86 Linux and Arm version included ;)
[Xperia Z5 Android Development] tobias.waldvogel:
Xposed is not affected (installed in /system, not the initfs) and SuperSU will be included automatically if you place the SuperSU*.zip into the same directy
[Xperia Z5 Android Development] devilmaycry2020:
Thanks, I'm using Z5 e6683 LL. 152 firmware, so I have to flash supersu separately after flash rootedkernel? Do I have to add TA image into rooted kernel or not,
[Xperia Z5 Android Development] tongnt:
I have no luck booting to recovery. Reboot phone yellow/orange led light up, press volume up and hold, only sony splash screen and auto reboot loop. Reboot again, wait for yellow light up and keep pressing volume up continuously also boot loop with Sony splash screen. I dunno if it just me or something wrong with my z5p.

Can someone have a offhand link me to how to flash other region mm firmware using flashtool and which option needed to tick or untick please, so to try this tool fresh? I dont want to hard brick it. Thank you so much.
[Xperia Z5 Android Development] Soheil_rf:
Repacked my kernel (E6633- 185) with V4.2, everything works well

Thanks