[Sony Cross-Device General] munjeni:
Disclaimer:

Our tool was made for testing and educational purposes, ME is not responsible for what you have doing using our tool, you must agree that you using our tool on your own risk, I am not responsible for anything or anything else you doing/do with using our tool!

Hello! I have made universal tool which is able to extract any format of the Sony image. Also tool is able to dump and extract directly from block device. After 20.Jan.2017 we are able now to convert sin file on the fly and flash it directly to block device. Supported formats which tool is able to deal with:

1. sin v1

2. sin v2

3. sin v3

4. sin v4

5. sin v5

6. img

7. elf

How to use:

since this is a command line tool, you must run it trought an batch file or trought your command line, e.g:

sony_dump DESTINATIONFOLDER PATHTOTHEFILE

sony_dump out kernel.elf

sony_dump out boot.img

sony_dump out kernel.sin

sony_dump out /dev/block/platform/msm_sdcc.1/by-name/boot (android version only)

sony_dump out /dev/block/platform/msm_sdcc.1/by-name/FOTAKernel (android version only)

sony_dump out anysinfile.sin

for flashing sin file to block device e.g: sony_dump /dev/block/platform/msm_sdcc.1/by-name/system system.sin

Enjoy!

Changelog:

- 01.Jan.2017 -> implemented sin to elf converter, now kernel.sin can be extracted

- 01.Jan.2017 -> now any sin file can be converted to converted.file

- 02.Jan.2017 -> now sin version 3 with lz4 compressed data is supported

- 02.Jan.2017 -> improved non compresed sin files extraction

- 02.Jan.2017 -> some cleanups ; now arm version, arm version with pie and linux version

- 04.Jan.2017 -> fix large sin files extraction, curently I have removed arm and windows version of the program since I have no idea how to get LFS working on non 64bit platform, so last one is for Linux 64-bit platform only until I find a way to write files bigger than 2gb :( If you have working example tell me please!

- 05.Jan.2017 -> LFS fixed, now tool generates valid system.ext4 from uncompressed sin, suuport again for linux, for arm, for windows, tested only on linux and windows by now, tool support by now large files (LFS) and propertly generates output. If you find bugs please report. Tommorow hope fix for compressed big sin files

- 07.Jan.2017 -> finished. Now all types of the sin files can be extracted. Sin files decompression fail on 32 bit machines/devices if output file reach 0xffffffff bytes so everything after output of the 0xffffffff bytes is not a valid, I have no idea which toolchain have full 64 bit support on 32 bit platform so I am unable to make LFS (large files support) on 32 bit platfom. File output which is smaller than 0xffffffff bytes is valid on 32 bit platform. But on any 64 bit platform tool working flawless and you can extract any sin file so no problem with LFS and etc! I have tested on win10 64 bit and ubuntu 64 bit and can confirm that any sin files is extracted correctly. Tried on android 32 bit but file output which is smaller than 0xffffffff bytes is a valid but till after file reach size of the 0xffffffff bytes is no more valid! Have no idea why. Not tried on 64 bit android but I am pretty sure it will work the same like on 64 bit windows and 64 bit linux.

- 07.Jan.2017 -> while compared extracted sin with one of the flashtool I have noticed one or two blocks missing in my output file :(, it was since whileloop was wrong in one case, done some right small changes and now all case is ok, file is identic to one from flashtool

- 08.Jan.2017 -> Finally tool is abble to work on booth 32 bit and 64 bit linux, android and windows machine by fully supporting LFS

- 12.Jan.2017 -> sony_dump, detect file extensions in sin

- 12.Jan.2017 -> small tool for convert file_contexts.bin (binary) to file_contexts (textual)

- 15.Jan.2017 -> removed part of the old mechanism related to sin version and file size detection, in some case cache.sin was failed to extract since file size calculation was wrong, now definitelly any sin file can be extracted

- 20.Jan.2017 -> redesigned a way for extracting boot.sin files, now it extract elf instead of unpacking it fully, so if you need to unpack fully just rerun tool with elf file. Also now we can convert on the fly and flash any sin file directly to block device

- 01.May.2017 -> support for sin version 1 & 2, some improvements for ver 3

- 18.May.2017 -> compiled for mipsel 32bit & 64bit (litle endian), mips 32bit and mips 64bit (big endian), linux 32bit & 64bit, arm 32bit and arm 64bit, windows, all is static without dependencies

- 07.Jun.2017 -> support for sin version 4

- 24.12.2017 -> apple x86 and apple i386 support

- 12.06.2018 -> sin version 5 support

- 13.06.2018 -> self implemented custom sparse format (no more need libsparse) because had problem with out of memory extracting large sin files

- 17.06.2018 -> fully implemented sin v5, removed mips and mips64 big endian builds (because my tool not support that)

- 17.10.2019 -> some sin files produce wrong ext4 file, fixed now. Removed osx support right now, if you need it download source code from git and compile by self, I have no free time to mess with it

- 18.10.2019 -> another bug discovered, ext4 padding on some sin files was missing, fixed now

- 20.10.2019 -> some updates, osx binaries now included

- 03.11.2019 -> propertly unpack ext4 images, this include extra bytes at the end of ext4, it is realy need if you going to fully emulate sony gpt disk inside virtual machine ; inflate progress bar

Small tool for converting binary->plaintext plaintext->binary file_contexts:

- https://xdaforums.com/showpost.php?p=70881172&postcount=1985

Credits:

- I must give credit to [MENTION=2807379]Androxyde[/MENTION] since I have looked into his java source code for understanding lz4a commpresed sin's, thanks for open source, I realy appreciate your hard work on flashtool!

Source code:

- https://github.com/munjeni/anyxperia_dumper