FORUMS
Remove All Ads from XDA

[TOOL][Windows,Linux,Android,Apple] Unpack any Sony firmware file

8,794 posts
Thanks Meter: 21,670
 
By munjeni, Senior Member on 1st January 2017, 06:46 PM
Post Reply Email Thread
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://forum.xda-developers.com/sho...postcount=1985

Credits:
- I must give credit to @Androxyde 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
Attached Files
File Type: zip sony_dump_tool.zip - [Click for QR Code] (2.38 MB, 188 views)
The Following 72 Users Say Thank You to munjeni For This Useful Post: [ View ] Gift munjeni Ad-Free
1st January 2017, 08:23 PM |#2  
Senior Member
Thanks Meter: 246
 
More
I don't have a Sony smartphone and probably won't use your tool but really thank you for that tool 😊

Sent from my Redmi Note 3 using Tapatalk
The Following User Says Thank You to Ahmad Tawfik For This Useful Post: [ View ] Gift Ahmad Tawfik Ad-Free
1st January 2017, 09:31 PM |#3  
munjeni's Avatar
OP Senior Member
Thanks Meter: 21,670
 
Donate to Me
More
Update: Now sin can be extracted!
The Following 5 Users Say Thank You to munjeni For This Useful Post: [ View ] Gift munjeni Ad-Free
1st January 2017, 09:52 PM |#4  
munjeni's Avatar
OP Senior Member
Thanks Meter: 21,670
 
Donate to Me
More
Quote:
Originally Posted by Ahmad Tawfik

I don't have a Sony smartphone and probably won't use your tool but really thank you for that tool 😊

Sent from my Redmi Note 3 using Tapatalk

You can extract boot.img with it!
The Following 4 Users Say Thank You to munjeni For This Useful Post: [ View ] Gift munjeni Ad-Free
1st January 2017, 10:19 PM |#5  
Hamidreza2010's Avatar
Senior Member
Thanks Meter: 475
 
More
Quote:
Originally Posted by munjeni

You can extract boot.img with it!

bro first thanks for your great tool.
you mean with this tool we can unpack kernel yes? ( with those command )
then how can repack it ( after do our change ) ?
sorry if this question is nooby
1st January 2017, 10:27 PM |#6  
munjeni's Avatar
OP Senior Member
Thanks Meter: 21,670
 
Donate to Me
More
This is for unpacking only. You can read xda contain ton of tutorials related to how to pack boot image, just search please
The Following 4 Users Say Thank You to munjeni For This Useful Post: [ View ] Gift munjeni Ad-Free
1st January 2017, 11:05 PM |#7  
munjeni's Avatar
OP Senior Member
Thanks Meter: 21,670
 
Donate to Me
More
Update:
now tool is able to extract any sin file and output it to converted.file
The Following 6 Users Say Thank You to munjeni For This Useful Post: [ View ] Gift munjeni Ad-Free
2nd January 2017, 11:15 PM |#8  
munjeni's Avatar
OP Senior Member
Thanks Meter: 21,670
 
Donate to Me
More
Sorry sin version 3 is not supported, I am working on it, only sin version 1 & 2 by now!
The Following 4 Users Say Thank You to munjeni For This Useful Post: [ View ] Gift munjeni Ad-Free
3rd January 2017, 01:30 PM |#9  
munjeni's Avatar
OP Senior Member
Thanks Meter: 21,670
 
Donate to Me
More
Now sin version 3 with lz4 compressed data is supported! Report bugs please if you get!
The Following 3 Users Say Thank You to munjeni For This Useful Post: [ View ] Gift munjeni Ad-Free
3rd January 2017, 02:32 PM |#10  
munjeni's Avatar
OP Senior Member
Thanks Meter: 21,670
 
Donate to Me
More
New version, improved non compressed sin files extraction, now for example 1.5 gb system.sin files can be extracted in just some secconds, amazing
The Following 3 Users Say Thank You to munjeni For This Useful Post: [ View ] Gift munjeni Ad-Free
3rd January 2017, 04:02 PM |#11  
munjeni's Avatar
OP Senior Member
Thanks Meter: 21,670
 
Donate to Me
More
Now versions for:
- Linux
- arm
- arm with pie
- Windows
The Following User Says Thank You to munjeni For This Useful Post: [ View ] Gift munjeni Ad-Free
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes