yashsingh1/xdaforums huggingface dataset:
[Xperia Z5 Android Development] Beast14:
Hi

I posted for help on post #219 and you never replied Tobias.

I have discovered and can confirm from my post #219 that the latest stable supersu 2.65 will not work properly with E6683 DUAL. I had to download and flash supersu latest BETA version 2.71, then when i tried to use root again, this time it actually detected it on flashtool and said root ALLOWED, whereas previously it said root DENIED yet some functions of root worked on the phone.

I can also confirm that root didnt work properly with 'system app remover (root)', but after flashing superSU v2.71 it all worked like a charm.

I just wanted to let people know that always the latest BETA version of superSU should be installed.

My questions are:

- what version of SuperSU is installed in your script v4.22 ??

Because i have currently used your 4.0 script and everything has worked well.

- I also want to know does the script v4.0 and v4.22 both restore drm keys? will x-reality and camera de-noise and all that nice stuff come back? and how do i check it? (because id like to upgrade kernel from 4.0 to 4.22)

Please can someone help??
[Xperia Z5 Android Development] tobias.waldvogel:
If you read the the very first post, then you will see that basically the changes from 4.0 to 4.22 are just a new TWRP version, the fix for Widevine and the automatic integration SuperSU. Everything else is the same. You can just generate a new kernel and then flash it, that's all. In order to save you some time and efforts SuperSU will be integrated automatically if you place it in the same directory. The filename just need to start with SuperSU. So the standard filename SuperSU<version>.zip is good.

I do have a E6683 and I used before 2.65 with installation TWRP and now with the automatic installation. In both cases no issues at all. It never occurred to me to used flashtool for this.
[Xperia Z5 Android Development] yannik~:
Hi [MENTION=357342]tobias.waldvogel[/MENTION],

I don't use Windows, so I wrote some Makefiles for this: (these are probably much more efficient than the visual studio compiler setup in your .vcxproj, as only changed files are compiled again - but with such a small project the impact is probably not very big)

libsepol/Makefile:

# Author: Yannik Sembritzki
# License: GPLv2

# dependency generation loosely based on http://make.mad-scientist.net/papers/advanced-auto-dependency-generation
CFLAGS=-I . --sysroot=$(SYSROOT)
SRCS = $(wildcard *.c)
OBJS=$(SRCS:.c=.o)
ARCH=x86
DEPS := $(SRCS:.c=.d)
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Td
POSTCOMPILE = @mv -f $*.Td $*.d
.PHONY: all clean build

all: libsepol_$(ARCH).a

libsepol_$(ARCH).a: $(OBJS)
$(AR) rcs libsepol_$(ARCH).a $(OBJS)

%.o: %.c %.d
$(CC) -c $(DEPFLAGS) $(CFLAGS) $< -o $@
$(POSTCOMPILE)

%.d: ;

clean:
rm -f *.o *.d libsepol_$(ARCH).a

-include $(DEPS)

bootimg/Makefile:

# Author: Yannik Sembritzki
# License: GPLv2

# dependency generation loosely based on http://make.mad-scientist.net/papers/advanced-auto-dependency-generation
CFLAGS=-I ../libsepol --sysroot=$(SYSROOT)
LIBS="../libsepol/libsepol_$(ARCH).a"
SRCS = $(wildcard *.c)
OBJS=$(SRCS:.c=.o)
DEPS=$(SRCS:.c=.d)
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Td
POSTCOMPILE = @mv -f $*.Td $*.d
ARCH=x86
.PHONY: all clean build

all: bootimg_$(ARCH)

bootimg_$(ARCH): $(OBJS)
$(CC) -o bootimg_$(ARCH) $(OBJS) -static $(LIBS)

%.o: %.c %.d
$(CC) -c $(DEPFLAGS) $(CFLAGS) $< -o $@
$(POSTCOMPILE)

%.d: ;

clean:
rm -f *.o *.d bootimg_$(ARCH)

-include $(DEPS)

It would be great if all this could be published on github, so contributions (like these Makefiles, which would otherwise get buried in this thread soon) would be easier. Also, the current source would always be published, otherwise, a new zipdump would be necessary for all future changes (seeing that the version already increased to 4.22, this would be very useful).

