yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] greeshan:
Yes, and after repack, new .DAT have other size than the original .DAT before repack. Maybe new .DAT have other size after repack even if i dont make changes, i not check it...
[Android Software/Hacking General [Developers Only]] sdeft:
yes but the problem is how do you know the new size of changed system.img before making it with make_ext4fs ?
[Android Software/Hacking General [Developers Only]] greeshan:
I dont know, therefore i enter size of the old system.img. I read about this there

http://xdaforums.com/android/development/tool-convert-folder-to-ext4-format-t3099237

And I was unable to install the firmware after repacking....
[Android Software/Hacking General [Developers Only]] fritzcola:
Get this error "mount: mount point output/ does not exist"

What to do?
[Android Software/Hacking General [Developers Only]] fritzcola:
Thanks no i get further but now i have this error

[sudo] password for lenz:
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error

In some cases useful info is found in syslog - try
dmesg | tail or so.
lenz@AlienWare:~/Downloads/shamu-MPZ79M$
[Android Software/Hacking General [Developers Only]] sergio151179:
rimg2sdat & sdat2img

[MENTION=6262977]howellzhu[/MENTION] not rimg2sdat find the source code, I guess you have not made public, I would like to compile my chroot ubuntu on android. It would be possible to obtain the code, even if in private.
[Android Software/Hacking General [Developers Only]] QuillzToxic:
Ermmm... I have an error trying to flash my ROM.

Unexpected transfer list version [1[]]

E:Error executing updater binary in zip *Directory*

I'm using a cm12.1 build for my base

I'm also on windows
[Android Software/Hacking General [Developers Only]] QuillzToxic:
How does everyone else do it then :/
[Android Software/Hacking General [Developers Only]] numpea:
hi, is there any updates or other working method ?
[Android Software/Hacking General [Developers Only]] Anthony96922:
Does anyone know where the source code for rimg2sdat is? Possibly somewhere in github?
[Android Software/Hacking General [Developers Only]] xdagee:
Hello everyone, xpirit is on vacation and he won't be around until next month or so. I have been to decompress almost every ROM on my windows PC. Just follow the syntax.

This is what I usually do.

1.First be to have Python installed.(don't forget to check add to path during installation).

2.Next download your preferred ROM and extract.

3.Now copy the downloaded to the same directory where you extracted the ROM

5.Run this command

sdatimg system.transfer.list system.new.dat system.img

system.IMG file will be created.

6.Download DiskInternals Linux Reader, Mount and extract.

7. That's all and thank you for reading.
[Android Software/Hacking General [Developers Only]] QuillzToxic:
Recompressing to 5.1 doe
[Android Software/Hacking General [Developers Only]] numpea:
it's about recompressing

i got too Unexpected transfer list version [1] with cm 12.1
[Android Software/Hacking General [Developers Only]] xdagee:
With decompression, I think you should move to Ubuntu Linux and follow the guidelines. Because I have tried all possible ways on Windows, it didn't work.

Anyone on Linux could try and post the feedback here.

Same here in Windows, Ubuntu Linux is the option which I haven't tried yet.
[Android Software/Hacking General [Developers Only]] numpea:
tried both Ubuntu and windows system.transfer.list doesn't work

we need an updated rimg2dat to support 5.1
[Android Software/Hacking General [Developers Only]] xdagee:
The best way is to report it on github
[Android Software/Hacking General [Developers Only]] ari2asem:
Any possibilities to edit .DAT files on android directly?
[Android Software/Hacking General [Developers Only]] jacomail95:
+1

Inviato dal mio Nexus 4 con Tapatalk 2
[Android Software/Hacking General [Developers Only]] CBpbxEcmecmBeH:
why don't you try copying the binaries and running them in Android shell? :)
[Android Software/Hacking General [Developers Only]] ari2asem:
I ment a way of editing .dat like a zip file
[Android Software/Hacking General [Developers Only]] CBpbxEcmecmBeH:
then maybe some file explorer developer will implement it, once many people ask for this function. Otherwise you have to use the binaries and unpack, mount, edit and repack.
[Android Software/Hacking General [Developers Only]] iicc:
Hi,

I have a question, I have decompressed DAT to EXT4, EXT4 to the output folder, but when I want to convert the output into EXT4, I run:

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

And I get this error:

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 2525 blocks, out of space?

Could you help me?

Thanks ;)
[Android Software/Hacking General [Developers Only]] HypoTurtle:
Try with:

