yashsingh1/xdaforums huggingface dataset:
[Sony Cross-Device General] munjeni:
Thread title is "work in progress" so when it become removed from title, title will be started with version number. I have no free time to mess with thread when I am working hard getting things work, hope you understand what I mean? I agree with you but I simply have no free time to maintain my thread now :)
[Sony Cross-Device General] munjeni:
Thanks But thats CM like ramdisk which contain booth rom and recovery cpio archives. Curently tool is not ready for something like that! I will play with it as soon as our tool gets stable!
[Sony Cross-Device General] ra1n25:
Thank you for this wonderful tool! I have Xperia ZR. My question is: if i have backed up my phone( TA also) and have patched TA, can i flash CM or any other ROM and get my keys back with patched TA? Would love to try other ROMs but need my crystal clear pictures and sound ?
[Sony Cross-Device General] munjeni:
See post above your!
[Sony Cross-Device General] munjeni:
1000? Not realy, its 2x more https://s9.postimg.org/ov35ias9r/image.jpg :eek:
[Sony Cross-Device General] fluffi444:
Tried it, only PoC (newest version) and same boot_Z3c.img and TA.img used for all tests. Same result... None in keys

Then I tried again (same boot and same TA img) and older version of PoC (the last where coping didn't work) - And this works again regarding Keys...

This is dmesg with old version:

http://pastebin.com/pV0qQLWu

And this with newest:

http://pastebin.com/kx5t1czJ

Has newest version an new busybox or modified or?
[Sony Cross-Device General] serajr:
TA PoC's Scripts v2

Here
[Sony Cross-Device General] munjeni:
Please try only my poc! In dmesg of the newer one I see byeselinux which mean you are used not my poc only. I can't start fixing thing when I am not sure. It would be good if yiu reinstall your rom and wipe data factoru reset and try thing clean, I am sorry but now I am a bit confused since somebody say it worked somebody say it not worked, I don't know what is going on. Anybody confirm that poc is working???
[Sony Cross-Device General] munjeni:
Something is messy in your system? For example this:

[ 6.294571] RIC: unknown filesystem

than this:

[ 16.726797] init: cannot find '/sbin/fsckwait', disabling 'fsckwait'

don't know realy, can't see anything about your drm key... maybe you rely will need to reinstall your whole system from begining?
[Sony Cross-Device General] fluffi444:
As faar as I know byeselinux was installed by russels rooting - and is also part of SLiMM ROM (RecRoot - which is "the same" prodeduce)

https://xdaforums.com/z3-compact/general/recovery-root-mm-575-lb-t3418714

cp /data/local/tmp/mm_twrp_recovery_install/byeselinux.ko /system/lib/modules/mhl_sii8620_8061_drv.ko
chmod 644 /system/lib/modules/mhl_sii8620_8061_drv.ko

I recently tried already to run SLiMM ROM without byeselinux (replaced mhl_sii8620_8061_drv.ko with original one) - but ROM is not booting completely without byeselinux. ROM dev made obviouly some deep changes on booting which needs it...

Do not put too much work in it... It still works with old manual version and manual copied TA.img.
[Sony Cross-Device General] munjeni:
Thanks a lot for scripts, this will help peoples disable ric, dmverity and force-encrypt!
[Sony Cross-Device General] munjeni:
If it works with old version than maybe newer one realy is not working, who knows. Need somebody verify this!
[Sony Cross-Device General] munjeni:
Can you add manualy this line to ta script before exit 0:

if [ -d /data/local/tmp ]; then
echo "tmp exist"
else
echo "tmp not exist"
fi

And see which of the two things exist in your dmesg?
[Sony Cross-Device General] x_one:
You can try install slimm without root and recovery.

Try remove them from installation zip and check if you need change something in installation script. I think you can do it without wiping data. You will have clean slimm rom.
[Sony Cross-Device General] fluffi444:
Yeb - though the same already but for today to much hassle to go on. Have to stop for today.
[Sony Cross-Device General] munjeni:
No need to write ta lines I will do that in next version, have no sense trying that because I must revert things to previous version! Let see tommorow.
[Sony Cross-Device General] fluffi444:
Don't know why but none of both - strange...

http://pastebin.com/EuJ580T0

I put the ta script at the end - only for information

EDIT

Ok - this was my final test also for today :)
[Sony Cross-Device General] munjeni:
If you put that after exit 0 it will not work, anyway I have made new version with that part of lines, reverted back to a working version, hope you get some free time tommorow to give me dmesg. If nothing in dmesg maybe in logcat?
[Sony Cross-Device General] fluffi444:
But I didn't - It's before exit 0... EDIT: I'm meant at the end of pastbin post. :)