Thank you!
[Xperia Z5 Android Development] tobias.waldvogel:
But there is already a Linux binary included in order to work on Linux as well. So why on earth do you want to recompile it?
[Xperia Z5 Android Development] pw1nce:
yeah i got it , i have magisk now and root plus recovery too. but the provided drm zip is not working for me. i flashed it too. and btw if i press n to drm fix to use ta_poc so it doesnt give me any option in cmd if i wanna use ta.img with ta_poc or not, it that a bug or what?
[Xperia Z5 Android Development] serajr:
If you chose drm fix option, flashed the zip, and your device did boot up as it should, drm-fix is working (you can check it out at service menu)!

TA.img (case sensitive) must be present at rootkernel's root folder in order to enable TA PoC option.
[Xperia Z5 Android Development] pw1nce:
sorry but can you be specific about the rootkernals ''root'' folder? i mean wheres the root folder ive to put in?
[Xperia Z5 Android Development] serajr:
Pic...
[Xperia Z5 Android Development] pw1nce:
i have done exactly the same as you have mentioned in pic and when i press N for drm fix the next menu is , all done y/n when i press y in creats the bootimg without ta_poc menu..
[Xperia Z5 Android Development] serajr:
TA.img is the right name for the file. If you named it ta.img or Ta.img (or any other way), option won't show up for you!!!

I cannot help you out anymore from now on!!
[Xperia Z5 Android Development] serajr:
Rootkernel V5.23 (UNOFFICIAL 2.5) - OREO - Xperia X, X Comp., X Perf., XZ and XZs

What's new:

- Fixed bug in script that caused errors with certain kernels (X Perf, XZ and XZs) - thanks [MENTION=2718134]kodein[/MENTION]

>> Enjoy it! <<

(please, do read instructions before proceeding and patching your STOCK kernel, also, do always use the elf format as the input file)
[Xperia Z5 Android Development] casouzaj:
Thank you! I ran v2.5 using the Confidential CarbonROM 6.1 boot image from my Z3C as input, and put my TA.img in rootkernel's root folder. I ran it under Linux. Although I'm supposed to use a kernel in elf format, It took the img boot file, but it didn't create the rooted kernel. Here's the output:

bash rootkernel.sh boot_CR61_dd.img new_boot_CR61_20180113.img

Rootkernel V5.23 (UNOFFICIAL 2.5)

- Unpacking kernel
Found android boot image
Kernel version:
- Detected vendor: somc (Sony), device: aries (Xperia Z3 compact), variant: row
- Unpacking initramfs
- Detected platform: 32-bit
- Detected Android version: 8.1.0
- Found fstab.qcom (no additional files required)!
- Sony RIC is enabled. Disable? [Y/n] n
- Install DRM fix? [Y/n] n
Skipping drmfix
- Found TA.img. Install munjeni's TA PoC? [Y/n] y
Installing TA PoC
sed: -e expression #1, char 34: unterminated `s' command
Adding service entry for ua_modem_switcher
- All done! Continue? [Y/n] y
- Creating new initramfs
- Creating boot image
error: could not load device tree image 'dtb'
- Cleaning up
Done

Any known way to make it work in such a setup?
[Xperia Z5 Android Development] ondrejvaroscak:
This version from serajr is not for Z3 and others, just X family.
[Xperia Z5 Android Development] casouzaj:
Oops, I've noticed it now. Thanks!
[Xperia Z5 Android Development] serajr:
The "problem" can be the custom kernel you are using as input.

Most likely the cause might be that it does't have the tad_static service, and TA PoC option won't be able to apply the patching code on.
[Xperia Z5 Android Development] shoey63:
What are you trying to achieve? Carbon rom doesn't use DRM keys, or am I missing something?
[Xperia Z5 Android Development] casouzaj:
It was just an attempt!
[Xperia Z5 Android Development] serajr:
Bro, thanks for clarifying that!
[Xperia Z5 Android Development] casouzaj:
Not quite sure! Look at what DRM Info says for CarbonROM 6.1:
[Xperia Z5 Android Development] serajr:
Where can I find the kernel in question (or please, send it to me)?