./make_ext4fs -T 0 -S file_contexts -l [B]1084084224 [/B]-a system system_new.img output/
[Android Software/Hacking General [Developers Only]] iicc:
Thanks, now it says that "failed to allocate 125 blocks" Maybe need a little bigger?
[Android Software/Hacking General [Developers Only]] HypoTurtle:
Yea, maybe up to 1084596224 - Or to be 100% sure it will work use the size of your system partition (unless you are going to resize it) - the first value you were using is 1GiB...
[Android Software/Hacking General [Developers Only]] iicc:
Finally I have used the size of my system partition, 1610612736 and I didnt get any error, thanks :good:
[Android Software/Hacking General [Developers Only]] skeleton1911:
maybe a stupid question but can anyone tell me where i can find the file_contexts file? i

maybe its my bad english but i dont understand that part with the file contexts
[Android Software/Hacking General [Developers Only]] xdagee:
This doesn't apply to stock ROMs.
[Android Software/Hacking General [Developers Only]] skeleton1911:
thanks for your reply but there is no file_contexts in the root folder.

p.s MTK device

edit: haha just after you edited your post.

ok thank you :)
[Android Software/Hacking General [Developers Only]] xdagee:
[MENTION=753984]xpirit[/MENTION] is back?
[Android Software/Hacking General [Developers Only]] imprezif:
Trying to repack a stock system folder I unpacked in windows. My only option appears to be the make_ext4fs using ubuntu, but I'm in no way Linux savvy. I'm wondering where I should place my system folder and the ext4 script. And what the proper command would be?

K. Never mind, a lot of reading, a lot of learning. NO SLEEP. Made a ton of progress.

Any assistance is appreciated. Thanks
[Android Software/Hacking General [Developers Only]] :
Hi guys. I have managed to decompress the dat file. Now I have moved the contents (folders and files) to ubuntu in a folder called "1" in the home directory. I have the 3 ubuntu files (downloaded from mega) in the same "1" folder. I run the following commands but get the following:

alex@aospbuilder:~$ cd 1

alex@aospbuilder:~/1$ ./make_ext4fs -T 0 -S file_contexts -l 1073741824 -a system system_new.img output/

bash: ./make_ext4fs: Permission denied

Can anyone help me, please?
[Android Software/Hacking General [Developers Only]] :
Okay, thanks. I will give this a whirl
[Android Software/Hacking General [Developers Only]] :
Thanks for your reply. I still can't get this to work. In the home folder I have a folder called 1 (the contents of which I would like to turn into ext4fs. I have tried putting the mega download files inside the "1" folder and using your command cd 1: then command. I have also tried putting the mega download files inside the home directory and cd there and run the command. What am I doing wrong?
[Android Software/Hacking General [Developers Only]] imprezif:
OK guys I've done my homework to get me this far, but now I am really stumped. I've managed to mount my ext4 even changed the ownership so I can modify files. I have no issues cutting or deleting parts of the existing file, but every time I try to add new pieces to the puzzle I get a not enough space on device message. (there is though)

what am I missing?

All my Internet searches end up with people talking about hard drives n stuff totally unrelated.

Any help?
[Android Software/Hacking General [Developers Only]] HypoTurtle:
When you are running chmod 777 /1/make_ext4fs this is looking for the file at /1/make_ext4fs (i.e. from root directory /); so either use:

chmod 777 1/make_ext4fs

or

chmod 777 ~/1/make_ext4fs

or

cd 1

chmod 777 make_ext4fs
[Android Software/Hacking General [Developers Only]] :
I'll try this now

---------- Post added at 11:11 PM ---------- Previous post was at 11:07 PM ----------

This worked - thanks. However, afterwards I get this:

alex@aospbuilder:~$ cd 1

alex@aospbuilder:~/1$ ./make_ext4fs -T 0 -S file_contexts -l 1073741824 -a system system_new.img 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: build_directory_structure: scandir: No such file or directory
[Android Software/Hacking General [Developers Only]] i snort flour:
[/COLOR]

I'm having the same issue did you ever figure it out?
[Android Software/Hacking General [Developers Only]] skeleton1911:
Easy

Create a new folder called output

Then try again

Gesendet von meinem Elephone P8000 mit Tapatalk
[Android Software/Hacking General [Developers Only]] i snort flour:
That worked perfectly now to the next problem. While trying to get it back into .DAT I get a

bash: ./rimg2sdat: cannot execute binary file: Exec format error

