yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] luiseteyo:
Hi sir, first of al really thanks for the guide. It was easy, quick and effective. The only problem I found is that I was trying to mod a mm ROM and after unpacking, modding and repacking the dat files, I replaced them in the original ROM zip file, but it gave me an error while flashing (error executing update-binary) do anyone know why? Thanks!!!
[Android Software/Hacking General [Developers Only]] messi2050:
hi i'm building cm12.1 rom for my phone i want to revert to the old flashing method without DAT files but the method found in first page is not working for me any solution ?
[Android Software/Hacking General [Developers Only]] ehsan_zamani_68:
developers help me this link

http://xdaforums.com/galaxy-s4/general/problem-repack-flash-lollipop-rom-i9500-t3317065
[Android Software/Hacking General [Developers Only]] realtebo:
Out of space?

I've decompress my rom in rom/temp and here i've the file_contexts.
Now it's mounted as /mnt/loop

I'm running your tool but I've this problem

$ sudo ./make_ext4fs -T 0 -S ~/roms/temp/file_contexts -l 1073741824 -a system ~/roms/temp/system_new.img /mnt/output/
Creating filesystem with parameters:
Size: 1073741824
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 4096
Label:
Blocks: 262144
Block groups: 8
Reserved block group size: 63
error: ext4_allocate_best_fit_partial: failed to allocate 1682 blocks, out of space?

What am I doing wrong?
[Android Software/Hacking General [Developers Only]] roshan2989:
Hello guys how to revert back to old fashion without dat files compiling for cm13,the link in op seems to be outdated,code has change.
[Android Software/Hacking General [Developers Only]] akhilnarang:
BLOCK_BASED_OTA := false

In BoardConfig.mk

Or export BLOCK_BASED_OTA=false

Or open build/core/Makefile, there's a line --block somewhere, remove the --block
[Android Software/Hacking General [Developers Only]] roshan2989:
you mean this file to false

like this block_based := false
[Android Software/Hacking General [Developers Only]] akhilnarang:
No. I meant set BLOCK_BASED_OTA to false

Otherwise simply remove the --block
[Android Software/Hacking General [Developers Only]] yamraj:
how to repack these files again back to original form?
[Android Software/Hacking General [Developers Only]] ranf:
The bass system.img is squashfs.
[Android Software/Hacking General [Developers Only]] manuhackzzz:
can you give us the steps including screenshots of your version of script ?
[Android Software/Hacking General [Developers Only]] manuhackzzz:
output dat file is onlt of 344 kb how is that possible while system.img is of 1.1 gb size ??
[Android Software/Hacking General [Developers Only]] akbariajay:
repack

hey bro,

i extracted dat file successfully using ext2explore, but i don't know how to repack it folder or it's work repacked using by kitchen.
[Android Software/Hacking General [Developers Only]] Hakan 3:
samsung lollipop and marshmallow system.img's inside odin flashable tar's also using dat compression method ?
[Android Software/Hacking General [Developers Only]] Wuby986:
no symg2img is the method you need to convert to regular img
[Android Software/Hacking General [Developers Only]] Hakan 3:
I made system.img.ext4 for I9295 5.0.1 using make_ext4fs after flashing it stuck at samsung logo whats the problem ? can u help me :crying: :confused:
[Android Software/Hacking General [Developers Only]] Wuby986:
i guess you made some modification so it might be related to that or to the binary you used. i found that the only one that works for me on samsung devices is the built-in in the fw. anyway you flashed with odin or what?
[Android Software/Hacking General [Developers Only]] Hakan 3:
I tried with and without modification and flashed with odin. It flashing completely and stuck on samsung logo I tried all versions of make_ext4fs Im trying 2 days :crying:
[Android Software/Hacking General [Developers Only]] xarmx:
This one works like a charm on CM13 based RR rom. Big thanks!
[Android Software/Hacking General [Developers Only]] Hakan 3:
can anyone help me ? :confused::confused:
[Android Software/Hacking General [Developers Only]] adithyan25:
Try my thread.. A software made using this tutorial
[Android Software/Hacking General [Developers Only]] andii_nr:
[MENTION=5132229]xpirt[/MENTION] I can run on android terminal emulator for extract system.new.dat . a question can I use mount -t ext4 -o loop system.img output/ for mount system.img on android ?
[Android Software/Hacking General [Developers Only]] yash92duster:
---------- Post added at 12:43 PM ---------- Previous post was at 12:41 PM ----------

