yashsingh1/xdaforums huggingface dataset:
[Sony Cross-Device General] munjeni:
Status:

First one din't boot with poc and even if I flash it and boot it didn't boot!

Seccond one, the same!

First recovery which you posted a week ago worked only if flashed, but with poc not.

I have tried to debug your recovery using uart but it end at booting linux and no log, it reboot imediatelly!

This is a uart log from first one:

S1 BOOT
[140] USB init ept @ 0x7c851000
[160] TA config read from GPT: 0x10 blocks of size 0x20000 @ 0x20000
[180] GPIO HW_ID[3:0]: [0010]
[190] soc_ver: 0x20002, pmic_ver: 3.1
[190] die_id: 0x4721ea4, oem_product_id: 0x4, otp_lock: 0x155
[310] OV: 0x0 0x0 0x0
[310] USB ID: 1789
[320] OTG State is invalid
[320] VBUS is invalid
[400] S1 decisions complete, image to boot is 0.
[400] IMEI[0]: [COLOR="Red"]removed[/COLOR]
[400] Info: failed to retrieve secondary IMEI (optional) in facility 0x1 with code 0x2 (error ignored)
[410] Image to boot not in ELF form, trying vendor form.
[420] use_signed_kernel=0
[420] Loading boot image (10143744): start
[1000] Loading boot image (10143744): done
[1010] DTB offset is incorrect, kernel image does not have appended DTB
[1010] ERROR: Appended Device Tree Blob not found
[1020] Image unable to load!
[1020] Could not boot image, shutting down
[1020] Going down for shutdown.

This is a uart log from seccond one:

S1 BOOT
[140] USB init ept @ 0x7c851000
[160] TA config read from GPT: 0x10 blocks of size 0x20000 @ 0x20000
[180] GPIO HW_ID[3:0]: [0010]
[190] soc_ver: 0x20002, pmic_ver: 3.1
[190] die_id: 0x4721ea4, oem_product_id: 0x4, otp_lock: 0x155
[310] OV: 0x0 0x0 0x0
[310] USB ID: 1789
[320] OTG State is invalid
[320] S1 decisions complete, image to boot is 0.
[320] IMEI[0]: [COLOR="Red"]removed5[/COLOR]
[320] Info: failed to retrieve secondary IMEI (optional) in facility 0x1 with code 0x2 (error ignored)
[330] Image to boot not in ELF form, trying vendor form.
[340] use_signed_kernel=0
[340] Loading boot image (15818752): start
[1250] Loading boot image (15818752): done
[1260] Using DTB entry 126/00020002/8/0 for device 126/00020002/8/0
[1280] cmdline: androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 dwc3.maximum_speed=high dwc3_msm.prop_chg_detect=Y msm_rtb.enable=0 androidboot.emmc=true androidboot.bootloader=s1 oemandroidboot.s1boot=1270-3115_S1_Boot_MSM8974_Rhine1[1300] Updating device tree: start
[1320] Updating device tree: done
[1350] If you can read this line, S1 BOOT is done. Start the stone rolling!
[1360] booting linux @ 0x8000, ramdisk @ 0x2000000 (8866698), tags/device tree @ 0x1e00000
[Sony Cross-Device General] zohaib0001:
Yes i am using my TA.img backup

And my TA.img backup file is not corrupted, because i already test it by restore it on my device

Can you make a video and share with me of whole process ?

---------- Post added at 07:21 PM ---------- Previous post was at 07:18 PM ----------

Whenever i try to put TA.img in my phone with adb, i get an error device not found

so i copy TA.img Manually by using root explorer
[Sony Cross-Device General] :
Inside this guy's spoiler content you can use the adb commands: https://xdaforums.com/showpost.php?p=70959962&postcount=65

Make sure you have USB debugging turned on, and your phone is asked for permission for debug. It won't detect if you're in lockscreen.
[Sony Cross-Device General] zohaib0001:
i am going to flash complete firmware again with data wipe then i will try this tool again and update here
[Sony Cross-Device General] levone1:
Sorry for dumb noob question... It seems like op says that this makes drm restore possible for custom roms, but also that stock rom is required. What am I missing? I have Xperia Z1c, and have a backup img of ta. Is it possible to restore that to CM, for example?