Any suggestions or is this because it is 5.1? If so could this be worked around somehow?
[Android Software/Hacking General [Developers Only]] skeleton1911:
try : ./rimg2sdat system_new.img

there is a way to flash it via updater script .

the script should look like this:

show_progress(0.750000, 0);
ui_print("Patching system...");
block_image_update("system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat");
show_progress(0.050000, 5);
assert(package_extract_file("boot.img", "/tmp/boot.img"),
write_raw_image("/tmp/boot.img", "bootimg"),
delete("/tmp/boot.img"));
[Android Software/Hacking General [Developers Only]] i snort flour:
That's what I did which have me that error
[Android Software/Hacking General [Developers Only]] skeleton1911:
jup it works for me. on my elephone p8000, did not tried it with my htc devices...

in attached is my updater.file etc..

only place :

boot.img
system.new.dat
system.patch.dat
system.transfer.list

into it
[Android Software/Hacking General [Developers Only]] :
OK. I will try this :)
[Android Software/Hacking General [Developers Only]] SmiLeToLife:
converting from system.img to system.new.dat may not work properly. after converting, my system.new.dat is about 357 kb :)
[Android Software/Hacking General [Developers Only]] i snort flour:
OK I got everything to work from decompression to compression but when I boot into recovery and flash it seems like it flashed but when I goto reboot it says no os is installed. Anybody know what I have done wrong? I can get a pic of recovery messages if needed but I didn't think it would be of use. If it helps it says something like patching system unconditionally and some other stuff but does not seem to execute updater script
[Android Software/Hacking General [Developers Only]] skeleton1911:
that seems to me like a buggy updater script.

try this:

show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat");
show_progress(0.050000, 5);
assert(package_extract_file("boot.img", "/tmp/boot.img"),
write_raw_image("/tmp/boot.img", "bootimg"),
delete("/tmp/boot.img"));
#assert(run_program("/system/bin/dd", "if=/dev/zero", "of=/proc/driver/mtd_writeable", "bs=3", "count=1"));
ui_print("Installing SuperSu...");
package_extract_dir("supersu", "/tmp/supersu");
run_program("/sbin/busybox", "unzip", "/tmp/supersu/supersu.zip", "META-INF/com/google/android/*", "-d", "/tmp/supersu");
run_program("/sbin/busybox", "sh", "/tmp/supersu/META-INF/com/google/android/update-binary", "dummy", "1", "/tmp/supersu/supersu.zip");
ui_print("Install Complete!");

EDIT:

it could be that this universal dont work. it depends on your device.. for example:

block_image_update("system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat");

change to :

block_image_update("/dev/block/platform/mtk-msdc.0/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat");

thats for mtk devices

you can change the mtk-msdc.0 to the block of your device

for newer devices it could also work with

/dev/block/bootdevice/by-name/system
[Android Software/Hacking General [Developers Only]] i snort flour:
I'm new to this and what you are saying is like a foreign language to me. I was using the original cm updater script which I will attach to this post. If you could look at it and give me a suggestion or make one I could study I would appreciate it.

Edit: I looked at my zip again and noticed my system.patch.dat is missing this might be the culprit I'm going to check it out now
[Android Software/Hacking General [Developers Only]] skeleton1911:
i will take a look in 30 min. but i can not promise anything :p
[Android Software/Hacking General [Developers Only]] i snort flour:
It's cool I'm in no hurry. I'm going to bed I'll have to try compressing the IMG into a DAT again beings I forgot to copy the patch file or one was not created. I tried to use one from a pa rom and it failed to install so maybe I figured out where I went wrong.

Edit: I compressed the img again and it don't seem to create a new patch file in windows so I'm not sure if using the old one will work or not as I tried zipping a new for with a patch file from another rom and it failed when I tried installing so I'm hoping it's just an updater script problem. Thanks for all your help it's greatly appreciated
[Android Software/Hacking General [Developers Only]] skeleton1911:
i have looked into your updater-script. and it seems ok to me.

there is

block_image_update("/dev/block/platform/msm_sdcc.1/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat");

so thats ok.

but if you want you can try mine.(attached)