[/COLOR]

Thank you so much [MENTION=4896512]Alexey71[/MENTION]

Its working and I finally extracted CM system dat files

:):good::good::good:
[Android Software/Hacking General [Developers Only]] andii_nr:
[MENTION=5132229]xpirt[/MENTION] and anyone I want make system. new.dat but error like pic an attach . :rolleyes: how to make it possible with android terminal emulator ? :o
[Android Software/Hacking General [Developers Only]] PlasmaPump:
Still unable to repack the dat.

Windows says rimg2sdat is not a valid Win32 application.

It works under Windows 7 at work but not under Windows XP Pro like I have at home.

Someone got another version? Is there a XP compatible version of rimg2sdat?

Thanks
[Android Software/Hacking General [Developers Only]] gexco:
I put in:

./sdat2img.py system.transfer.list system.new.dat system.img

and get out:

bash: ./sdat2img.py: No such file or directory

something ain't right.

i simply copied and pasted the sdat2img.py into gedit and saved it as the same name, but it in ./ and then ran :

./sdat2img.py system.transfer.list system.new.dat system.img

same result as above

help?
[Android Software/Hacking General [Developers Only]] leel55:
ex2explore doesnt work to me :(
[Android Software/Hacking General [Developers Only]] Alexey71:
THX win8.1 work:p
[Android Software/Hacking General [Developers Only]] Alexey71:
Guys, gathered a simple script, converts and extracts. In Russian and English languages. The main task of Extractor is only to unpack, without installing additional software on the PC. Only Windows 64\32bit ;)

Follow the instructions...

View attachment 4388717

Update script v3.6 - Updated sdat2img (DATE: 2018-10-27 10:33:21 CEST)

Update script v3.5 - Fix 3 settings item

Update script v3.4 - Fix 10 settings item

Update script v3.3 - Updated sdat2img (DATE: 2018-05-25 12:19:12 CEST)

Update script v3.3 - Updated sdat2img (DATE: 2018-05-25 12:19:12 CEST)

Update script v3.2 - Add supported vendor.new.dat.br

Update script v3.1 - Repack sdat2img - https://www.virustotal.com/#/file/5...64c133a65233d7df5effc92fa8dd33f578b/detection

Update script v3.0 - Add convert

Update script v2.9 - Add support "system.new.dat.br"

Update script v2.8 - Fixed compatibility with Windows 32bit

Update script v2.7 - Updated sdat2img (DATE: 2017-08-25 16:20:11 CST)\add support Android 7.0-8.0

Update script v2.6 - Updated sdat2img (DATE: 2016-11-23 16:20:11 CST)

Update script v2.5 - Updated sdat2img (DATE: 2016-09-22 17:44:06 CST)

Update script v2.4 - Updated sdat2img in latest github source

Update script v2.2 - Updated sdat2img

Update script v2.1 - Remove the extra folders, corrected description. add system.img.ext4

Update script v2.0 - add support Android 6.0

Update script v1.7 - fix select items

Update script v1.6 - add system.img, recovery.img, boot.img
[Android Software/Hacking General [Developers Only]] :
What about the reverse process?

How do you reverse this after editing the "familiar system folder" into a lolipop+ compatible update.zip?

---------- Post added at 08:47 ---------- Previous post was at 08:20 ----------

How do I install the sdat2img?

Im on Ubuntu 64 bit?
[Android Software/Hacking General [Developers Only]] xpirt:
please read the OP (and don't quote it all)..

to know if it is 64bit or 32 just look in system details.
[Android Software/Hacking General [Developers Only]] 视线之外:
Hi。I want to know how should i compress the my_new_system.img to system.new.dat
[Android Software/Hacking General [Developers Only]] xpirt:
actually i looked in the source and i think only by compiling it can be compressed, i dont think there's a way to pull the compressing method and do it out of the source.
[Android Software/Hacking General [Developers Only]] halfbytecode:
Nice work. I looked into the install script of a file based lollipop ROM, and it seems there are quite a lot of symlinks (not new in lollipop, I think) but that made me curious.

I was wondering if we have a way to retain the symlinks during extraction. I'm looking into converting the block based ROMs to file based.
[Android Software/Hacking General [Developers Only]] xpirt:
are you building from source?
[Android Software/Hacking General [Developers Only]] halfbytecode:
Sorry I didn't clearly specify it. I'm actually looking to convert the pre-compiled block based ROMs.

I'm thinking of writing a script/tool for generating flashable zips, for supporting F2FS-ALL setting.
[Android Software/Hacking General [Developers Only]] webdroidmt:
That would be a welcome and very useful tool. If it is possible to retain those symlinks, I wish you success with that. :)

Mike T
[Android Software/Hacking General [Developers Only]] Jiggs82:
Is there a way we can do this with our phones instead of using a PC?
[Android Software/Hacking General [Developers Only]] ericlnu:
If you can get Python on it, you can run the script on the phone.
[Android Software/Hacking General [Developers Only]] TheFixItMan:
Worked perfectly well decompressing cm12 for the Moto g lte
[Android Software/Hacking General [Developers Only]] Alexey71:
update v1.1 http://xdaforums.com/showpost.php?p=57742855&postcount=40

corrected launch script from any locations
[Android Software/Hacking General [Developers Only]] ericlnu:
BTW, you can either use one of the binaries in OP (Original Post) or use the script at the GitHub site, as that's just a Python script, and can run if you have Python installed. Most Linux distributions have that installed by default.
[Android Software/Hacking General [Developers Only]] kaikupascual:
Hello!

I try to descompress a system.new.dat with System Extractor V1.1 and work correctly! I can see the folders pri-app, app, etc... with CyanogenMod 12 for Nexus 5...

I want for example... delete some app's and add other app's and modify build.prop... ok, after of change this things... What needs to be done to repack the ROM and use it?, in Android 2.3/4.0/4.1/4.2/4.3/4.4 only unzip the ROM, modify and zip again with 7Zipper or Winrar... I want the same but in Lollipop 5.0...
[Android Software/Hacking General [Developers Only]] janjan:
Great job. It will be very useful if the script do the reverse job too, decompress and compress.
[Android Software/Hacking General [Developers Only]] Alexey71:
Currently it is not possible unfortunately:)

p.s Update SystemExtraktor 1.2
[Android Software/Hacking General [Developers Only]] TimV_:
Is ther also a way todo this on Mac OSX?
[Android Software/Hacking General [Developers Only]] xpirt:
if you have installed python you can download the .py source file from 2nd post and run it on mac too.
[Android Software/Hacking General [Developers Only]] hamzaeid:
nice work:good:
[Android Software/Hacking General [Developers Only]] riahc3:
I have no idea why OP doesn't simply convert the script to a EXE. So easy (sure I can do it but who is to say that I don't put malware in the tool?)
[Android Software/Hacking General [Developers Only]] androcraze:
Or he/she puts malware in the tool?