Thanks for your work munjeni.
[Sony Cross-Device General] shoey63:
Is /data/local/tmp necessary? Why not just leave TA.img on /sdcard (internal storage) and change the script?
[Sony Cross-Device General] ondrejvaroscak:
So you see, if you are getting "device not found" error on adb, either is your USB Debugging not enabled, or you have not correct ADB drivers installed for your device..
[Sony Cross-Device General] DHGE:
could it be that SELinux prevents reading /stufs ?
[Sony Cross-Device General] munjeni:
Thats a great idea, but users will forget to put TA.img and will always ask how to put it to the sdcard as already doing for /data/local/tmp. I think fixing our things is definitely a better idea
[Sony Cross-Device General] munjeni:
Don't know, I can't see anything in any log about what was missing :( If you see something tell me please!
[Sony Cross-Device General] munjeni:
If tool didn't give error than its possible. In general it is possible but curently tool is optimised for nougat and marchmalow stock rom as you can see two versions, one is for mm and one is for n, thats because two diferent selinux versions, so for jb in most case sepolicy patching mechanism will fail since sepolicy is diferent
[Sony Cross-Device General] fluffi444:
As I tested the very first (manual) version combined with shript from russel I had also problems with permissions:

https://xdaforums.com/showpost.php?p=70663982&postcount=1819

The current version of TA Tool is not only not coping TA.img - also the permissions setting (for TA.img) is not working in ta script.

Moved permissions to init.sony-platform.rc is working...
[Sony Cross-Device General] munjeni:
Did you verified if TA.img in /data/local/tmp have owner=tad and group=tad ?
[Sony Cross-Device General] fluffi444:
yes - checked this. I set this for tests to root.root 777 but after fresh and full reboot the permissions stayed as they are (TA is still loading)

Actually it must be 2x "unknown" (tad) an 770 according to script.
[Sony Cross-Device General] exvargos:
This script works perfectly on E6853 Z5 Premium! thanks!

However I do run into an issue where I can’t seem to get recovery. I first run your tool on a fresh kernel.sin, then run tobias’s rootkernel to patch ric, dm-verity, and install twrp. I then flash the final result with fastboot. With my ta img in the right place, the security service test passes perfectly and the phone acts like it has locked bootloader. But when I try to boot into recovery my phone hangs on the Sony boot screen with an orange led light. If I use rootkernel first then your tool, recovery works fine but the security test fails with errors for blob and huks.
[Sony Cross-Device General] zohaib0001:
[MENTION=4120742]munjeni[/MENTION]

After Flash complete firmware with data wipe , now patched boot img worked and my XZ Dual is boot up.

Now i am facing problem of no sim signal

then i put TA.img again in data/local/temp and reboot and its work, sim signal now fine.
[Sony Cross-Device General] exvargos:
Did you copy the ta.img image to the right place and right name? Thats what fixed it for me, a reboot after I adb pushed it
[Sony Cross-Device General] x_one:
FINALLY! I've solved it! [MENTION=4120742]munjeni[/MENTION] thank you for your grate PoC (or maybe serajr called it better PoA) and patience.

After many tests I've forgot to check chown of the TA.img file.

Because kernel don't copy copy TA.img filr to /data/local/tmp I've copied it by myself and chmod it to 640 but forgot change owner to tad.

Feel so dumb!

Now all is working on pure stock MM.

Now I need check if everything is working as I need to.

Thank You :)
[Sony Cross-Device General] zohaib0001:
Thanks its work now

i put TA.img again in data/local/temp and reboot and its work, sim signal now fine.
[Sony Cross-Device General] munjeni:
Agua m4 is now supported!
[Sony Cross-Device General] wzhy:
Hey, I remember I have meet a bug before.

