yashsingh1/xdaforums huggingface dataset:
[Sony Cross-Device General] munjeni:
More portable way would be looking for example to adbd in sbin or maybe something better (have no idea by now which one exist on every ramdisk), but we can do thing by reading 5th byte from binary (elf) file with hexdump, see diferencie between 32bit and 64bit elf https://en.wikipedia.org/wiki/Executable_and_Linkable_Format

0x04	1	e_ident[EI_CLASS]	This byte is set to either 1 or 2 to signify 32- or 64-bit format, respectively.

5th byte when 1 mean 32bit elf

5th byte when 2 mean 64bit elf

So we can read it with for example:

hexdump -n 1 -s 4 -e '"%d"' ramdisk/sbin/adbd@0750

Edit:

I will change that part in your script modification
[Sony Cross-Device General] munjeni:
Just install new_boot.img and use recovery to install supersu/superuser, I think it is definitelly better idea :)
[Sony Cross-Device General] serajr:
Useless imho!

So am I.
[Sony Cross-Device General] serajr:
Please bro, do that! Keep im mind scripts I wrote are always for showing you something we can improve, final ones are always yours!

I got bootloop with busybox/keycheck you provided.
[Sony Cross-Device General] munjeni:
Changed to this:

local platform="32"
local adbd=$(find_file $RAMDISK/sbin/adbd)
if [ ! -z $adbd ]; then
[ "`perform hexdump -n 1 -s 4 -e '"%d"' $adbd`" == "2" ] && platform="64";
fi
ui_print " Platform: $platform bit"

since adbd definitelly exists in every recovery ramdisk I think than it will be more portable right?
[Sony Cross-Device General] serajr:
I really didn't understand it too! :confused:
[Sony Cross-Device General] Hamidreza2010:
is need to found correct vol key for put into init ?

i set 114 replace with 42 but didnt worked

i found my correct key ( 114 and 115 ) already
[Sony Cross-Device General] serajr:
Absolutely right! :good:
[Sony Cross-Device General] munjeni:
New version is out, included all serajr modifications, thanks!
[Sony Cross-Device General] munjeni:
Mate extract keycheck (keycheck64 if you have 64bit device, or keycheck32 if you have 32bit device), upload it to your phone /data/local/tmp folder, change permission, execute it, press volume up and see result, execute again & press volume down, see result. Use results to change init.sh script value 42 to one you got
[Sony Cross-Device General] Hamidreza2010:
bro i push keycheck64 to /data/local/tmp and set permission to rw-r-r but when i want to execute it i saw this:

how should i do?
[Sony Cross-Device General] munjeni:
Do it with terminal emulator!

cd /data/local/tmp
chmod 755 keycheck64
./keycheck64
[Sony Cross-Device General] munjeni:
Sorry forgot to fix something, new version again :D
[Sony Cross-Device General] Hamidreza2010:
bro i did it and here is attachment

is 139 my correct vol key?
[Sony Cross-Device General] munjeni:
Seems keycheck64 crashes on your device! Can you try keyckeck32 ?
[Sony Cross-Device General] Hamidreza2010:
ok i try now and let you know

just 2 minutes

---------- Post added at 08:30 PM ---------- Previous post was at 08:25 PM ----------

bro i try and same result.