I think there were .EXE files at one time. As a Linux user, I'm fine with Python scrips.
[Android Software/Hacking General [Developers Only]] BRoy_98:
why this "./sdat2img.py system.transfer.list system.new.dat system.img" keep showing me -bash: ./sdat2img.py: Permission denied? even I have tried with su and same output. please help me.
[Android Software/Hacking General [Developers Only]] androcraze:
Try changing the permissions of "sdat2img.py" to 755 or 0755. It's probably at 644 right now.
[Android Software/Hacking General [Developers Only]] psycholyzern:
Not working with cm13

me@serv:/home/me/Desktop/cm$ sudo mount -t ext4 -o loop,ro,noexec,noload sys.raw.img sys
[sudo] password for me:
mount: wrong fs type, bad option, bad superblock on /dev/loop2,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

---------- Post added at 09:30 PM ---------- Previous post was at 09:29 PM ----------

Type:

python sdat2img.py system.transfer.list system.new.dat system.img
[Android Software/Hacking General [Developers Only]] Axims:
I just need to extract Boot and Recovery images from update.zip to flash them with fastboot. just read many pages here, still can't find how, with which script can it be done.

( where is recovery.img in these 5.1 roms?)
[Android Software/Hacking General [Developers Only]] Innfinite4evr:
Thanks for this tool ,,it usually works but i got error on unpacking stock cm Lp for yureka ......i got this error

No valid command: imgdiff.

Im using windows
[Android Software/Hacking General [Developers Only]] ReadReadz:
I'm using commands

./make_ext4fs -T 0 -S file_contexts -l 1073741824 -a system system_new.img output/

to make new system.img and flashing for my device. Successfully bootup. But some apk not work. For example. I using root explorer and go to /system/app/a/a.apk and try to install it. It shows "parsing error apk". This apk is normal.
[Android Software/Hacking General [Developers Only]] Ayinbest4love:
Hello am using Gionee m5 and I want to port ROM ,I find it difficult to unpack the system.img the system.img is more than 2gb
[Android Software/Hacking General [Developers Only]] pranavmali:
showing Exec format error no matter what i try!! plzz help
[Android Software/Hacking General [Developers Only]] rinart73:
Error

Windows 8.1 x64:

D:\Python30\python.exe sdat2img.py system.transfer.list system.new.dat system.img
Traceback (most recent call last):
File "sdat2img.py", line 97, in <module>
main(sys.argv)
File "sdat2img.py", line 86, in main
print('Copying {} blocks into position {}...'.format(block_count, begin))
ValueError: zero length field name in format

Android 6.0 CyanogenMod based ROM
[Android Software/Hacking General [Developers Only]] jurben:
There are only two input file for this tool: <transfer_list> and <system_new_file> so it creates system image from zero.

Are there a tool to do a patch to system image like the OTA does? The input files arguments should be four: "orig_system", "system.transfer.list", "system.new.dat", "system.patch.dat"
[Android Software/Hacking General [Developers Only]] DodoGTA:
This Python script works with Android Marshmallow system images on an Android device
[Android Software/Hacking General [Developers Only]] DiamondBond:
same error here, Windows 8.1 x64 aswell.
[Android Software/Hacking General [Developers Only]] xpirt:
are you running latest python3 version?
[Android Software/Hacking General [Developers Only]] DiamondBond:
Indeed Py3
[Android Software/Hacking General [Developers Only]] OdSazib:
Ubuntu Easy Scripts

Helo bro, i wrote some scripts to automate the whole process just in one command. Have a look :)

https://github.com/OdSazib/androidsystem_unpack-repack_tool/tree/master
[Android Software/Hacking General [Developers Only]] Bradl79:
i am having an issues with repacking, it keeps asking for file_contexts and i don't have that file, thank u.androidsystem_unpack-repack_tool
[Android Software/Hacking General [Developers Only]] OdSazib:
Did you read all my instructions? Please do.

And keep three files in /input folder

File_contexts

system.new.dat

system.transfer.list

All these files can be found in your unzipped rom.
[Android Software/Hacking General [Developers Only]] Bradl79:
yes i did, i unzipped my rom and it only has