When we use PoC kernel with a factory reset and boot up will see this bug. Because of when first boot system will read many unit from TA for some configure, such as mac addr or some others I have not found. So when you boot up, you wii find the wifi mac addr is invalid. Also look at Service Menu--Service info--WLAN MAC addr info. misc TA's value is your real mac addr, but system's value is empty.

I dont think it could be fixed until we could make a workaround that mount /cache oe /data earlier.

So i suggest DO NOT USE PoC KERNEL when you are on the first boot up!
[Sony Cross-Device General] munjeni:
Why you factory reset when using poc? This is known to be non working because TA.img is on data partition and will go wiped when data gets wiped
[Sony Cross-Device General] wzhy:
emm, its my first time using PoC. and that version can auto copy TA.img to data. So I just meet this bug because I just unlock bl and fastboot wipe my data:crying:
[Sony Cross-Device General] x_one:
POC will copy TA.img indeed, but after wipe you don't have local/tmp folders on /data so kernel can't copy it to desire folder. :)
[Sony Cross-Device General] wzhy:
/data/local/tmp will creat by init.rc:) I just tell you this, nothing else meaning.

BTW [MENTION=4120742]munjeni[/MENTION] Can I post your tool on chinese bbs? also my modify sdcard way. lots of chinese guys still using drm fix and didnt know there is a new tool
[Sony Cross-Device General] munjeni:
Yes you can in case:

You can use modify or whatewer but link to author thread please do not miss
[Sony Cross-Device General] wzhy:
thanks I know
[Sony Cross-Device General] munjeni:
It will recreate folders by .rc scripts, but problem is that factory reset which deletes whole data folder including ta.img so old one TA.img (from ramdisk) gets copied to data. In general no problem at all, we just need status "locked bootloader"
[Sony Cross-Device General] wzhy:
About factory reset, what does sony do when do factort reset via Settings app? I found an exec in init that read TA unit "TA_DATA_WIPE" or something like this, then run wipedata binary. what does wipedata do?Is this need recovery format data or just wipedata binary del all files from userdata?
[Sony Cross-Device General] munjeni:
fota recovery read an specific unit from trim area and in case unit say "time for wipe" :) it formats whole userdata including userstorage (not 100 percent sure since didn't analysed)
[Sony Cross-Device General] wzhy:
Im using SuperSU-2.79 without SR ansd works fine. Confirm qcom-post-boot runs by init and exit with status 0. All is fine:)
[Sony Cross-Device General] levone1:
[MENTION=4120742]munjeni[/MENTION] - I get 'script didn't return 0' error with this 7.1.1 boot IMG...

https://mega.nz/#!s9snmSgC!CP7Ruq3jqZYzciXWmh5nW97QGr1AJlfh-gnEDjDQAy0
[Sony Cross-Device General] munjeni:
Not a poc isue! Even without poc I have hard time testing which of the supersu version working for me
[Sony Cross-Device General] munjeni:
I will check!
[Sony Cross-Device General] munjeni:
New version is out, it is supported now! Thanks!
[Sony Cross-Device General] levone1:
Thanks. Worked for new boot creation, and booted fine, but no sim now. Copied ta to /data/local/tmp and tried with several different permissions. Also no output in dmesg. Here's new boot IMG, if it helps.

https://mega.nz/#!hssBHYLb!FHcqHQmIrXyKcx2__OOMdH6YKAONdrXkt3YfNuEU_WQ
[Sony Cross-Device General] :
in your boot.img no TA.img , so it is not clear what is wrong.

need dmesg and syslog ( adb shell logcat ) from very start of phone boot.
[Sony Cross-Device General] munjeni:
The_laser ir right, you do not have TA.img inside your new_boot.img, I am still confused how that is possible :confused: Because of that thing even it must work because you copied your ta manualy and by the way of this it must work (in your case nothing is work):

if [ -e "/data/local/tmp/TA.img" ]; then
chown 2997.0 /data/local/tmp/TA.img 2>> ${LOG}
chmod 0660 /data/local/tmp/TA.img 2>> ${LOG}
fi