i check that path and see the keycheck64 or keycheck32 permission was rwxr-xr-r
[Sony Cross-Device General] munjeni:
Hmm, something is happening with it on your device, crashes, I have no idea why :( Error 139 is segmentation fault, thats not your key! Can you try busybox64 and busybox 32 on your device?
[Sony Cross-Device General] Hamidreza2010:
Off course .why not

just please tell me what should i do?
[Sony Cross-Device General] munjeni:
the same like with keycheck but with busybox

cd /data/local/tmp
chmod 755 busybox
./busybox
[Sony Cross-Device General] Hamidreza2010:
bro there is no busybox in that path

you mean i push busybox32 in that path and then try with terminal

if not work try this just with busybox64?
[Sony Cross-Device General] fluffi444:
Used last Tool...

Recovery is working! Great work guys! Love to see that outstanding teamwork here in this thread! :good:

But: Phone is not booting to system - had this also with version before the last one

It's took some time while SONY logo is visible and then automatic start of recovery.

Booting to system not possible - Even from a clear shutdown and restart.

dmesg.log - But I guess this is from my last working boot! Maybe not usefull.

http://pastebin.com/epzZr5YS

recovery.log - from booted recovery with last tool

http://pastebin.com/tqqreYhR
[Sony Cross-Device General] Hamidreza2010:
I did it with both busybox ( 32 and 64 ) but same again

dont know whats problem
[Sony Cross-Device General] munjeni:
Ohh, seems my hex modification cause crash, sorry but can you try this one?
[Sony Cross-Device General] Hamidreza2010:
just 1 min
[Sony Cross-Device General] munjeni:
Is poc detected another busybox during recovery install?
[Sony Cross-Device General] Hamidreza2010:
I think it works

when i press vol up / down

show me:

42 l E6633:/data/local/temp # >

if you need i can put screenshot here
[Sony Cross-Device General] fluffi444:
yes...

Tool output:

http://pastebin.com/3gx8qdfV
[Sony Cross-Device General] munjeni:
No need, pie hak caused crash on all binaries from binaries folder, wth :( You no need to change key its 42 definitely on your device (on almost all) , next version will form for you and hope will solve isue to no android boot, wait ten minutes I going to revert that mess OMG

Pie hak on 32 bit working ok, but seems on 64 bit not, probably it will work on static 64bit binary
[Sony Cross-Device General] munjeni:
Let me know with new version

Hmm maybe that busybox isue? Let me know with new version whats going on

New version is out!
[Sony Cross-Device General] munjeni:
Please try new version, in case you have the same isue please add blue line in install_recovery.sh:

ui_print " Installing $platform bit binaries. . ."
[COLOR="Blue"]busybox=""[/COLOR]

But let me know please first whats going on without any modification!
[Sony Cross-Device General] Hamidreza2010:
I try new version.

final kernel was created successfully but when i press vol up or down it didnt enter to recovery

i saw the different color but phone reboot and cant enter to recovery

dont know whats problem , maybe recovery ? dont know
[Sony Cross-Device General] munjeni:
I have told about some recoveries have sony_init (wtf) which cause recovery bootloop . Ideal thing is to download oficial twrp and it will work in most case! Also you can verify key now in boot-log.txt to be sure key is ok now!
[Sony Cross-Device General] munjeni:
See post above your
[Sony Cross-Device General] Hamidreza2010:
here is my bootlog

which one is correct for me?

114 or 115 ?

http://pastebin.com/69g3D2b1
[Sony Cross-Device General] munjeni:
OMG mate! Why? Did your read our thread? Why you use tobias tool? I have told few times that I not supporting anything out of my poc, please...

Use only my poc! Download oficial twrp from twrp site and rename to recovery.img, put it in the same folder with ta_poc, run poc and on recovery prompt install recovery, thats all, do not use tobias tool, no need! I not suport it, and not going to suport it!
[Sony Cross-Device General] Hamidreza2010:
sorry bro its not for now

its for 1 month later

for now i add busybox line but nothing change

i try to search offical twrp for my device

thanks again . finish my 8 thanks times
[Sony Cross-Device General] munjeni:
:confused:
[Sony Cross-Device General] munjeni:
You used tobias tool mate I see bootimg tool in your log! Its tool not from my poc! Its part of the rootkernel tool from tobias. My tool now have suppprt for recovery, so do not use anything other than poc, and read thread please! I lost one hour for nothing, you too :(
[Sony Cross-Device General] Hamidreza2010:
bro believe me i used just your poc

that log is not for today

its for 1 month ago.

your poc support recovery now but i used 2 different recovery,img but didnt work at all

there is no offical twrp in that site for xperia z5

anyway thanks for all your work and time
[Sony Cross-Device General] fluffi444:
Last Version without modification did not work. Same behavior. Yellow LED and short red and then reboot to recovery.

BUT: With blue line added it works! Yellow LED and noticible longer red LED and system booting!!! :good:

Used official TWRP from TWRP Crew site https://dl.twrp.me/z3c/twrp-3.0.2-0-z3c.img.html
[Sony Cross-Device General] serajr:
This one may meet your needs! Also users reported that it does work on N as well.
[Sony Cross-Device General] x_one:
What is the point of posting old dmesg.log? How it can help solve your problem?
[Sony Cross-Device General] Hamidreza2010:
Yes I saw it before

And also used androplus twrp

Both of them work well separately but when I put them ( one by one) in poc folder and do process, can't enter to recovery and reboot at Sony logo

For found correct vol keys
[Sony Cross-Device General] Hamidreza2010:
No officiall twrp for z5
[Sony Cross-Device General] zohaib0001:
[MENTION=3989065]serajr[/MENTION] [MENTION=4120742]munjeni[/MENTION]

Can you make a script to change SELinux mode between enforcing and permissive ?

While patching kernel through POC.

It is possible ???

I used new version on Xperia XZ Dual running Nougat 7.0.

whenever i press volume up or down to go into recovery my phone stuck on Sony boot logo, and did not boot the recovery.

here is the dmesg.log http://pastebin.com/5FeDDZDy

If you need any recovery log also then please guide me how can i get them ?
[Sony Cross-Device General] shoey63:
[MENTION=4045998]zohaib0001[/MENTION]

Scripts and command line hacks don't work on N and Mm for 64 bit devices. Kernel needs to be built from source with enforcing disabled.
[Sony Cross-Device General] munjeni:
I can't get you sorry but you must be a bit specified and detailed, and please read
[Sony Cross-Device General] munjeni:
True, nougat init binary not allowing permissive mode, instead reboot to recovery happens. Probably init binary hacking will need for that
[Sony Cross-Device General] munjeni:
I saw a lot of denials in your dmesg, will check that! Did you saw blue light after you press volume button before entering into recovery?
[Sony Cross-Device General] serajr:
What I don't understand is that XZ and XP share same kernel and fw number, and everything is working here on mine (XP)!

Did you use stock kernel? And latest official TWRP?

[MENTION=4120742]munjeni[/MENTION], for the init hack, I think you should always install busybox32/64 to /sbin, and do not use the "found" one anymore, once it will always be removed by init script. Just guessing!
[Sony Cross-Device General] munjeni:
That recovery also contain init_sony (Already mentioned about that earlier. I have no idea who done that thing to aosp and cm tree to use with recovery, what is a point of having boot choice init script in an recovery.img I have no idea realy) and that thing break our poc init script and cause boot loop. I have made new poc version, init_sony is now removed from all recoveries, init.real is renamed to init, updated sepolicy a bit, busybox is now mandatory and will be copied whenever an existent busybox is already present poc will install poc busybox anyway. Hope all recoveries will boot now.

Guys new version is out, let me know!
[Sony Cross-Device General] zohaib0001:
Yes i saw blue light after press volume buttons
[Sony Cross-Device General] Hamidreza2010:
Testing Now !!
[Sony Cross-Device General] Hamidreza2010:
I test it new version with 2 recovery

with one recovery , poc removed init_sony from recovery but in another didnt delete it

anyway in both process , phone was bootloop and didnt enter to recovery

PS: sometimes i saw this error , maybe shot useful for you

thanks
[Sony Cross-Device General] munjeni:
Remember, always test recovery.img before you use it with poc! If that recovery.img not working it will not work too on poc! And also do not use tobias tool with my poc, last time I saw in your log bootimg which is not part of the ta poc.
[Sony Cross-Device General] munjeni:
New poc ok now?
[Sony Cross-Device General] levone1:
[MENTION=4120742]munjeni[/MENTION] - tried poc with Lineage 7.1, and got 'script returned 1'. Anything can be done? Boot IMG here -

https://mega.nz/#!k4U1QYJS!0t2fhd7Be5zqB6ON01lZQWNcIAjqR2TSCJrXak-AO-s
[Sony Cross-Device General] zohaib0001:
No its not working...

when i press volume button, I saw blue light for 1 second and after that phone stuck on Sony logo and did not boot into recovery.

http://pastebin.com/YFzJNaMM
[Sony Cross-Device General] Hamidreza2010:
I didn't use tobias tool

Just your poc
[Sony Cross-Device General] munjeni:
Ok, but did you tested recovery.img before patching? And it worked?
[Sony Cross-Device General] munjeni:
Don't know why but for me no errors, see

Trim area dump is a valid.
Locked bootloader.
Deleting old folder ramdisk if exist...
command ret: 0.
New directory ramdisk created.
Using folder "out"
opening C:\Users\homepc\Desktop\ta_poc\bootllll.img
C:\Users\homepc\Desktop\ta_poc\bootllll.img is Android image format.
Dumping to out...
BOARD_KERNEL_CMDLINE console=ttyHSL0,115200,n8 vmalloc=300M user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 dwc3.maxim
um_speed=high dwc3_msm.prop_chg_detect=Y coherent_pool=8M sched_enable_power_aware=1 androidboot.hardware=amami buildvar
iant=userdebug
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_OS_VERSION 7.1.1
BOARD_OS_PATCH_LEVEL 2017-01
Done.
No file exist out/bootllll.img.elf .
Gunziping...
setting up infflate...
infflating...
infflate returned: 0
gzpipe: ok.
unziped: ok.
Extracting ramdisk.cpio...
Runing user script...

Making ramdisk/stufs folder

Found android version equal or greater than Marshmallow.

Making ramdisk/init.ta.sh script

Found string in ramdisk/init.common.rc@0750
patching ramdisk/init.common.rc@0750

installing ramdisk/stufs/TA.img

Found string in ramdisk/init.rc@0750
patching ramdisk/init.rc@0750

Found binary ramdisk/file_contexts.bin@0644
converting ramdisk/file_contexts.bin@0644 to plaintext file_contexts
patching file_contexts
converting plaintext file_contexts to binary ramdisk/file_contexts.bin@0644

Patching ramdisk/sepolicy@0644

Searching for old drmfix and removing...

dm-verity:
dm-verity is already disabled!

Sony RIC:
No Sony Ric.

force-encrypt:
force-encrypt is already disabled!

Install Recovery:
- Install? (Say yes to install) [Y/n] Y
Installing recovery. . .
Platform: 32 bit
No Sony Ric in recovery!
Disabling ric in recovery. . .
Found standard binary recovery/init@0750
Installing 32 bit binaries. . .

Press any key to continue . . .
command ret: 0.
Repacking ramdisk...
ramdisk.cpio done.
Making ramdisk.gz
defflating...
defflate returned: 0
setting up infflate...
infflating...
infflate returned: 0
gzpipe: ok.
gzip: ok.
ramdisk.gz done.
Found kernel dt.
Found QCDT magic string.
Packing new_boot.img
cmdline="console=ttyHSL0,115200,n8 vmalloc=300M user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 dwc3.maximum_speed=hig
h dwc3_msm.prop_chg_detect=Y coherent_pool=8M sched_enable_power_aware=1 androidboot.hardware=amami buildvariant=userdeb
ug"
base="0x00000000"
pagesize="4096"
ramdiskoff="0x02000000"
tagsoff="0x01e00000"
making new_boot.img
new_boot.img created.
Done.

Press any key to continue . . .

Did you modified scripts?
[Sony Cross-Device General] munjeni:
Thanks for dmesg, its usefull for solving remaining denials, but that log is not log about recovery boot loop! I need last_kmsg in order to fix, without right log I can't :(
[Sony Cross-Device General] munjeni:
Thanks! New version is out, hope now it will detect non standard init binary..
[Sony Cross-Device General] Hamidreza2010:
Here is recovery forum :

https://xdaforums.com/xperia-z5/development/twrp-3-0-2-cm-aosp-roms-t3373008

Many users test it

Recovery work well but in poc tool, it's not
[Sony Cross-Device General] munjeni:
But who know, maybe it not working on your's! For example, z1c 2 years ago, some peoples had bootloop on cm rom but some not, problem was figured later till after we found two z1c variants. Vairant 1 had an display, variant 2 had totaly diferent display! Variant 2 had boot loop because display module was diferent! So do not believe everytime, sometimes better idea confirm byself :)
[Sony Cross-Device General] Hamidreza2010:
Hahaha

Your right bro

Test it and comeback here
[Sony Cross-Device General] levone1:
I think I might not have newest poc... I'll try again.
[Sony Cross-Device General] Hamidreza2010:
I test it

recovery work well.i used this recovery:

https://drive.google.com/file/d/0B0j3VJ1Xp5N8UEJiX01qTmJ0dkU/view

i flash via this command :

fastboot flash recovery recovery.img

and test it , its work but in poc tool , not
[Sony Cross-Device General] munjeni:
Did you flash new_boot.img ? Booting new_boot.img is not working, only if flashed it working, hope you know about that? Did you tested new poc related to removal of init_sony? Previous failed on one recovery you said, now ok?
[Sony Cross-Device General] Hamidreza2010:
With new version , recovery installed successfully just 3 question.hope help me one by one.thanks a lot:

1- I enter to recovery by ( power off device and hold power button and vol down ) i want ask cant i use press vol up replace than above way?

2- when i go to recovery , i loos my sdcard.its recovery bug yes? ( my device is z5 dual and i think i use single recovery , ofcourse didnt found any other recovery )

3- i attach for you 1 picture about stop working busybox , its happen more and more.whats that?

https://xdaforums.com/showpost.php?p=71323387&postcount=916

thanks
[Sony Cross-Device General] levone1:
OK, tried again with new poc, and new boot IMG created, and flashed OK. I moved TA.IMG to /data/local/tmp, and booted, and I get no mobile signal. Along with TA.img in /data/local/tmp is a file called 'init.ta-log.txt', which contains this:

init.ta.sh

cp: bad '/stufs/TA.img': No such file or directory

rm: /stufs/TA.img: No such file or directory
[Sony Cross-Device General] munjeni:
1. thats for fota recovery only & you can't replace it since its bootloader related

2. don't know. You need to find a working recory and test it fully before you use with poc & later use with poc

3. try new version from minute ago

So recovery is working for you now?
[Sony Cross-Device General] munjeni:
How? Did you checked ramdisk/stufs folder in poc directory?
[Sony Cross-Device General] oziris11:
Now everything is fine!Great job!:good:
[Sony Cross-Device General] zohaib0001:
How can i get last_kmsg ??? please guide me

i try this command in terminal but its not working: cat /proc/last_kmsg >/sdcard/last_kmsg.txt.
[Sony Cross-Device General] Hamidreza2010:
Yes I can enter to recovery

Just should to find correct recovery for D6633
[Sony Cross-Device General] wzhy:
Make a changelog, Please
[Sony Cross-Device General] Mario.D:
Skickat från min E6653 via Tapatalk
[Sony Cross-Device General] zohaib0001:
[MENTION=4120742]munjeni[/MENTION]

By using latest POC my sim signal gone, My Device Xperia XZ Running 7.0 Nougat

I also try to delete TA.img and reboot device again but no luck.

http://pastebin.com/J4nDLHgG

+ after press volume button i saw recovery screen but screen touch is not working and i was unable to use recovery. i used official TWRP recovery
[Sony Cross-Device General] serajr:
When you see the code below in your dmesg, it's because there is indeed something wrong:

init: Starting service 'exec 12 ([B][COLOR="Red"]/init.ta.sh[/COLOR][/B])'...
init: Service 'exec 12 ([B][COLOR="Red"]/init.ta.sh[/COLOR][/B])' (pid 543) [COLOR="Red"][B]exited with status 1[/B][/COLOR]

Together dmesg log, you could now also share the /data/local/tmp/init.ta-log.txt log too, which will help fix up things for sure (it was introduced for that purpose)!

Also, a good dmesg log is that one generated just after you see the lockscreen (the sooner the better)!

To get "last_kmsg" on android >= MM, try running command below:

adb shell su -c cat /sys/fs/pstore/console-ramoops > last_kmsg.txt

Sometimes generated last_kmsg.txt is empty or has no relevant info, I really don't know why that happens.
[Sony Cross-Device General] munjeni:
Now your dmesg is clean from denials, its ok, but init.ta.sh exited with status 1 which mean error. Can you verify on your device existence of /stufs/TA.img ?? And also can you give me poc log and if possible (per serajr tut) to give me last_kmsg of the failed recovery boot? To get last_kmsg make sure to do it till after next boot since only than last kernel log exist! And also please give me ta_init log which is copied to /data/local/tmp

Edit:

Nev version is out, hope signal get back
[Sony Cross-Device General] munjeni:
Oh man finaly! Thanks!
[Sony Cross-Device General] serajr:
[MENTION=4120742]munjeni[/MENTION] Latest poc version you moved init.ta.sh creation to a file in \binaries folder, which is great! But chown and chmod are missing in the patch_things.sh, and final ramdisk/init.ta.sh file remains with '$ownes' and '$permis'.

I've already fixed this up with pack below:

Edit: New fixed version is out!
[Sony Cross-Device General] shoey63:
TWRP 3.1.0 has just been released!

https://github.com/omnirom/android_bootable_recovery/commit/76958ae984d7c4a963f7673e834d4bae7b4ca939

I have compiled a build for Z5 users but wont have the opportunity to test on PoC tonight due to being late in Australia.

Here it is https://www.androidfilehost.com/?fid=817550096634751692

I can confirm it works by flashing to recovery/FOTAKernel.

Edit: there is no specific recovery for different variants of the same device. What works for one will work for all.
[Sony Cross-Device General] munjeni:
Oh man how stupidly I have moved it, thanks! New version is out!
[Sony Cross-Device General] munjeni:
Huh but for 64bit devices only!
[Sony Cross-Device General] shoey63:
I'll make one for Z1 (Honami?) tomorrow [emoji106]
[Sony Cross-Device General] Dilesh Perera:
Make one for Z2 (sirus) too if u can bro :victory:
[Sony Cross-Device General] serajr:
Hell yeah! :highfive:

Maybe you could build one for XP as well

Edit: And maybe... ;)
[Sony Cross-Device General] Hamidreza2010:
You are great man

Will test tonight

Edit: I test it and works great and also sdcard recognized

thanks again
[Sony Cross-Device General] Hamidreza2010:
[MENTION=4120742]munjeni[/MENTION] bro i still have busybox FC on poc ( win10 x64 )

do you think problem is just mine or public ?

( its not big problem , when i do process again , all thing was ok but i want to solve problem , if its bug )

thanks
[Sony Cross-Device General] munjeni:
Thats busybox isue and can't be solved I think, only replacing it with another busybox win port. Is everything ok now for you poc related?
[Sony Cross-Device General] Hamidreza2010:
yes i think evrything was ok ( i didnt see any problem yet ) just when happen that error , i should exit poc and run it again with all process

ok i try to replace busybox if i found one of them

thanks
[Sony Cross-Device General] fluffi444:
Maybe you should ask here: https://xdaforums.com/z3-compact/general/d5803-z3c-aries-twrp3-0-t3543113
[Sony Cross-Device General] Hamidreza2010:
[MENTION=4120742]munjeni[/MENTION] is need still to do this ?
[Sony Cross-Device General] munjeni:
No I think. But in case something went wrong, no signal etc , it is need
[Sony Cross-Device General] Niterain:
It works on my Z5 (E6683), but external SD is not detected, just like any other recovery flashed to recovery/FOTAKernel that I've tried so far.

tobias.waldvogel's internal recovery integrated in the kernel is the only one that recognizes and mounts the MicroSD Card... :(
[Sony Cross-Device General] whalesplaho:
everything working fine?

i tried with custom kernel but freeze at entering twrp....
[Sony Cross-Device General] koekoek91:
I flashed it with fastboot on my Z5 E6653, but in TWRP it still says version 3.0.2 is this normal?

Anyway thanks for your work mate :good:
[Sony Cross-Device General] shoey63:
You must be using a kernel with an older TWRP integrated.

To enter directly :

- power off phone

- wait 5 - 10 seconds

- power on whilst holding volume down

- wait till you feel a vibration

- release power, then release volume down.

If it still boots to 3.02, then the flash didn't work or you flashed the wrong recovery.img.