system.new.dat

system.transfer.list

system.patch.dat

there is no file_contexts at all in the zip

i am using a oneplus 3 OxygenOS

Neverming i will pull it from my phone, thank you
[Android Software/Hacking General [Developers Only]] fhem:
You can get the file_context from your kernel ramdisk. Unpack kernel using this.
[Android Software/Hacking General [Developers Only]] Bradl79:
thank u, i think i got things working now, i appreciate the too and ur help
[Android Software/Hacking General [Developers Only]] Q9Nap:
In the "N" previews, file_contexts is replaced by file_contexts.bin. I imagine this won't be compatible with the current way of referencing file_contexts for making sdat images?

*Update*

Yeah attempting to reference it to make the ext4 image prior to sdat doesn't work :/
[Android Software/Hacking General [Developers Only]] another343:
what am i supposed to do with the make_est4fs file ?
[Android Software/Hacking General [Developers Only]] CedArctic:
The commits that are linked in order to build from source without DAT files are for Lollipop. Where can I find those for Marshmallow? Thanks :)
[Android Software/Hacking General [Developers Only]] xpirt:
the only difference I found is that "--block" is put into a variable called "block_based", on cm13 source just remove this line.
[Android Software/Hacking General [Developers Only]] CedArctic:
Thanks for the quick reply man, really appreciated :)
[Android Software/Hacking General [Developers Only]] xpirt:
[a81ab2e] sdat2img.py: cut memory usage and remove possibility of data loss (props joaormatos)

fixes issue #11
[Android Software/Hacking General [Developers Only]] Alamos:
rimg2sdat executable format invalid debian x86 please help thanks
[Android Software/Hacking General [Developers Only]] jTunes:
Please help

i have Pantech VEGA IRON 2 with model number IM-A910K and i want to port the marshmallow rom from Pantech IM Back with model number IM-100K

how can i port it perfectly?

i already try all porting post here in XDA but still can't

Hope you can help me to port my device...

thanks in advance
[Android Software/Hacking General [Developers Only]] Alamos:
solved with debian x64
[Android Software/Hacking General [Developers Only]] dkionline:
[MENTION=5132229]xpirt[/MENTION], can we unpack system.patch.dat or cust.patch.dat anydays?
[Android Software/Hacking General [Developers Only]] matrixex:
DELETED
[Android Software/Hacking General [Developers Only]] Johny Cipeli:
You Rock MAN!!!!!! If this program I could make a free barebone cyanogenmod version for Osprey. Thank you very much Dev :) :) :)
[Android Software/Hacking General [Developers Only]] bricemx:
thanks lot man, you help us a lot with your tool. Better used your software and guides

---------- Post added at 12:13 AM ---------- Previous post was at 12:10 AM ----------

thanks lot man, you help us a lot with your tool. Better used your software and guides
[Android Software/Hacking General [Developers Only]] satxtreme:
hI, bro ! help !

linux mint 18 python2..7

sudo python ./img2sdat.zip system.img
mg2sdat tools from [email]Howellzhu@gmail.com[/email]
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "ota17/__main__.py", line 17, in <module>
File "ota17/img2sdat.py", line 10, in main
File "ota17/sparse_img.py", line 45, in __init__
ValueError: Magic should be 0xED26FF3A but is 0x00000000
[Android Software/Hacking General [Developers Only]] satxtreme:
linux mint 18 Python 3..5 >>>

/usr/bin/python: can't find '__main__' module in './img2sdat.zip'

help me pls !
[Android Software/Hacking General [Developers Only]] Modder001:
Any mirror for mega.co.nz files?

I can't download from mega.co.nz
[Android Software/Hacking General [Developers Only]] Mysteryagr:
[MENTION=5132229]xpirt[/MENTION]

I can't use it on AOSP marshmallow

Pacman marshmallow

And cm14

All show zero commands