I do not have idea whats going on on your side, can't help sorry
[Sony Cross-Device General] levone1:
Ok. Thanks... I'll try again with same kernel and see if I can get more info.
[Sony Cross-Device General] up2dateneurosis:
Munjeni I just wanted to thank you again for the tool :)

And just a little question: is it still needed to manually copy the TA file to the temporary folder after the modified kernel has been flashed?
[Sony Cross-Device General] Hamidreza2010:
No its not need

Tool do that for you :D
[Sony Cross-Device General] levone1:
Ok, tested again and same result. I noticed this time that new boot IMG is 10mb, while original boot IMG was 20mb. I wondered if it's maybe because of SuperSU systemless root, but I had that on previous ones and didn't cause any problem. I can try again, using poc before SuperSU, if you think good... Dmesg shows no output at all...

Log from poc is here

https://pastebin.com/b5MHDU6V

Original boot IMG here

https://mega.nz/#!cltXGILQ!jcd5XQqmgA8QEqd-1aG1uxHOsv9YikhPsQCn3FvR-n4

Thanks
[Sony Cross-Device General] munjeni:
Hi, this is error:

Found string in ramdisk/.subackup/0002_init.rc@0750
ramdisk/init.rc@0750
patching ramdisk/.subackup/0002_init.rc@0750
ramdisk/init.rc@0750
sed: unmatched '!'

after that found that init.rc@0750 is not patched! Will try to fix!
[Sony Cross-Device General] levone1:
result with new version for me is error 'no ta in stufs folder... script didn't return 0...' Tried copying ta manually, but auto deleted.
[Sony Cross-Device General] munjeni:
Excatly what I thinked :) Your system didn't allowed busybox to copy TA.img to the stufs folder! Probably it have no admin rights or probably you have an antivirus which prevent TA.img to go to the destination! Have no other ideas. You probably need to "properties" busybox admin rights, or probably to disable antivirus when you doing patching
[Sony Cross-Device General] levone1:
I'm going to keep working on it, but so far I've tried on 2 computers, both of which I used with poc before, with no problem, and tried disabling av, changing folder and file permissions/access, run as admin, etc, and every time same. Is there any changes in scripts, etc.?

Thanks
[Sony Cross-Device General] munjeni:
All commands "busybox cp -fr" from scripts fail on your operating system, have no idea how it is possible. What is your operating system? Can you post poc log?
[Sony Cross-Device General] levone1:
Ok, I'll get some logs, etc... Meantime, I edited patch_things script to put a pause in before 'no TA in stufs' message, so I could move TA manually before script continues, but still the same, so I deleted the line about 'if no TA then exit...' and script continued, and new boot IMG created successfully. However, still only 10 mb. I haven't tried flashing it yet, but guessing it's the same as before...
[Sony Cross-Device General] munjeni:
Boot.img which you posted is not a true 20mb! If you open it with hex editor you can see 10mb woth null bytes :) If you compress it with any archiver it will go to 10mb, so don't care about size since probably somebody made it by dumping whole boot partition including all free space :)

You must figure out why cp (in case ta_param=0) or cat (in case ta_param=1) fail to copy TA.img to stufs folder!

Edit: you didn't say what is your operating system on your pc
[Sony Cross-Device General] levone1:
Os is Windows 7, and Windows 10, (2 computers). Both have worked fine with poc with at least 5 different boot IMGs with no issues copying TA until latest version...

Thanks for info about empty space. I'll try flashing the new boot IMG and see if any different. TA was in stufs folder when I got script to run, so maybe ok...
[Sony Cross-Device General] levone1:
So flashed new boot IMG, created with modified script, and same result. No sim. TA was copied to /data/local/tmp, and TA is included in boot IMG in /initrd/stufs. No output in dmesg...
[Sony Cross-Device General] Bloodlvst:
This thread is making me extremely jealous that I'm stuck with "Bootloader unlock allowed: No" hahaha
[Sony Cross-Device General] kientrongtran:
Yes i ran into the same problem as you. I remembered with previous versions when there has not dialogues to choose kernel and TA partition yet, the whole thing runs without a hitch, but the latest version might be faulty somewhere. My OS is Windows 10 Creator Update, disabled Windows Defender, tried running the command in administrator mode but still to no avail :-