(remove your meta-inf folder and copy the attached one in..

-you can use the old patch file.

important is the build of the system.new.dat and system.transfer.list . after you convert it back into a .dat file using:

./rimg2sdat system.new.img
[Android Software/Hacking General [Developers Only]] PseudoDev:
It says this :crying::crying:
[Android Software/Hacking General [Developers Only]] i snort flour:
Got a different issue now it says updating partition info and fails so I'm stumped. I'm sure I screwed up somewhere I just don't know where. Thanks for all your help though it was an interesting journey but I'm going to call it quits for awhile
[Android Software/Hacking General [Developers Only]] abhi_qwerty:
Someone please mirror those 3 files for Ubuntu x64, mega is blocked in my country... Please//
[Android Software/Hacking General [Developers Only]] CBpbxEcmecmBeH:
" btw mega.nz is accessible in India with google DNS (8.8.8.8 & 8.8.4.4) "
[Android Software/Hacking General [Developers Only]] abhi_qwerty:
Thanks, I didn't knew that. It worked.
[Android Software/Hacking General [Developers Only]] SmiLeToLife:
any one has figured that out why img2sdat doesnt work properly? i am on ubuntu and it is creating from 1.1 GB system.img to my system.new.dat is only 357 kb. rom is 5.0 not 5.1
[Android Software/Hacking General [Developers Only]] chriscsh:
wow

work great!!

i found a freeware to mount the ext4img in windows

so i can edit some files inside the img & no need switch to the ubuntu

if u insterest on this

search OSFMount

:D
[Android Software/Hacking General [Developers Only]] STEVE_MARS:
Same issue here, system.new.dat is only 344 kb, because rimg2sdat say:

Data block: 86 (344 KBs)

Zero block: 262058 (1048232 KBs)

Total block: 262144 (1048576 KBs)

What I´m doing wrong?
[Android Software/Hacking General [Developers Only]] STEVE_MARS:
Ok, solved. Check name of the working folder, if you don´t named OUTPUT, obviously don´t make antything.

Now I have another problem, the size of file in the command make_ext4. 1073741824 isn´t enough, I use 2100M but something wrong, system.img not work.
[Android Software/Hacking General [Developers Only]] DihaX:
How tou mount a system.img on cygwin??? i always get error
[Android Software/Hacking General [Developers Only]] i snort flour:
It's easier to download Ubuntu and you can run it from the dvd you burn without installing it.

You could always try osfmount as somebody said a few posts back works without having to use Ubuntu or cygwin
[Android Software/Hacking General [Developers Only]] STEVE_MARS:
Hi, I´m in trouble.

After convert system.img with simg2sdat, my transfer.list is bigger that original (1 kb. original, 6 kb. new).

I only modified build.prop version to check that Custom ROM is OK and make more changes later. And after compile .dat, don´t work in TWRP.

Any idea, please?

Thx.

P.D. Sorry for my english, I´m spanish.
[Android Software/Hacking General [Developers Only]] m0han:
could we have other links for these files, please? i could see only sdat2img.exe in this dev-host folder.

i'm trying to extract bootanimation.zip from a large system.new.dat file. does anyone know of a simpler way?

An error occurred while performing a Searchlight query:

connection to 10.0.100.17:9312 failed (errno=111, msg=Connection refused)
[Android Software/Hacking General [Developers Only]] :
I wouldnt mine seeing this written in c or c++. This way I could cross compile for ARM and make my changes straight from the device lol. Maybe I will get around to it.
[Android Software/Hacking General [Developers Only]] palmbeach05:
It takes less than 5 mins to download the system extractor v1.5, put the required files in the input folder, run the script and get the output in the output folder. Then you can go get the zip within the output folder.
[Android Software/Hacking General [Developers Only]] jcespi2005:
Trying to use your tool to convert a .DAT from OnePlus OP2 OxygenOS to IMG Fastboot flash format, but seems to be a problem with the version, this is the output:

dev@AndroidDEV ~/Desktop/Oxygen2.1 $ sdat2img system.transfer.list system.new.dat system.img

Android sparse image file parser from howellzhu

Version must be 1.

Any help?
[Android Software/Hacking General [Developers Only]] CBpbxEcmecmBeH:
I think I had the same issue and I think it was fixed by using the Python file and not the binary. It was written somewhere here as well. Get it from github ;).

P.S.: I also used it on Oxygen, however on the first 2.0 version ever :)
[Android Software/Hacking General [Developers Only]] SkandaH:
[MENTION=5132229]xpirt[/MENTION]

Can you please take a look in recent CM nightlies, such as this one? sdat2img throws no error, but the img seems corrupted. The snapshot build has no error though.

I'm running Windows 10 Pro x64 & has tested both the executable & Python script. If anymore info is required, please hit me.
[Android Software/Hacking General [Developers Only]] :
Well, peeps, decided to try this out on my phone and it worked out pretty well using sdat2img.py
[Android Software/Hacking General [Developers Only]] littlegreen:
Hey guys! I am giving this thread a go and have been for a while now. I am almost sure I have read every post here but I did not see the error I ran into:

Ubuntu 15.04 64bit [everything installed beforehand]

# ./sdat2img system.transfer.list system.new.dat system.img
Android sparse image file parser from howellzhu
Version must be 1.

Windows 10 x64

sdat2img.exe system.transfer.list system.new.dat system.img
Error command 0

I have fixed my permissions. Running as root in Ubuntu and in Elevated Command Prompt in Windows. Any ideas?
[Android Software/Hacking General [Developers Only]] xpirt:
on ubuntu, use the python file to decompress.

sdat2img.py [parameters]

and ofc you need python3 installed.
[Android Software/Hacking General [Developers Only]] littlegreen:
Yes, that worked like a charm! Thank you :)
[Android Software/Hacking General [Developers Only]] Mohamed Yaser:
Bad Problem :(
[Android Software/Hacking General [Developers Only]] HypoTurtle:
Run "dmesg | tail" or "file system.img"
[Android Software/Hacking General [Developers Only]] Mohamed Yaser:
android@builduntu-VM:~/Desktop/Dat$ file system.img

system.img: Android sparse image, version: 1.0, Total of 262144 4096-byte output blocks in 1806 input chunks.
[Android Software/Hacking General [Developers Only]] HypoTurtle:
You'll need to convert that first, using simg2img - i think its in the "android-tools-fsutils" package so "apt-get install android-tools-fsutils" first.
[Android Software/Hacking General [Developers Only]] Mohamed Yaser:
how to use simg2simg

i used simg2img system.img system_new.img

---------- Post added at 11:37 AM ---------- Previous post was at 11:28 AM ----------

simply you rock

---------- Post added at 11:39 AM ---------- Previous post was at 11:37 AM ----------

iam ready now to repack but i use factory img so no file context any tips?
[Android Software/Hacking General [Developers Only]] HypoTurtle:
How are you going to reflash?

This thread is more about .dat files -- they are used for large OTA zips. Factory images are either in ext4 or sparse (which you need to convert to ext4 as you have done). I'll have to check how to turn a .img into a .dat file.

Depending on how you want to flash, you should be able to use the system_new.img or you can turn it back into a sparse with "img2simg system_new.img system_new_sparse.img"

Edit. I remember now. file_contexts can be taken from the boot.img... You use that to make the .dat
[Android Software/Hacking General [Developers Only]] sebastiandg7:
Excelente tutorial!! Need some help... At the end when I use the rimg2sdat to creat ethe new .dat files, I only get system.new.dat and system.transfer.list... I replace them in the ROM zip but when falshing in recovery I get this error: "Unable to mount /system".

Can someone help me?
[Android Software/Hacking General [Developers Only]] QuillzToxic:
I can't seem to run ./make_ext4fs, under sudo, even with the extra package enabled
[Android Software/Hacking General [Developers Only]] :
Mind showing what its reporting back on your terminal? More details would be helpful.
[Android Software/Hacking General [Developers Only]] QuillzToxic:
I followed the instructions, and the extra help.

This is what the terminal does:

If I don't put sudo in front of the make_ext4fs command: bash: ./make_ext4fs: permission denied

If I put sudo in front of the command, it does this:

Sudo: ./make_ext4fs: command not found.

I'm running the latest xbuntu if that makes a difference (It's basicly Ubuntu)
[Android Software/Hacking General [Developers Only]] xpirt:
update..

- sdat2img.py: added marshmallow 6.0 support (commit d7211b1)

...and updated guide with python usage, simpler for me to keep track.

enjoy!
[Android Software/Hacking General [Developers Only]] akhilnarang:
[MENTION=5132229]xpirt[/MENTION] with the latest version , I get an error

akhilnarang@ThugPhoenix:~/sprout$ ./sdat2img.py system.transfer.list system.new.dat system.img
Traceback (most recent call last):
File "./sdat2img.py", line 95, in <module>
main(sys.argv)
File "./sdat2img.py", line 76, in main
version, new_blocks, new_block_set, zero_block_set, erase_block_set = parse_transfer_list_file(TRANSFER_LIST_FILE)
File "./sdat2img.py", line 67, in parse_transfer_list_file
return version, new_blocks, new_block_set, zero_block_set, erase_block_set
UnboundLocalError: local variable 'zero_block_set' referenced before assignment

Please help if possible, thanks a lot in advance!