(ai bro, vc mora pertinho aqui de casa... kkkk bora toma uma qq hora?! - é nóis)
[Xperia Z5 Android Development] casouzaj:
This kernel https://app.box.com/s/bma2ux97iadse7hwhojmvtikjepufpr4, is extracted from the ROM's zip file, and this one https://app.box.com/s/rcv26eo3gl6rah1fdpwmns5v51nilgs3 is, in theory, the same one, but pulled from my Z3C phone through a dd command.

(Opa! Rafard está a meros 75Km de Valinhos. Quando estiver por aqui, basta avisar. Abraço!)
[Xperia Z5 Android Development] serajr:
Ok bro... here is the output with your custom kernel:

E:\Android\rootkernel_v5.23_Windows_Linux_UNOFFICIAL_2.5_OREO>rootkernel boot_CR61_20180113.img boot.img

Rootkernel V5.23 (UNOFFICIAL 2.5)

- Unpacking kernel
Found android boot image
Kernel version:
- Detected vendor: somc (Sony), device: aries (Xperia Z3 compact), variant: row
- Unpacking initramfs
- Could not determine platfrom
- Detected Android version: 8.1.0
- Found fstab.qcom (no additional files required)!
- Sony RIC is enabled. Disable? [Y/n] N
- Install DRM fix? [Y/n] N
Skipping drmfix
- Found TA.img. Install munjeni's TA PoC? [Y/n] Y
Installing TA PoC
Adding service entry for ua_modem_switcher
- All done! Continue? [Y/n] Y
- Creating new initramfs
- Creating boot image
- Cleaning up
Done

E:\Android\rootkernel_v5.23_Windows_Linux_UNOFFICIAL_2.5_OREO>

Things you must do:

- Edit rootkernel.sh with notepad++, find and comment out the line as shown below (by adding #):

make_bootimg() {
ui_print "- Creating new initramfs"
"$BOOTIMG" mkinitfs $RAMDISK | perform gzip -c >newrd.gz

ui_print "- Creating boot image"
mkimg_arg="--pagesize $BOARD_PAGE_SIZE --kernel kernel --ramdisk newrd.gz --base 0x00000000 --ramdisk_offset 0x$BOARD_RAMDISK_OFFSET"
if [ ! -z $BOARD_TAGS_OFFSET ]; then
[B][COLOR="Red"]#[/COLOR][/B]mkimg_arg="$mkimg_arg --dt dtb --tags_offset 0x$BOARD_TAGS_OFFSET"
fi
"$BOOTIMG" mkimg -o "$TARGET" --cmdline "$BOARD_KERNEL_CMDLINE" $mkimg_arg
#"$BOOTIMG" mkimg -o "$TARGET" --cmdline "$BOARD_KERNEL_CMDLINE androidboot.selinux=permissive" $mkimg_arg
}

- Save and close it

- Run tool

- Before saying Y to TA PoC option, enter ramdisk folder end edit

init.camera.rc@0750

file

- look for service tad_static, and remove red line:

# SONY: TrimArea Daemon
# Last 2 args: start block(blk size 128k), number of blocks(partitionsize(kb)/128(kb))
service tad_static /sbin/tad_static /dev/block/bootdevice/by-name/TA 0,16
[B][COLOR="red"]#service tad_static /sbin/tad_static /data/credmgr/ta_part.bin 0,16[/COLOR][/B]
class trimarea
user system
group system root camera media
socket tad stream 0770 system system

- You'll get:

# SONY: TrimArea Daemon
# Last 2 args: start block(blk size 128k), number of blocks(partitionsize(kb)/128(kb))
service tad_static /sbin/tad_static /dev/block/bootdevice/by-name/TA 0,16
class trimarea
user system
group system root camera media
socket tad stream 0770 system system

- Save and close it

- Back to rootkernel cmd and finish its process

Note: I really don't know if newly created kernel (boot.img) will work, so try it out at your own risk.
[Xperia Z5 Android Development] casouzaj:
Yes, the new boot img is created by your tool, without issuing any errors, but, unfortunately, my Z3C phone doesn't boot up when flashed with it, i.e. It vibrates when the power bottom is held down for a couple of seconds, but it is kept turned off. Thanks for your efforts, anyway!
[Xperia Z5 Android Development] grapestain.m8:
Just for the record: I've tried, but it cannot decrypt the filesystem encrypted by RR Nougat. :( It asks for password, but the password is never accepted meaning incompatibility regarding encryption is still an issue between TWRP and Resurrection Remix (and probably Linage N as well) on Sony Z1.
[Xperia Z5 Android Development] dape16:
Any idea why Magisk isn't working on Z4 Tablet? Since Magisk version 13 it causes boot loop. It uses the same SOC and kernel version as Z5 series, where Magisk seems to work fine.
[Xperia Z5 Android Development] YasuHamed:
bootloop usually means dm varity is ON

please send your kernel sin and lets try the script to see weather it works o or not

btw

MAGISK v 16 is out
[Xperia Z5 Android Development] dhchris:
Hello there,

I tried this to get my own boot.img with my TA.img.

But after the first start, I have no Sim-Connection / Mobile - Connection.

What did I wrong?

Kind regards,

Chris

Edit:

I tried it many times, but it seems, this error appears only when I use the created boot.img with mit TA.img

Starting with DRM-Fix works fine.

Is there another way to flash my TA back???
[Xperia Z5 Android Development] kodein:
Kcal module

Pls add kcal for xperia xz...
[Xperia Z5 Android Development] YasuHamed:
please

1. state your device / model

2. build number

---------- Post added at 01:09 PM ---------- Previous post was at 01:06 PM ----------

until sir [MENTION=3989065]serajr[/MENTION] releases v2.6

you may consider flashing kcal via twrp

https://xdaforums.com/showpost.php?p=61919931&postcount=2
[Xperia Z5 Android Development] dape16:
I have tried Magisk v 16 also, same boot loop. I attach my kernel.sin here. I would be very happy if you could try it!

Thanks for your help!

https://drive.google.com/file/d/1x2BKNRVZViXEH5GjNwBdWoPGy0Qt8Jvf/view?usp=sharing
[Xperia Z5 Android Development] serajr:
I will never deal with such thing on my rootkernel versions (ports)!
[Xperia Z5 Android Development] dhchris:
[MENTION=5613633]YasuHamed[/MENTION],

thanks for reply, my question is obsolete. Bricked my phone by flashing the wrong TA.

I accidentally swapped the files...
[Xperia Z5 Android Development] YasuHamed:
thats a v bad news :(
[Xperia Z5 Android Development] YasuHamed:
good day sir

for the provided SGP771_kernel.sin

I have created two boot images (with and without Twrp) x 2 older scripts of z5 of older times. (v5.20script & v5.23script)

so now you have two types of FOUR kernels created with different scripts

why I did that?

I remember once i helped with friend and he was having bootloops with one of the script he used at that time. so when I used v5.20 for him, his device didn't go in to bootloops. So i request you to please try the kernel in the folder of v5.20 first.

https://mega.nz/#F!fQZWkIQR!05t8zT_6NRsEAwU1EQta-g

if you flash kernel with TWRP and manage to boot in to twrp on z4 tablet then you must flash superSU2.82 or MAGISK

if the twrp embeded kernel doesn't take you to twrp then kindly flash CLEAN version of kernel and find twrp for z4 over the xda and flash twrp via adb fastboot ( fastboot flash recovery twrp.img & enter) after flashing above kernel(s) via Flashtool.

please note that

1. I am not responsible for any damage may or may not be caused by the above kernels and / or Magisk / supersu

2. I created them based on my knowledge and good heart with rooting / flashing kernels with 6 devices I have had of Xperia over the years.

i am hoping it works for u
[Xperia Z5 Android Development] bertschwert:
Somehow got into a threadloop:

I want to backup the .ta-partition, but the thread from the link in post 1 says it's outdated (or at least needs "LP Kernel <= Dec 2015") and reading for quite a while I always end up at the outdated tools.

Can anyone tell me how to backup the DRM-keys? What are the tools working on Stock 7.1?
[Xperia Z5 Android Development] DHGE:
I can.

There are no working tools for Nougat.

You have to downgrade to Marshmallow and then start a kernel exploit.
[Xperia Z5 Android Development] serajr:
Universal (Dirtycow-based) TA Backup v2 (MM firmware and/or earlier only).
[Xperia Z5 Android Development] bertschwert:
Does that mean there is no .ta-Backup for Nougat?

Thanks!

PS: Btw nice Bathory quotation ;)
[Xperia Z5 Android Development] ondrejvaroscak:
No. You need Marshmallow firmware to backup your keys.
[Xperia Z5 Android Development] dape16:
Thank you very much for your help, that was very nice of you.

Unfortunately, when using your kernels, the touchscreen is not working. I remember I also had the same problem when using earlier versions of the script.

When I am using Root Kernel 5.23 UNOFFICIAL 2.5 script on the kernel, everything is working except that if I install Magisk it will start to boot loop after the boot animation (and led blinks red). SuperSU is working, but I would rather use Magisk so I can install the Magisk modules.

The Z4 Tablet have a lot in common with the Z5 series (same SOC and even kernel version number).

In the Z5 forums there is a thread with a custom kernel based on the latest stock which is compatible with Magisk.

https://xdaforums.com/xperia-z5/general/ftf-e66xx-patched-kernels-google-drive-t3688365

Do you know if there is a way to check if dm-verity really is off after running the Root Kernel script?

Thanks again.
[Xperia Z5 Android Development] YasuHamed:
there are no tool(s) for Nougat kernel

you must downgrade to android L or MM in order for DIRTYCOW script to extract TA.img

https://xdaforums.com/crossdevice-dev/sony/universal-dirtycow-based-ta-backup-t3514236

---------- Post added at 10:31 PM ---------- Previous post was at 10:22 PM ----------

the v5.23v2.5 script is actually more incline to assist X series and i have never created modified kernel for my z5p with v5.23v2.5, i have all the other scripts saved i will try making the same via 5.21 and with 5.22 also for you during this weekend.

Trust me! if dm varity wasn't switched of you will never boot in to system. however iam unaware of any other way to verify that (at this point).

what if you instead of flashing supersu you had flashed SUPERUSER ? https://superuser.phh.me/ , TRY r310. Magisk actually uses superuser. so what if you flash superuserR310.zip via twrp, then boot in to system and install magisk manager 5.6, once done, try flashing boot image of magisk16.zip (direct install) method. at this point superuserR310 will prompt for granting permission to magisk.

just a thought...

you may also skip magisk and flash xposed installer for your arm. since you already have supersu, install xposed.apk and see what version of xposed installer will be recomended for you x86, arm or arm64 , it will automatically flash it. xpose has more powerful tweaks.

however I always end up having damaged android beyond repair with xposed so i never play with it anymore
[Xperia Z5 Android Development] dape16:
Thanks, I tried to flash SUPERUSER but I got error message in TWRP. So for now I will continue to use SuperSU, but the Magisk Hide feature is really useful.
[Xperia Z5 Android Development] YasuHamed:
sir please explain me Magisk Hide Feature?
[Xperia Z5 Android Development] DHGE:
Some apps refuse to work on rooted devices.

"Magisk Hide" prevents that they find out.
[Xperia Z5 Android Development] YasuHamed:
flashing Android SAFETY NET , wont fix that?
[Xperia Z5 Android Development] dape16:
With Magisk Hide you can hide root from apps which normally doesn't work on rooted devices.
[Xperia Z5 Android Development] bluesky1126:
VoLTE not working anymore

After flashing kernel made by rootkernel, everything was fine except the VoLTE function, the button still appears but will not work at all.

I've tried both DRM fix and munjeni's TA PoC, none of them have it works. and I'm sure that VoLTE works fine with the stock kernel.

I'm using Sony Xperia X Performance Dual SIM (F8132) on oreo, and I really can't live my life without root. Please help me!!! Thanks a million!

P.S. When I use munjeni's TA PoC, it always stucks at the SONY logo for almost half a minute every time I boot up. Don't think it's normal, but I don't know why...
[Xperia Z5 Android Development] YasuHamed:
about VoLTE, subject needs more study...

however it was in some previous posts where [MENTION=3989065]serajr[/MENTION] did mention that at this point Munjini's POC TA method don't work properly!

i am not sure whether its been fixed in script 2.5 or not
[Xperia Z5 Android Development] bluesky1126:
Hope so... I give up the root access for now and wait if someone can fix that problem.

Life is so inconvenient without Titanium Backup and Greenify for those old devices.
[Xperia Z5 Android Development] YasuHamed:
To be honest, Its Sony who has made Life of its leftover customer bank; Difficult. My Friends are using S8, Xiaomi MiMax, Mi4 and Redmi3s, all are rooted and there is no such concept of DrmFix bla bla.

the Developers are also diverted for xperias where they are instead of building more Roms; are focused now on fixing DRM LOST KEYS.
[Xperia Z5 Android Development] bluesky1126:
Galaxy S8 indeed does not lost any DRM features by unlocking bootloader, but instead you will lost Samsung Pay forever once knox is triggered...

Anyway, I might also abandon Sony in the future, cause it has abandoned the 3.5mm headphone jack from its latest XZ2. I can't imagine that I have to bring a fragile cable with my earphone together every time, what a stupid design from Apple(or from the old Sony Ericsson). Sony's era is really over.
[Xperia Z5 Android Development] YasuHamed:
I live in a country where samsung pay is not mode (yet) so if I lost that feature I surely can live without it. however when you unlock bootloader you loose almost everything premium about sony xperia :(

ofcourse! if sony is going to follow its flagships with no headphone jacks! then BYE BYE SONY
[Xperia Z5 Android Development] nhtu1997:
When I unlocked bootloader, i have lost drmkey and i forget backup drm key . So how to fix it, I tried flash patch drm fix in this topic, but dose it not work, please help me.
[Xperia Z5 Android Development] casouzaj:
The DRM fix and tapoc features in this thread are different ways to put one's backed up DRM keys into the kernel. But, as you haven't backed your TA partition, prior to unlocking your bootloader, they won't work for you. You could try restoring the functions which are impacted by the loss of the DRM keys. Look. here: https://xdaforums.com/crossdevice-dev/sony/xperia-z1-z2-z3-series-devices-drm-t2930672

Good luck!
[Xperia Z5 Android Development] nhtu1997:
The topic for Xperia Z~Z5 but my phone is xperia X perfomance, dose it working?

Sorry my english is not well
[Xperia Z5 Android Development] jitz975:
everything works fine except VOLTE. :(

Tried both TaPoC and Drm FIX. [MENTION=3989065]serajr[/MENTION]

Thank you for rootkernel.
[Xperia Z5 Android Development] deboopi2:
Hi, now running on windows 10 and got stuck.

Extracted rootkernel.

created folder filesystem_files in extracted rootkernel folder

copied the files fstab.qcom, init.qcom.rc and init.target.rc to the filesystem_files folder (this is something I forgot about the first time I tried it)

started rootkernel kernel.elf boot.img in the rootkernel folder

got to following line

- detected android version 8.0.0

and than just stuck, nothing happens anymore

Any idea to solve this?
[Xperia Z5 Android Development] jitz975:
You didn't copy kernel.elf to rootkernel folder.

---------- Post added at 01:12 PM ---------- Previous post was at 01:07 PM ----------

Well i hate sony, back to LB stock rom and Volte is back. It won't work with root, something related to kernel or magisk (v14.5, only the one that works for XZ), no idea. Please someone take a look into Volte issue, especially [MENTION=3989065]serajr[/MENTION] please.

Thank you
[Xperia Z5 Android Development] deboopi2:
Yes, kernel.elf is in the rootkernel folder, otherwise I get the message : 'Kernel image not found'.

---------- Post added at 01:27 PM ---------- Previous post was at 01:12 PM ----------

Yes it does work on the Xperia X Performance but the procedure is a little different, look at page 280, mail 2793
[Xperia Z5 Android Development] nhtu1997:
thanks you very much, but i don't understand this "3. Run rootkernel script with Oreo stock kernel.elf (eg.: rootkernel kernel.elf boot.img) and 3. Fastboot newly created boot.img"

How do it
[Xperia Z5 Android Development] deboopi2:
The first page of this thread explains how to create the correct boot.img, read this page and also p280 in order to know how to proceed.

You have to extract kernel.sin and system.sin from the ftf file.

With flashtool you can create system.ext4 from system.sin, you can use a tool like ext2explore.exe to get the three files out of system.ext4.

You can alaso use flashtool to create kernel.elf from kernel.sin.
[Xperia Z5 Android Development] nhtu1997:
I had system.ext4. Next, how do i do that?, can you explan it for me