installing ramdisk/stufs/TA.img
cp: can't stat 'TA.img': No such file or directory
Error! No TA.img in stufs folder!!!
command ret: 1.
Your script didn't returned 0, please check your script!
[Sony Cross-Device General] levone1:
​

I got it to compile using modified script, but get no sim issue when flashing new boot IMG. I can share script if you want to try...
[Sony Cross-Device General] munjeni:
Log from win10? Seems your os is detected as a linux! Cp is used in case windows=0 but in case windows=1 cat command is used instead of cp. Seems I will use prompt for os instead of autodetection
[Sony Cross-Device General] cee43ja1:
Found out that POC is not removing the drm fix from the older kernel. If you looked at my output, it completely skips "Searching for old drmfix and removing...". Most likely due to using an older version of the drm fix.

Here is the link to the older kernel, so you can replicate the exact same thing

https://drive.google.com/file/d/0B0j3VJ1Xp5N8OExxTnU2Qm5LUkE/view
[Sony Cross-Device General] munjeni:
boot.img which you posted doesn't contain drmfix! So skip is expected :)
[Sony Cross-Device General] munjeni:
Found causal of "no TA.img"... its because patch_things.sh expect TA.img to be in the same dir with ta_poc, but probably your TA.img trought dialog wasn't in the same directory :) I will fix that bug! Thanks!
[Sony Cross-Device General] levone1:
New version worked, but I got bootloop... Boots to Sony screen, then yellow led changes to red, then reboot. I installed recovery in poc, and when I hit volume key at yellow led, yellow turns to blue, then switches to black screen, whether volume down or up, (however, I haven't had a successful boot to recovery on Z1c with N yet anyway - I just keep a CM12 boot img on hand for recovery...)

here's poc log:

https://pastebin.com/vB7x1gSj
[Sony Cross-Device General] munjeni:
You must flash new_boot.img since temporary booting with fastboot boot is not working! If not working I will need last_kmsg!
[Sony Cross-Device General] levone1:
Will try fastboot... I was just copying to phone and using Rashr, (which I thought was the same as 'flash boot', bit maybe wrong).
[Sony Cross-Device General] munjeni:
After latest few changes which I done for compatibility reason I have messed up dm verity patcher, ric patcher, force encrypt patcher, now it is fixed and new version is out!
[Sony Cross-Device General] munjeni:
I had problem with many recoveries, the most not worked, but this one which I'm using for Z1C works for me, you can try!
[Sony Cross-Device General] levone1:
I'll try it out. I was thinking problem might have to do with having flashed KK 108 with Flashtool recently... Not sure
[Sony Cross-Device General] wzhy:
As we can boot FOTA kernel manually, I prefer for using FOTA kernel than recovery in normal kernel.
[Sony Cross-Device General] webslasher:
I'm late to the party and still trying to grasp how to make this work.

IF I have unlocked bootloader device stock ROM, and I want to use this to restore my DRM.

I tried running this tool anyway and got a new_boot.img

so far, my analysis is:

I need a kernel image and recovery for my device, I'm currently using Z5, I got a recovery and Androplus kernel which based on stock kernel, got these

when I run the script, It asked me which kernel I want to use, so i pointed it to Andropluskernel.img, it also asked for my TA backup which fortunately I have.

The script ran and detected that androplus has drmfix integrated in it and removed it.

Script also prompted me to put recovery.img into ta_poc folder, which I did and I pressed yes when it asked me if i want to install recovery

Now I have new_boot.img in the folder, So, I just flash it on fastboot mode and kernel and recovery should be running ?

will this survive new kernel and rom flash?
[Sony Cross-Device General] munjeni:
95% it will work! Yes, just flash it with fastboot

If you flash new rom over your current rom it will overwrite your new_boot image! Just patch (poc it) and reflash that new kernel
[Sony Cross-Device General] snaky90:
With this ta_poc (latest version) magisk is compatible ? For pass safetynet
[Sony Cross-Device General] Hamidreza2010:
bro this recovery work very good just 1 question:

why when i connected device to pc ( when im in recovery ) , device connected in MTP mode ?

i cant transfer file with this way.how can i change it to something else ( dont know , which one is better )
[Sony Cross-Device General] x_one:
Try it and give us feedback .. :)
[Sony Cross-Device General] Niterain:
Root with phh's SuperUser

