yashsingh1/xdaforums huggingface dataset:
[Sony Cross-Device General] munjeni:
Thats great, but not in all case, for example some roms do not have tad_block_device so problem will be making universal thing for parsing that. Idea is great realy!

Ho you got this without patching sepolicy? Relabelfrom and relabelto is required? How this is possible:

chcon u:object_r:tad_block_device:s0 /dev/block/fake-TA
[Sony Cross-Device General] x_one:
I don't use EliteKernel but.. ;)

You need remove ramdisk/vendor/lib/libdrmfix.so file and

init.target.rc have to be modified from this:

on post-fs
export LD_PRELOAD libNimsWrap.so:libdrmfix.so

to:

on post-fs
export LD_PRELOAD libNimsWrap.so
[Sony Cross-Device General] Hamidreza2010:
I try both keys ( vol up and down ) at same time but nothing changed
[Sony Cross-Device General] whalesplaho:
Same thing here... Except maybe yhu flash a fota kernel recovery!!!

---------- Post added at 04:38 PM ---------- Previous post was at 04:38 PM ----------

[MENTION=4120742]munjeni[/MENTION] will yhu update tha app so i can givea shot? Im kinda of confused.

---------- Post added at 04:41 PM ---------- Previous post was at 04:38 PM ----------

[MENTION=4120742]munjeni[/MENTION] will yhu update tha app so i can givea shot? Im kinda of confused.
[Sony Cross-Device General] munjeni:
Oh man why booth keys? Choice is only one key, not booth!

Anyway I have fixed all scripts and anlso added support for boot images with two ramdisks (only .cpio) , didn't figured out bootloop related to tobias recovery init script (in my case twrp works, fota not works and android not works), I think problem is keycheck binary since I found kernel panic "unable to write... Paging blabla) will check tommorow. Also will add auto removal for drm fix
[Sony Cross-Device General] fluffi444:
In the meantime you can use this modified scripts - credits to masters [MENTION=3989065]serajr[/MENTION] and [MENTION=4120742]munjeni[/MENTION]

Just use latest ta_poc and extract this zip in ta_poc folder overwriting the existing files. I added and DRMfix removal script.

Should work for EliteKernel and maybe other MM Kernel made with rootkernel tool of tobias.waldvogel.

Script removed!
[Sony Cross-Device General] whalesplaho:
okay... trying right away & i added code for lib64 when removing libdrmfix.so incase its a 64-bit phone just like Z5!

thank you friend... exhausted my thanks meter!:good::highfive:
[Sony Cross-Device General] munjeni:
New poc is out as per quote, tomorrow I will try to solve recovery init
[Sony Cross-Device General] whalesplaho:
but after creating a new_boot.img, i check tha ramdisk/vendor/lib/ & libdrmfix still exist?

does it supposed to be like dat?
[Sony Cross-Device General] munjeni:
Download new poc it works! Do not use any scripts other than that from poc!
[Sony Cross-Device General] fluffi444:
But the main important thing is that that the loading of libdrmfix.so in init.target.rc is removed.

on post-fs

export LD_PRELOAD libNimsWrap.so
[Sony Cross-Device General] whalesplaho:
yeah... just downloaded new ta_poc & noticed a bug.

"found android version >= MM."

im presently on N.

---------- Post added at 10:08 PM ---------- Previous post was at 10:04 PM ----------

okay brov..... gratitude!
[Sony Cross-Device General] munjeni:
You are on N? But what this mean ( >= Marchmalow) ?

By the way is libdrmfix.so removed now from your folder with latest poc?
[Sony Cross-Device General] whalesplaho:
1. yeah its marshmallow & im on Nougat.

2. drm fix wasnt removed since no script to do dat

3. i gat freeze entering twrp..... still dnt know what its tha cause & i cant get a last_kmsg!:crying::crying:
[Sony Cross-Device General] x_one:
Tried latest over elitekernel and libdrmfix.so isn't deleted, but removed from init.target.rc
[Sony Cross-Device General] whalesplaho:
can yhu enter recovery?

power button + vol+