yeb - will test tomorrow...
[Sony Cross-Device General] okij:
First of all, thanks for your outstanding work! :good:

IMHO this will be a valid starting point to finally have AOSP/CM/etc. custom ROMs on our Xperia devices while preserving the camera quality of Sony stock ROMs. :)

Wouldn't it just need a simple find+replace operation in your 1000-2000 lines of source code? I too think that a location which isn't wiped on a reboot should be better and safer than using /data/local/tmp. Of course you can do this later, when your POC is almost finished. Just my 2 ct. :)
[Sony Cross-Device General] munjeni:
If I change path I must revrite selinux part and somebody need to work with me. I need somebody who is fast for it, I can't wait hour before somebody say it not working, need an skilled tester who can work with me at least one who can test it fast and get dmesg to me
[Sony Cross-Device General] gr8st:
Thanks for this. Can you please make an option to enable Verity and RIC if it's already been disabled?

Thanks in advance.

---------- Post added at 02:48 PM ---------- Previous post was at 02:18 PM ----------

Tried new PoC again, and it's copying TA.img itself and everything (keys, signal) seems to work. In Mixplorer, owner is listed as "unknown 2997" and group is "root 0" with permissions as 660, is that correct?
[Sony Cross-Device General] Soheil_rf:
[MENTION=4120742]munjeni[/MENTION]

If [MENTION=5169444]AndroPlus[/MENTION] remove DRM fix from his kernel , Are we can use it in PoC ?
[Sony Cross-Device General] Surge1223:
If you promise to switch from .bat to .sh you got a deal.

Lol most of us who work on or are using selinux use a Linux env

I've been following along, since I also have an interest in sepolicy editing etc (https://github.com/Surge1223/setools3_android/blob/ndk/checkpolicy/Android.mk)

But I have not used a .bat file since 1998
[Sony Cross-Device General] x_one:
Look like it's as it should. I have the same and it's working for me. What device and FW have you work with?
[Sony Cross-Device General] gr8st:
Z3C AOXP .291 EliteKernel. Also tested stock kernel, both work.
[Sony Cross-Device General] sirdoha:
[MENTION=3037651]zacharias.maladroit[/MENTION] Will you use this fix on your kernel?
[Sony Cross-Device General] divakarhero:
It will work for xa and xa ultra or not??
[Sony Cross-Device General] snaky90:
PaC works on "stock" kernel like Concept Kernel ("Oficial" concept rom) ?
[Sony Cross-Device General] shoey63:
Concept rom kernel is an android boot.img, and not a kernel.elf. But I think the tool supports both formats. Am I correct in this assumption [MENTION=4120742]munjeni[/MENTION]?
[Sony Cross-Device General] munjeni:
Yes, sin, elf and img is supported. Only thing which is not supported is any kernel like CM which contain two cpio archives (rom.cpio and recovery.cpio), all like that is not supported. Supersu installer also not supports something like that
[Sony Cross-Device General] munjeni:
I am confused since I reveted to the version when it failed to copy ta to the /data/local/tmp . How its possible now?
[Sony Cross-Device General] dddestiny:
i am expecting it can use with aosp on Nougat
[Sony Cross-Device General] munjeni:
It will work! Not tried but in theory it must work
[Sony Cross-Device General] munjeni:
Why not?
[Sony Cross-Device General] munjeni:
Don't wory, soon version for linux! Anyway current version allready suport .sh (busybox ash), more info here -> https://xdaforums.com/showpost.php?p=70999006&postcount=218
[Sony Cross-Device General] Soheil_rf:
I removed some Drmfix stuff from androplus kernel during poc process paused, PoC work without any errors, but after flash, loop on bootanimation, any idea?
[Sony Cross-Device General] munjeni:
Yes
[Sony Cross-Device General] munjeni:
Hope you try and let us know!
[Sony Cross-Device General] munjeni:
Seems you have not done things corectly :)
[Sony Cross-Device General] x_one:
I've missed that version. Why have you reverted? Are there any problems with this solution?
[Sony Cross-Device General] munjeni:
Two guys reported it have signal but drm key not exist. I have made new version right now, seems I have found what was problem, problem seems was that tad_static mounted empty loop, and other one getattr permission denied parameter -d get dir from ta script, now I have added it and updated ta script a bit so it will not mount anything until /data/local/tmp gets available, hope thing finaly start working :)
[Sony Cross-Device General] x_one:
I'll try it when I'll back home.