Did anybody root successfully with phh's SuperUser after patching the kernel with TA PoC?

I've tried flashing superuser.zip in TWRP, but resulted in a bootloop and had to re-flash the kernel.

I'm running Nougat 32.3.A.2.33 on my Z5 Dual, TA PoC and rooted with SuperSU. It's working fine, but I would like to try SuperUser.
[Sony Cross-Device General] shoey63:
Try this View attachment recovery.zip

You can install the zip in recovery. It flashes to FOTAKernel, so after you need to turn off phone, wait 10 seconds and reboot holding power plus vol. down. Then release after vibration. You can select USB storage in mount menu, and it's much quicker.

Edit: Z5 only!
[Sony Cross-Device General] Hamidreza2010:
thanks a lot bro

just 1 question:

if i use this recovery with poc ( for add to kernel ) , can i enter to this recovery via vol + ?

i mean press power button and then press vol + for repetative
[Sony Cross-Device General] fluffi444:
No. Twrp in PoC is fota recovery.

Not true ;)
[Sony Cross-Device General] munjeni:
TWRP in PoC is NOT a fota recovery! :)
[Sony Cross-Device General] Hamidreza2010:
So now can i do it or not ? :confused:
[Sony Cross-Device General] munjeni:
Please clarify your question better, I not understand what you need! You must understand diferencie between fota recovery and recovery from android ramdisk. Fota recovery is dedicated recovery which completelly runing from separate partition. It have its own kernel and true recovery ramdisk. Android ramdisk recovery (curently which we using with poc) is totaly diferent thing, its something like hack, its recovery runing on top of the android kernel, it just extracts overwriting androod ramdisk. So question is which recovery you mean?
[Sony Cross-Device General] fluffi444:
Yes. Sorry. Took wrong words. It's the same file which is used in PoC or for fota flash. But PoC uses this as kernel included recovery...

Sorry again.

Made an short summary of available recoverys some days ago. Not 100% technically complete but still an overview...

https://xdaforums.com/showthread.php?p=71446796
[Sony Cross-Device General] whalesplaho:
Recovery added with poc can be access using vol- or vol+, both ll work....
[Sony Cross-Device General] shoey63:
Why not? There is a recovery.img inside the zip. Just use it to make a new Poc kernel. It will work the same as any other recovery.img ie: press vol. up or down during reboot when led comes on.
[Sony Cross-Device General] TimeIsAll:
Noob here lol, how do i install this?
[Sony Cross-Device General] juanpirulo:
also i need some help, little bit of noob on unlocked bootloaders. I allready make a boot.img and flash by fastboot but sim not working. I unpacked the boot.img and allready check there is on init.d/stufs the ta.img so i think the boot.img is fine. So probably I am doing something wrong in the way i am doing the flashing. so I explain what i did.

I was running a deodexed stock rom with supersu then i unlocked my bootloader and fastboot the boot.img the phones boot normally but seems like the ta.img its not working Security on services test say none and model unknown . any help . cheers

I copied manually ta.img into data/local/temp give permission -rw-rw-rw and now its fine but lock the bootloader
[Sony Cross-Device General] whalesplaho:
I dnt know whats wrong..... I use poc to patched moi kernel but i tried checking if busybox is installed and it shows no and no path too...
[Sony Cross-Device General] shoey63:
Hi bro[emoji1] . Got my Z3 up and running again. Unfortunately ended up in an horrific bootloop with latest version on MM. 291. Maybe Shinano boards need some extra work.

Edit: Can't get logs due too bootloops. Any Z2 users not having issues?