but it boots up fine...
[Sony Cross-Device General] x_one:
I didn't flashed it, just checked if [MENTION=4120742]munjeni[/MENTION]'s drmfix removal is working..
[Sony Cross-Device General] whalesplaho:
oksy buddy....
[Sony Cross-Device General] munjeni:
Can you post that kernel?
[Sony Cross-Device General] x_one:
Elitekernel you can find here

or you want one I've repacked?
[Sony Cross-Device General] xRevengerZee:
I told you guy's i got it to work on elite kernel without doing anything just got the boot.img from elite kernel and patched it with poc tool then flashed new boot.img and everything workin fine
[Sony Cross-Device General] fluffi444:
This is actually not the question. It's known that EliteKernel is working (with the ta_poc version before) - even without removing DRMFix - But it's better to remove it anyway.

Did you test latest ta_poc also on EliteKernel? For me it's not booting. I get early bootloop right after yellow LED for TWRP comes up.

The version before was OK.
[Sony Cross-Device General] xRevengerZee:
Nah why i bother testing everything working fine for me elite kernel fully working and everything cool
[Sony Cross-Device General] x_one:
Because [MENTION=4120742]munjeni[/MENTION] want make it working workout problems, so people's won't complaint that something not working and how to do it.
[Sony Cross-Device General] Hamidreza2010:
Bro with one key i test it already and put result here for some times :D

thanks a lot wait for new version .
[Sony Cross-Device General] ShadowElite:
Hey guys, next version of EliteKernel will have full support of this awesome tool, just give me time ;)
[Sony Cross-Device General] munjeni:
Tobias tool is not suported on every kernel image do in mind that. I not going to mess anymore with his tools, fill free too contact him and tell him about problem do not waste my time with it please!
[Sony Cross-Device General] xRevengerZee:
Why don't you just release and remove the old drm fix from kernel and oeople can just patch the kernel using this great tool?
[Sony Cross-Device General] munjeni:
Its allready fully supported
[Sony Cross-Device General] munjeni:
Install new poc and it will definitelly work. No need to remove, poc will remove it by default!
[Sony Cross-Device General] whalesplaho:
just downloaded tha latest update...... will try with AndroPlus & Sunkernel!
[Sony Cross-Device General] munjeni:
Please try poc only! If you use other tool than do not report anything, I am interested for poc only related things!
[Sony Cross-Device General] ShadowElite:
I know great dev, thanks for your awesome tool, my goal is pass safety net with my kernel (I archieved it), but for this I need to make some changes on ramdisk, so next version will be correct one for use this tool.
[Sony Cross-Device General] whalesplaho:
just poc only but with custom kernel....:good::highfive:
[Sony Cross-Device General] whalesplaho:
It freezes at bootlogo.... Doesnt boot!

Tried Sunkernel and AndroPlus kernel....

---------- Post added at 07:58 PM ---------- Previous post was at 07:52 PM ----------

It freezes at bootlogo.... Doesnt boot!

Tried Sunkernel and AndroPlus kernel....
[Sony Cross-Device General] munjeni:
Try that kernels first before patching and let me know, by now I don't know :)
[Sony Cross-Device General] munjeni:
That's imposible, how? Bash? This is shell script not a bash script, that's a first thing I noticed. Did you using poc on Linux or on windows? Did you removed ramdisk folder somehow during patching?
[Sony Cross-Device General] whalesplaho:
tha kernels are working fine.... i used tha previous version with tha kernels and working fine but no drm fix removal inside.

i also used tha previous version with script & drm fix removal posted on tha thread too & works fine...
[Sony Cross-Device General] cee43ja1:
Windows 7 x64 SP1. Ramdisk folder is still in the ta_poc folder, and remains in the folder.

1. Download ta_poc.zip in first post

2. Changed DOUBLECLICKME.bat to use "boot.img" instead of "kernelX.sin"

3. Copy kernel "boot.img" to ta_poc folder

4. Copy TA.img to ta_poc folder

5. Run DOUBLECLICKME.bat

6. Error after "Searching for old drmfix and removing . . ."
[Sony Cross-Device General] munjeni:
Sorry I have no idea, seems something after drm fix removed cause boot loop related to drm fix itself, I don't know, please ask author of that kernel, he know more about that
[Sony Cross-Device General] munjeni:
Sorry I don't know why that happens, I didn't see anything strange in this part of code which cause that:

ui_print "\nSearching for old drmfix and removing..."
for TT in `perform find $RAMDISK -type f -print | perform grep "init\."`; do
perform sed -i 's/\:libdrmfix.so//g' $TT
perform sed -i 's/libdrmfix.so\://g' $TT
done
for TT in `perform find $RAMDISK -print | perform grep "drmfix"`; do
perform rm -rf $TT
done

Anybody have the same problem? Can you try again? If not work you can remove that part of code!
[Sony Cross-Device General] fluffi444:
Yes - Have the save bootloop with this part of the code (Z3C EliteKernel).

If this part is hashed out than latest poc is working as usual.

Looks like that somewhere is something removed by this part which it not good...

Maybe an echo of grep output can help to find you what grep is finding and script then deleting...

EDIT

It's this part

perform grep "init\." - if we point this only to "init.target\." its working!

This original line searches obviously all "init.*" files. Maybe some files do not like to be greped :)

maybe init.bin ?

EDIT2

Furthermore I would add "libdrmfix.so" also to script - maybe some kernels have only this on export LD_PRELOAD - without ":" before or after.

perform sed -i 's/libdrmfix.so//g' $TT
[Sony Cross-Device General] munjeni:
I will check tommorow. Busubox.exe find tool don't have parameter -name which forced me to use grep instead which seems cause problem, also maybe sed too, don't know realy, must see tommorow. In most case sed removed libdrmfix.so string from an binary, I must see what is wrong with this. Can you post your original boot image before patched?
[Sony Cross-Device General] fluffi444:
Sure - it's the same as last time - EliteKernelV3 for Z3C

https://drive.google.com/open?id=0Bx1QvE4qnmn6YTVfWU9WT3Vxb0U
[Sony Cross-Device General] serajr:
You can loop through *.rc files this way:

for rcfile in $RAMDISK/*.rc*; do
empty=""

# look for ":libdrmfix.so" ( <= MM, it can be found in the init.target.rc file )
firststr=$(perform grep -h ":libdrmfix.so" $rcfile 2>/dev/null)
[ ! -z "$firststr" ] && perform sed -i -e "s!$firststr!$empty!" $rcfile

# look for "export LD_PRELOAD libdrmfix.so" ( >= N, it can be found in the init.environ.rc file )
secondstr=$(perform grep -h "export LD_PRELOAD libdrmfix.so" $rcfile 2>/dev/null)
[ ! -z "$secondstr" ] && perform sed -i -e "s!$secondstr!$empty!" $rcfile
done

Not tested yet!
[Sony Cross-Device General] whalesplaho:
Waiting for a solution....

So much hardwork.....
[Sony Cross-Device General] munjeni:
This is all files modified:

Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: file_contexts@0644
[COLOR="Red"]	modified: init.bin@0750[/COLOR]
modified: init.rc@0750
modified: init.sony-platform.rc@0750
modified: init.target.rc@0750
modified: sepolicy@0644
deleted: vendor/lib/libdrmfix.so@0644

Untracked files:
(use "git add <file>..." to include in what will be committed)

stufs/

But WTF why init.bin is modified with this:

perform sed -i 's/\:libdrmfix.so//g' $TT
perform sed -i 's/libdrmfix.so\://g' $TT

making grep init.bin didn't find any string libdrmfix, strange

Edit:

Holy... sed on windows breaks binary files, see

00000610 1a f0 08 0f a3 46 06 9a 04 f1 01 09 0e d0 94 42 |.....F.........B|
00000620 03 db 05 a8 06 a9 ff f7 e2 fd 4f f0 0e 0a 05 99 |..........O.....|
00000630 a5 42 b8 bf 25 46 01 f8 0b a0 80 e7 94 42 03 db |.B..%F.......B..|
-00000640 05 a8 06 a9 ff f7 d3 fd 4f f0 [COLOR="Red"]0d 0a[/COLOR] ef e7 06 9a |........O.......|

00000640 05 a8 06 a9 ff f7 d3 fd 4f f0 [COLOR="Blue"]0a[/COLOR] ef e7 06 9a 94 |........O.......|

As we can see it remove all 0x0d byte (\r) as described here http://stackoverflow.com/questions/4652652/preserve-line-endings

OMG
[Sony Cross-Device General] gr8st:
Just wanted to doubly confirm this for elite kernel, version before worked with manual DRM fix removal. Won't be a problem in the future as I doubt he'll include it anyhow with new update.

Stock however works just fine with new version.

Thanks again [MENTION=4120742]munjeni[/MENTION]
[Sony Cross-Device General] munjeni:
Using linux tools on window... OMG :) New version is out, it will work definitelly related to drm fix removal
[Sony Cross-Device General] whalesplaho:
i dnt understand a thing buddy.... not so good here1:crying::crying:

---------- Post added at 12:15 PM ---------- Previous post was at 12:14 PM ----------

gonna give it a shot now.... thanks for yur time!:good::highfive:
[Sony Cross-Device General] munjeni:
If you not understand better to not try! :) Wait somebody do it for your phone model & your kernel version. Init script is not universal for every device, must be a bit modified! And in case wrong nodes used, can overwrite wrong partition! Be warned. :) For my z1c that one is working and right node for my z1c is:

NODE_MMC=179
NAME_FOTA="mmcblk0p16"
NAME_FOTA_D=16
[Sony Cross-Device General] fluffi444:
So it was init.bin as expected - Thanks for this and the additional info why this all happens.
[Sony Cross-Device General] whalesplaho:
okay... just tried tha poc & still gat boot freeze with custom kernel but works fine with stock kernel!

i ll try add twrp and see if it will work.
[Sony Cross-Device General] munjeni:
Correct one for z5 & X

Z5

NODE_MMC=179
NODE_FOTA=259
NAME_FOTA="mmcblk0p32"
NAME_FOTA_D=0

X

NODE_MMC=179
NODE_FOTA=259
NAME_FOTA="mmcblk0p42"
NAME_FOTA_D=10
[Sony Cross-Device General] whalesplaho:
Im trying to add tha previous code with tha above one but dnt even know where to add. I check tobias but no luck, check poc.
[Sony Cross-Device General] serajr:
I have already integrated TA PoC code into the rootkernel tool (v5.23), just for my personal use (since both tools work very well). I also talked to the [MENTION=4120742]munjeni[/MENTION] (via pm) about this integration.

It looks like I'll have to release something (unofficial and unsupported) for you all to use the built-in rootkernel twrp. I'll do it soon, maybe here.

It would be nice to be able to talk to [MENTION=357342]tobias.waldvogel[/MENTION] too, but he does not seem to answer to users (well at least he does not answer to my posts).

So, I really don't know how to proceed!

Edit:

Ouput:

Rootkernel V5.23

- Unpacking kernel
Found elf boot image
Kernel version: 3.18.31-perf-g6ca3aed-02969-g71aee3f
Found appended DTB
- Detected vendor: somc (Sony), device: dora (Xperia X Performance), 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
- force-encrypt is enabled. Disable? (Say yes if you wipe and decrypt /data) [Y/n] Y
Disabling force-encrypt
- Sony RIC is enabled. Disable? [Y/n] Y
Disabling Sony RIC
- Install TWRP recovery? [Y/n] Y
Installing TWRP
Compressing TWRP image
[COLOR="DarkOrange"]- Install DRM fix? [Y/n] N
Skipping drmfix[/COLOR]
[COLOR="Blue"]- Install munjeni's TA PoC? [Y/n] Y
Installing TA PoC[/COLOR]
- Install busybox? [Y/n] Y
- Creating new initramfs
- Creating boot image
- Cleaning up
Done
[Sony Cross-Device General] whalesplaho:
Amazing and awesome king [MENTION=3989065]serajr[/MENTION].... Some devs dnt like pple intruding dia work, dnt know why buh dis is one big forum with happy people ready to share n ready to learn too... Atleast [MENTION=4120742]munjeni[/MENTION] has been supportive, helpful and always giving ipdate even wen he said he wont. I have known [MENTION=3989065]serajr[/MENTION] since tha days of mini pro/live with walkman and we have been pushing on.... Godblessings guys!

Im anxiously waiting [MENTION=3989065]serajr[/MENTION].
[Sony Cross-Device General] munjeni:
Hmm seems part of the ric script. I will fix tommorow!
[Sony Cross-Device General] munjeni:
New version is out, hope windows detection and bash isues solved
[Sony Cross-Device General] munjeni:
Can you give me boot image you used before patching?
[Sony Cross-Device General] cee43ja1:
https://drive.google.com/file/d/0B0j3VJ1Xp5N8S3IzSUR4UDJrdFE/view

It's the boot.img pulled from the latest AndroPlusKernel
[Sony Cross-Device General] whalesplaho:
same issue here.......
[Sony Cross-Device General] Hamidreza2010:
[MENTION=4120742]munjeni[/MENTION] sorry bro maybe before you answered this question or maybe not but why we have TA.img in 2 path?

in " data/local/temp " and " /stufs " ?

where is correct or is it need to save both of them?

juat want to know why there is in 2 path ?

thanks a lot
[Sony Cross-Device General] 2ddssa:
It does not matter to me but I will answer, backup TA integrated into the ramdisk "/stufs", but this area is not available for write, and for the correct work of the TA partition must be available for change and this from a ramdisk is copied on the path "/data/local/tmp" and mounted to spoof
[Sony Cross-Device General] Hamidreza2010:
ok thanks

then ta.img should be in that 2 path yeah?

it isnt need to delete one of them ?
[Sony Cross-Device General] 2ddssa:
From one you can not remove, And second, if you delete it will be copied after reboot. And yes, it should be
[Sony Cross-Device General] munjeni:
Well, found busybox isues, busybox.exe have bug in function e.g (for read LINE; do...), it crash my WIN10, so I have now moved some things to exe, hope things finaly start working on custom kernels. You had bootloop since lines like (restorecon ...libdrmfix.so) was not removed! New version is out!

Update: TA.img from stufs is also removed on every boot
[Sony Cross-Device General] munjeni:
That is stock .417 kernel, right? Poc only used? New version is out, I will need dmesg in case new one have the same thing!
[Sony Cross-Device General] cee43ja1:
New POC boots with custom kernel. BUT no signal again. Did pull a dmesg with Terminal Emulator before flashing pre-POC kernel.

Did not check to see if TA.img was in the correct folder, as I need my phone functional right now. Will test with stock and custom kernel again tonight.
[Sony Cross-Device General] munjeni:
Hmm seems time for removing /stufs/bin/busybox and change to system shell, found this in your log

34.539779] init: Starting service 'exec 13 (/stufs/bin/ta)'...
[ 34.540546] init: cannot execve('/stufs/bin/ta'): Permission denied
[ 34.541497] init: Service 'exec 13 (/stufs/bin/ta)' (pid 11967) exited with status 127

Will make new test version right now
[Sony Cross-Device General] whalesplaho:
working well with custom kernel now.... just dat it still freezes when yhu try to enter recovery.

so sad i cant get last_kmsg, now i have syss/fs/pstore folder but empty!
[Sony Cross-Device General] munjeni:
New version is out, need somebody with previously working PoC to confirm if new one is ok! This one might work [MENTION=582698]cee43ja1[/MENTION]
[Sony Cross-Device General] fluffi444:
Works 99,9% (:)) here. TA.img copy with correct perms/owns. Keys OK. Image prosessing as well.

Tested on custom Kernel EliteKernelV3 Z3C.

EDIT

only (and only cosmetic) TA.img is still in stufs folder - Even if you removed it with new init.ta.sh script.

Original TA.img was removed before flashing kernel.
[Sony Cross-Device General] whalesplaho:
Success......

working fine!
[Sony Cross-Device General] munjeni:
Dmesg will need for fixing that cosmetic...
[Sony Cross-Device General] serajr:
Glad to know that you moved from busybox sh to /system/bin/sh. Also init.ta.sh script! :highfive:

Maybe also repositioning blue line like below, TA.img will always be removed:

if [ ! -e "/data/local/tmp/TA.img" ]; then
cp -f /stufs/TA.img /data/local/tmp/TA.img
fi

[B][COLOR="Blue"]rm -rf /stufs/TA.img[/COLOR][/B]

if [ -e "/data/local/tmp/TA.img" ]; then
chown '$ownes' /data/local/tmp/TA.img
chmod '$permis' /data/local/tmp/TA.img
fi

Or even better:

[B][COLOR="Blue"]if [ -e "/stufs/TA.img" ]; then rm -rf /stufs/TA.img; fi[/COLOR][/B]
[Sony Cross-Device General] fluffi444:
Here you are...

http://pastebin.com/fndx4ERY

---------- Post added at 01:48 AM ---------- Previous post was at 01:07 AM ----------

Tried it. But it's also not working... but anyway... Is this removal of TA.img realy needed? Actually no.

But I also undestand that tatool should be perfect - But if you ask me - just leave it. :o
[Sony Cross-Device General] serajr:
Humm, so I think now init.ta.sh script must temporarily disable ric (if not already disabled) and mount rootfs as r/w somehow prior to remove it. And no, it is not needed to remove it, but as you said... perfection!
[Sony Cross-Device General] munjeni:
I think nothing can be fixed without right dmesg... anyway new version is out and one for linux
[Sony Cross-Device General] karrouma:
It works with rooted device without backing up ta.img

Unlockef bootloader with no ta.ing backup

Cz i unlcked my phone with no ta backup
[Sony Cross-Device General] munjeni:
How? Valid ta is required or tool fail
[Sony Cross-Device General] fluffi444:
No - not all all - this is all about to mount original TA.img to have phone like never unlocked.

If you do not have your backup then this is nothing for you.

Go with DRM fix.
[Sony Cross-Device General] ra1n25:
I took CM13 boot.img and patched with poc. Everything completed successfully. Is it safe to flash it?
[Sony Cross-Device General] fluffi444:
Read OP completely and carefully. This is only for stock or stock based ROMs.

CM13 is custom.
[Sony Cross-Device General] ra1n25:
Thanks for answering.
[Sony Cross-Device General] munjeni:
I have added support for cm but I never tried to boot, you can try an let us know! If poc didn't gaved you error than probably your new_boot.img is ok.
[Sony Cross-Device General] up2dateneurosis:
At first thank you for your project munjeni :)

I use this build for my Z5 compact in Germany E5823_32.3.A.0.376_1298-1220_R5D. When I first integrate your mod as DRM solution and than repack the modified kernel with Tobias Waldvogels tool https://xdaforums.com/xperia-z5/development/root-automatic-repack-stock-kernel-dm-t3301605 to get root access, than my SIM card does not work. So the phone is not really useable and I have to reflash and wipe the device again with the flash tool. When I only modify with Tobias tool than the SIM works. So my question is now: can you write a clear manual that lists step by step how to combine your and Tobias tool to have a real DRM fixed kernel and root access?

Till now i worked like this:

1. I did a fullwipe and flashed the latest stock rom with the flash tool

2. I extracted my kernel.sin from the E5823_32.3.A.0.376_1298-1220_R5D.ftf

3. I renamed the kernel.sin to kernelX.sin or modified the .bat file to pick a kernel.sin file

4. I started your DOUBLEKLICKME.bat and gave the following answers:

dm-verity is enabled. Disable? Y

Sony RIC is enabled. Disable? Y

5. Than I copied the new_boot.img to the folder of Tobias tool (I got the SuperSu.zip also inside)

6. In the console I typed rootkernel new_boot.img kernel.img and the tool starts to analyse the kernel

7. In the process I gave the following answers:

dm-verity is enabled. Disable? Y

Sony RIC is enabled. Disable? Y

Install TWRP recovery? Y

Install kcal kernel module? N (but would be nice if this would be useable too in future :) )

Found SuperSU-v2.79-SR3.zip Install? Y

Install DRM fix? N (because of munjeni ;) )

Install busybox? N

8. I flashed the fresh generated kernel.img in flashmode by the flash tool, restarted the first time, endabled root access, devmode, unknown sources, usb debugging and pushed the TA.img to the device with this command:

adb devices

adb push C:\adb\TA.img /data/local/tmp

Everything seems to work but as I said, it does not. Where is my mistake?
[Sony Cross-Device General] whalesplaho:
I use dem both without issues....

1. Patched kernel with poc.

Copy kernel.sin to poc folder n rename tha bat file to read kernel.sin(make sure yhy copy yur TA.img to tha poc folder too)

2. Yes for all required command

3. Copy tha new_boot.img to tobias tool folder

4. Run rootkernel.cmd new_boot.img boot.img

5. N to drm fix and maybe kcal too if yhu dnt want n voila.....