It worked only on cm12.1
[Android Software/Hacking General [Developers Only]] popo72:
First of all thank you very much for this great thread and tools...

I'm not able to repack dat image since rimg2sdat.exe always crashes (under windows 10).....it generates system.new.dat but not system.transfer.list one (always empty file)...really no clue on what I make wrong....

Any help is very much appreciated!....Thanks in advance
[Android Software/Hacking General [Developers Only]] Vherniel:
Why my device can't flash a Block-Based System? In recovery.log. It says unknown volume for /system. How do I gonna solve this? [MENTION=753984]xpirit[/MENTION]
[Android Software/Hacking General [Developers Only]] Viggen66:
Dear all, does the repack now supports Android 5.1.1 on Windows?The tool rimg2sdat if i'm not mistaken is only for android 5.0
[Android Software/Hacking General [Developers Only]] brainvision:
hi guys, is it normal that a LMY47I ROM (Android 5.1) is reported by the sdat2img tool as Android Lollipop 5.0?
[Android Software/Hacking General [Developers Only]] zhuanyi:
Something I don't quite understand, what if I have all 3 file (new.dat, patch.dat, transfer.list) and I would like to merge them into a .img? Do I simply ignore the patch.dat file and do:

sdat2img.py system_transfer.list system_new.dat system.img

Or should I do something like:

sdat2img.py system_transfer.list system_new.dat system_patch.dat system.img

?

Also does this works for img file for other partitions too or it is only applicable to system.img? I saw there is also a cust_(transfer.list,new.dat,patch.dat) in my upgrade zip file.

sdat2img.py system_transfer.list system_new.dat system_patch.dat system.img
[Android Software/Hacking General [Developers Only]] theandroidguy:
how to recompresss the system folder after making necessary modifications????? [MENTION=5132229]xpirt[/MENTION]
[Android Software/Hacking General [Developers Only]] Ydriod/YdroidExpo:
It works ...
[Android Software/Hacking General [Developers Only]] OdSazib:
I have updated atumated process with more options:

https://github.com/OdSazib/androidsystem_unpack-repack_tool
[Android Software/Hacking General [Developers Only]] xpirt:
updated binaries..

sdat2img (version 1.0):

- added python 2.7 or newer support

- README: updated requirements

https://github.com/xpirt/sdat2img

img2sdat (version 1.0):

- fixed utf-8 encoding

- fixed output files not generated properly

- fixed transfer list versioning

- sync with android 7.0 nougat-release

- README: update with usage and example

https://github.com/xpirt/img2sdat

notes:

- now both dat files and transfer list should be generated with proper version according to the system (up to 4, nougat)

- sdat2img will generate a raw ext4 image, to be able to convert it to DAT and use it in img2sdat binary, you need the same image converted to sparse format using img2simg binary (here [MENTION=2976903]A.S._id[/MENTION] built it)

enjoy!
[Android Software/Hacking General [Developers Only]] satxtreme:
HI! After repack system.new.dat (android 6.01). - i have system.new.dat with android 7nougat ???
[Android Software/Hacking General [Developers Only]] EpicPlayer:
So it appears that if you extract the .dat to an image (Step 1), you can just open the resulting .img with 7-zip rather than having to boot into ubuntu if you just want to extract apk files and stuff
[Android Software/Hacking General [Developers Only]] erfanoabdi:
how to get system.img from OTA

Hi Guys

i've question about OTA zips

is there any way to patch system.img(old firmware image) with OTA dats (system.patch.dat , system.new.dat ,system.transfer.list) and update it and get new firmware system.img

so far i tried to do this on recovery with some commands like this (full updater-script attached) :

block_image_verify("/sdcard/system.img", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat")
assert(block_image_update("/sdcard/system.img", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat"));

i can verify image and dats with first code but it fails on block_image_update

i don't know what i did wrong

is there any way to run "block_image_update" in something like debug or verbose mode or do this on PC ?

thanks