I saw that people was discussing about place of the file. If we want change path of the file is enought if we change it in files while pause or we need play with sepolicy to change it?
[Sony Cross-Device General] fluffi444:
So do I.
[Sony Cross-Device General] munjeni:
Sepolicy must be changed. I still have no idea why peoples want it on another place when TA.img in curent path can read only tad and root, is not that enoght secure?
[Sony Cross-Device General] x_one:
For me it's just curiosity.

I need play some with sepolicy to understand it, but I don't know how check current state yet.
[Sony Cross-Device General] halfvast:
Latest version is working perfect with Xperia Z4 Tablet (Nougat), thank you very much munjeni! :)
[Sony Cross-Device General] munjeni:
Thanks for info! Did you copied TA.img to /data/local/tmp or it's auto copied? Thats now only important for me :)
[Sony Cross-Device General] fluffi444:
Tested latest version.

TA.img loading is OK (if it's in tmp folder with root.root 0777 - for instance).

But coping didn't work... sry. (renamed existing for test)

Permissions and ownership didn't work as well (if I use file renamed back to TA.img)

http://pastebin.com/SPGKChjX
[Sony Cross-Device General] munjeni:
OMG :( Can you post dmesg when it fail?
[Sony Cross-Device General] munjeni:
Thats optional and not an error! Click any key on your keyboard to continue :)

PS you can use http://www.pastebin.com for your big log files, thanks.
[Sony Cross-Device General] halfvast:
Frist I copied TA.img in /data/local/tmp like before and it worked.

After your post I did a second test and it did not copy TA.img to /data/local/tmp so I did it manually afterwards.
[Sony Cross-Device General] munjeni:
Anybody give me dmesg when it fail to copy TA.img to /data/local/tmp ?
[Sony Cross-Device General] Soheil_rf:
Lastest version works perfect on my XZ (manualy ta.img copying) but after Restart signal is gone again

http://pastebin.com/D79WLR9x
[Sony Cross-Device General] munjeni:
Apsolutly nothing strange in log related to failed TA.img copy :( Is that log from a time when you had no signal? Important!
[Sony Cross-Device General] Soheil_rf:
Yes i haven't signal now

Full log :

http://pastebin.com/jUkgnkjC
[Sony Cross-Device General] fluffi444:
Actually my last pastbin was already after "not copy".

But I did the procedure again. Deleted this time TA.img in tmp folder via TWRP termial.

Flashed kernel (made latest tool) via img flash from TWRP.

Shutdown completly. And did fresh rebbot.

First start I have blackscreen! (this is new!) - But power button still works with normal power menu. So another reboot.

Phone boots completely but without sim/signal etc.

TA.img is not copied.

http://pastebin.com/GHQctx5t
[Sony Cross-Device General] Soheil_rf:
I think now sim detection is more important than ta coping
[Sony Cross-Device General] fluffi444:
Actually yes - but this was not the question with newst version.

TA.img loading (and therefore sim detecting) in not the problem anymore (if you have TA.img in tmp folder with proper own/perms)

But munjeni is searching for an 100% solution - And real developers are doing so - I fully understand and respect this.
[Sony Cross-Device General] munjeni:
fluffi444 mate I realy respect your contribution to this poc but I am sorry I can't look into your log anymore since your dmesg contains many busybox outputs which seems is not from poc busybox, I can't fix this without a proper logs, I need a log from poc only, clean poc, without anything other than poc, your boot image contains a lot of mods and I simply can't see anything in your log which is potentialy a successfully located bug, I am unable to locate bug. :( Anyway respect to your help!

To all, don't post your dmesg if it is not from a fresh booted android, I need log from a fresh booted android. I am already 2 weeks on this poc and my patience have a limit, hope I not abandon this poc, but its already on the verge of my patience. If I not fix this poc in next 2 days, poc will wait my new phone and continued after I test things in my phone directly.
[Sony Cross-Device General] munjeni:
This script is unbelievable, totaly confuse me. Curent script:

#!/sh

BB=/stufs/bin/busybox

[COLOR="Red"]if [ -d /data/local/tmp ]; then
if [ ! -e "/data/local/tmp/TA.img" ]; then
${BB} cp -fr /stufs/TA.img /data/local/tmp/TA.img
fi

if [ -e "/data/local/tmp/TA.img" ]; then
${BB} chown 2997.0 /data/local/tmp/TA.img
${BB} chmod 0660 /data/local/tmp/TA.img
${BB} losetup /dev/block/loop5 /data/local/tmp/TA.img
exec /sbin/tad_static /dev/block/loop5 0,16
fi
fi[/COLOR]

[COLOR="Blue"]exit 0[/COLOR]

In dmesg service tad_static exit with status 0, there is 50 lines about tad_static when TA.img is not in expected path, even after data partition and system allready up these line tad_static in dmesg continues with status 0, 50 and more times. No denials related to script or anything related to tad_static which is totaly strange. But TA.img is not copied and nothing in log other than "tad_static exited with status 0, null mean ok. WTH is going on with this anybody have idea :confused:

if [ -d /data/local/tmp ]; then

Because we see 50 and more lines in dmesg about tad_static exited with status 0 that mean that tad_static didn't started which definitely mean that script reports that /data/local/tmp not exist. THat mean that whole red part is skipped and blue is returned instead, unbelievable, this is a crazy :(

Is possible that busybox sh applet didn't understand this?? :

if [ -d /data/local/tmp ]; then
[Sony Cross-Device General] munjeni:
Is your tmp folder empty after reboot??
[Sony Cross-Device General] x_one:
OK, here is my dmesg. No signal, no TA.img copied..

http://pastebin.com/4zwFrSsc
[Sony Cross-Device General] fluffi444:
Absolutely no problem! And actually it works the manual way! (perms/own at "on post-fs-data" in init.sony-platform.rc)

Yes - EliteKernel has its own busybox in "vendor/bin" to start kernel build in TWRP ("ramdisk/init" - init attached) and for sure other stuff. And maybe also SLiMM ROM has some modification not futher known... Maybe (and for sure) this kernel is not the best to debug.

Actually I planned to remove all this un-needed stuff from EliteKernel - but still to lazy to do so :)

Anyway. Biggest thanks and respect for your work. :good:
[Sony Cross-Device General] munjeni:
The same situation as this https://xdaforums.com/showpost.php?p=71017170&postcount=273 , unbelievable, totaly crazy. Is your tmp folder empty after reboot?
[Sony Cross-Device General] x_one:
Yes. I've removed TA.img before flashing new boot.img.

When system booted there wasn't TA.img
[Sony Cross-Device General] munjeni:
Crazy things is happening in mount proccess, for example I had hard time figuring out how nut ric mod worked https://github.com/munjeni/nut_root/commits/master I done a lot of cuts in script as you can see in commits, at the and figured out what was happened, enabling loging root is working again :) WTF :), that commit explained whats going on in nut ric mod. Function TECL which looks like this:

TEXECL(){
echo "$*" >> ${PREPLOG}
$* 2>&1 >> ${PREPLOG}
_RET=$?
echo "RET=${_RET}" >> ${PREPLOG}
return ${_RET}
}

was responsible for ric mount confusion and finaly make ric down, so probably something to our TA.img copy is going similary crazy as like nut ric when we trying to fix our bug, I apsolutly have no idea whats going on, can't explain and don't understand.
[Sony Cross-Device General] munjeni:
If you put something to /data/local/tmp e.g. any file, what is happening after reboot, is /data/local/tmp empty?
[Sony Cross-Device General] x_one:
I've put 2 files in tmp one with rights 600 and one 666. Both are present after reboot.
[Sony Cross-Device General] munjeni:
Now I am a bit more confused since somebody reported no TA.img after reboot
[Sony Cross-Device General] x_one:
Even if I couldn't make it working because of wrong owner TA file (manually copied) never was deleted after reboot.

BTW what's wrong with solution that was coping and working at my device? Wasn't good clue?
[Sony Cross-Device General] munjeni:
But see this post https://xdaforums.com/showpost.php?p=71016182&postcount=266 , this guys after reboot have no signal, curently he not confirmed about existence of the TA.img after reboot :(
[Sony Cross-Device General] munjeni:
[MENTION=4962787]fluffi444[/MENTION] reported no DRM keys but signal ok with that working copy ta solution, something is happening realy crazy which is curently "???" :(
[Sony Cross-Device General] x_one:
That could be problem related to slimmrom or elitekernel.. I'll make boot.img for my brother's Z2 for test but he is far away from me and dunno how fast he answer.
[Sony Cross-Device General] aiola1982:
Even after a power off all files in /data/local/tmp are still there (Z5C Stock MM)
[Sony Cross-Device General] munjeni:
Mate thats ok, as expected, but we curently working on solution to fix bug with autocopy isue related to TA.img to /data/local/tmp destination, we curently trying to fix that. Your solution is ok but thats not what we curently doing/speaking about, so please.. thats not important by now!
[Sony Cross-Device General] munjeni:
I realy have no idea whats going on because solution with non working ta to destination copy is working on his phone, but one with working ta to destination is not working (have signal but no drm keys), strange.
[Sony Cross-Device General] munjeni:
[MENTION=1881378]Soheil_rf[/MENTION] I can't understand whats going on, did you done something? Can you verify existence of the TA.img in /data/local/tmp folder on your device when there is no signal on your mobile??
[Sony Cross-Device General] munjeni:
How you are sure by that? Did you deleted TA.img from tmp folder before you done that? TA.img is copied on next boot itself? Thats curently thing which we need to resolve since on most phones its failed to copy to the destination!
[Sony Cross-Device General] x_one:
[MENTION=5627933]androidexpert35[/MENTION] do you use latest PoC?
[Sony Cross-Device General] munjeni:
Your phone is e6653 z5? Mm or nougat?
[Sony Cross-Device General] munjeni:
But did you deleted TA.img from /data/local/tmp before reboot?
[Sony Cross-Device General] Soheil_rf:
i removed TA.img from /data/local/tmp

patched kernel with lastet version without ( RIC disabling - DM verifying - Force encrypt )

flashed kernel after that flash SuperSU for DM

result is same :

no signal

no TA.img coping
[Sony Cross-Device General] munjeni:
Ok, your device is? Rom?
[Sony Cross-Device General] Soheil_rf:
XZ lastest Nougat build 39.2.A.0.417

and here log if needed :

http://pastebin.com/SkiuT9j4
[Sony Cross-Device General] munjeni:
You not comfirmed TA.img deletion from /data/local/tmp before reboot. Can you comfirm?
[Sony Cross-Device General] xRevengerZee:
I'll suggest something and i hope you all agree why don't you op make a video about this whole thing it will help a lot or someone from people who did this drm fix with a sucess cause im one of people not able to do it
[Sony Cross-Device General] Surge1223:
also everyone should just attach their shell command output while doing every step. I feel like munjeni is gonna lose it soon if he has to keep confirming

Hastebin or zip of shell output yo
[Sony Cross-Device General] karamancho:
[MENTION=4120742]munjeni[/MENTION]

I tried the fix on my z1 compact on a stock ROM and a custom kernel.

I copied the TA.img and boot.img to the ta_poc folder, renamed the kernel.elf to boot.img in the DOUBLECLICKME_JB bat file.

after I start the DOUBLECLICKME_JB.bat i get the following error:

Dumping to out...
BOARD_KERNEL_CMDLINE androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x3b
7 ehci-hcd.park=3 androidboot.bootdevice=msm_sdcc.1 vmalloc=300M dwc3.maximum_sp
eed=high dwc3_msm.prop_chg_detect=Y selinux=0
BOARD_KERNEL_BASE 00000000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 02000000
BOARD_SECOND_OFFSET 00f00000
BOARD_TAGS_OFFSET 01e00000
BOARD_DT_SIZE 464896
Done.
No file exist out/boot.img.elf .
Gunziping...
setting up infflate...
infflating...
infflate returned: -3
gzpipe: invalid or incomplete deflate data
Error gunziping "out/boot.img-ramdisk.gz"!
Press any key to continue . . .

do you know why?
[Sony Cross-Device General] :
I think you better clarify you need the DRM keys backed up first, people from other forums are claiming you don't need it with this.
[Sony Cross-Device General] zohaib0001:
[MENTION=4120742]munjeni[/MENTION]

i also have Xperia XZ Dual with latest build Nougat 417 build

I delete TA from Data/local/tmp, and use latest build with Script 2 updated

I disable all three things using scripts and after flash new_boot.img , there are no sim single and no TA.img in data local tmp

I also manually copy it in data/local/temp and restart but again no signal
[Sony Cross-Device General] Hamidreza2010:
[MENTION=4120742]munjeni[/MENTION] bro your poc alone work good but with tobias tool get problem.

first i patch my kernel with your poc and then use this kernel with tobias tool ( just for add twrp and supersu ).final kernel created sucessfully and phone boot up well but i cant enter to recovery ( stay at sony logo )

i make it again just without your tool ( just tobias tool ). every thing was good and i can enter to recovery.

for now i want use both tools ( from you and tobias ).i want to use real drm key and also want to have recovery

( if i dont use tobias tool , i cant add recovery and supersu manually to my kernel ).my device is xperia z5

would you please fix it?
[Sony Cross-Device General] fluffi444:
I suggest that you provide dmesg.log from each main step you did. Otherwise the is no chance to help for sure or to find out what the problem is.
[Sony Cross-Device General] munjeni:
You need to provide me last kmsg if your android is not booting, I can't help you wih how to get last kmsg, you can ask in your device forum. Without log I can't help you.
[Sony Cross-Device General] munjeni:
As explained in first post this tool is for stock kernel only. You can attach your kernel in attachment so I can look
[Sony Cross-Device General] munjeni:
Clarified already in first post and also in readme of the poc. Whole TA.img (before unlocking bootloader) is need not only drm key. I have changed title of the thread, this is not DRM fix, this is something like real locked Trim Area
[Sony Cross-Device General] munjeni:
You need:

chown tad root /data/local/tmp/TA.img

chmod 0660 /data/local/tmp/TA.img
[Sony Cross-Device General] munjeni:
This is a crazy realy, on your phone it working and on all other phones not working. And I can't see anything in any of the logs about possible fix since no errors in any of the logs, crazy.
[Sony Cross-Device General] Hamidreza2010:
Now my problem just this:

when i use both tools , phone boot up well.but i cant enter in recovery.

but for your suggestion , how can i get log and share here?

( i should get log when stay at sony logo )

thanks