yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] Marvfit213:
I try that tool but it says command bsdiff is not valid and in my Transfer list it is many times and free to

I try unpack System.ext.new.dat and System.ext.transfer.list

From Android 14 One Ui 6 beta 2

How can I fix dis to get the folder so I can access the apk files I need for Posting the Quickpanel
[Android Software/Hacking General [Developers Only]] ze7zez:
Give a link to the file.
[Android Software/Hacking General [Developers Only]] Marvfit213:
Hi I have got System ui apk from my s10+ and System ui apk from s23u beta 2 user

I Decompile both to folders

How I port the one ui 6 Quickpanel and New music Player or just Quickpanel

To s10 with one ui 5.1 rom

As a magis Module

Do I have to go to res/layout and copy an replace all the qs.xml that are there to the S10s res/layout

Or what exactly do I need to do

Pls I want the New Quickpanel now and others to they wait that I port it

I didn't done dis before

Would be nice if you could help Me and so

Thx
[Android Software/Hacking General [Developers Only]] Marvfit213:
I can send you on telegram the folders so you can see better and Tell me witch files exactly
[Android Software/Hacking General [Developers Only]] ze7zez:
You wrote "I try unpack System.ext.new.dat" so the file is known. What is not known is the link to the ROM. I don't use anything else to communicate on the XDA forum.
[Android Software/Hacking General [Developers Only]] Marvfit213:
Ok
[Android Software/Hacking General [Developers Only]] Marvfit213:
Hi I try it again and it doesnt work For me I try the s21 Rom beta 2 one ui 6

But nothing happens when I try the tool
[Android Software/Hacking General [Developers Only]] ericlnu:
Go troll elsewhere please and thank you.
[Android Software/Hacking General [Developers Only]] rogersa2k:
I'm not sure what I am doing wrong but I keep getting the following:

python ../img2sdat.zip system_mod.img
img2sdat tools from Howellzhu@gmail.com
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, 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

Any ideas?

Edit: By the way, I am trying to do this with the latest CM12 nightly for the Nexus 6 (shamu).

Thanks,

Aaron
[Android Software/Hacking General [Developers Only]] howellzhu:
Hmmm, some guys also met such problem. But I found they use raw ext4 image as the input for img2sdat. But img2sdat expects a sparse image (both of them called system.img:()

You can visit this blog's discussions first:

http://blog.csdn.net/howellzhu/article/details/42841191

and this one:

http://blog.csdn.net/howellzhu/article/details/43165507

If you still cannot resolve your problem, please kindly let me know.

Thank you very much.
[Android Software/Hacking General [Developers Only]] Scott:
Worked perfect! Thanks!
[Android Software/Hacking General [Developers Only]] ericlnu:
Why are you running the zip as a script? Unzip it first.

Edit: NM, I just saw [MENTION=6262977]howellzhu[/MENTION]'s OP for the script.
[Android Software/Hacking General [Developers Only]] xpirt:
just compiled the windows version of img2sdat without the needing of python. and also for me the error is the one mentioned. I'll look into it too to see if I can do something for it.
[Android Software/Hacking General [Developers Only]] chjpfun:
How to convert .img to .dat (windows)??????
[Android Software/Hacking General [Developers Only]] xpirt:
please be patient, when we get img2sdat working I'll update OP with guide too, so just wait.
[Android Software/Hacking General [Developers Only]] carlese:
[MENTION=5132229]xpirt[/MENTION] man, if you manage to compress the img back to dat you are the real hero! BTW, how can i edit the system.img file? I want to remove some apps and ringtones before flashing the rom.. Can i use the android kitchen and unpack and repack?
[Android Software/Hacking General [Developers Only]] xpirt:
you can decompress/compress it with all softwares that support ext4 image file decompression, depending if you're on windows or linux.
[Android Software/Hacking General [Developers Only]] carlese:
I have windows, what do you suggest? I see a lot of tools for the unpack, but can't find one that packs the system.img back..
[Android Software/Hacking General [Developers Only]] xpirt:
here there's a guide for ubuntu, but it should work on windows too with cygwin, try it.

http://xdaforums.com/showthread.php?t=1588461
[Android Software/Hacking General [Developers Only]] xpirt:
i'm updating the OP with detailed guides for all OS, also managed to compile the img2sdat binary for Windows too.

the img2sdat won't work if you use the system.img out of sdat2img, because it's a raw ext4 image, it should be converted to a sparse ext4 image to work with the new binary.

to convert from raw ext4 to sparse ext4 you have to use the img2simg binary which is given by google for ubuntu systems only and i can't manage to compile it for windows too so most likely you have to use cygwin this time.

anyhow I'll write the guide for everything asap.
[Android Software/Hacking General [Developers Only]] hardythaker:
i just put extracted folders in \system folder in ROM and delete the system.new.dat file and tried to flashed but it didnt boot (after flashing process start i just said successful after 2 secs )
[Android Software/Hacking General [Developers Only]] tobitege:
Well, why would you do that? The updater-script is trying a block mode update and you removed that corresponding file and put just folders/files in it. That can't work. ;)
[Android Software/Hacking General [Developers Only]] xpirt:
after decompressing the DAT file you will get all files in system folder but if you want to flash it you have to write an updater-script which extracts system folder to system partition, then set proper permissions and does necessary symlinks. after that you can flash it and release as a rom.
[Android Software/Hacking General [Developers Only]] hardythaker:
Well am newbie dont know so of much things

Just trying my best to learn as much as I can

Will you elaborate what changes I have to do coz I don't have any knowledge about updater script

Btw off topic :- how other dev are realising unofficial cm12 as .DAT file type and how they are able to make changes and again can able to pack system.new.DAT file.

:confused::confused::confused:
[Android Software/Hacking General [Developers Only]] xpirt:
they're building from source, and the compression in DAT files is automatically done with scripts given by google.

all binaries from this thread are ported from google's sources as well, as also img2sdat which makes DAT files. also the compression into DAT format is possible and already completed.

the last step is to make a guide for you guys to explain the process. due to my time it will take a bit.
[Android Software/Hacking General [Developers Only]] tobitege:
Apologies if my earlier reply sounded harsh, that wasn't my intent.

So in folder META-INF/com/google/android you'll find the so called "updater-script" which is executed during flashing.

In e.g. CM-12 nightlies you can find in it a line like this:

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

to update the system folder with the mentioned extraction method.

If you, however, have a folder/file-based update (everything already exctracted), like in your case, this line in the script should work:

package_extract_dir("system", "/system");

I hope, this helps you out a little. :)
[Android Software/Hacking General [Developers Only]] hardythaker:
Ohh no not at all Bro

So i instead of "block_image_update....." Line I have to put "package_extract_dir..." Code ?

Sorry may be the noobest question ever

And Thanks for your help :)

---------- Post added at 07:33 PM ---------- Previous post was at 07:29 PM ----------

Take your time :)
[Android Software/Hacking General [Developers Only]] tobitege:
Correct. :)
[Android Software/Hacking General [Developers Only]] xpirt:
ok guys, finished Ubuntu x64 guide ;)

notes:

- read carefully every single word as are important!

- i don't think a windows version of the img2simg binary will come, though you can use cygwin for it (guide will follow in the future)

- i've updated the original guide to avoid some confusion, now the raw ext4 image is in format .ext4, the sparse one in classic .img. (the ext4 & img formats are the same for an raw ext4 image)

enjoy! :)
[Android Software/Hacking General [Developers Only]] carlese:
I am a total noob here.. after converting the dat to img, what should i do to remove/replace files inside the img and then repack it and reconvert to dat?

Thanks for your patience..
[Android Software/Hacking General [Developers Only]] xpirt:
it's all wrote in OP man..

but I'll sum up here and update the OP again.

sudo mount -t ext4 -o loop system.ext4 output/​

to mount the ext4 raw image onto the output folder, here you mod all apks/jars etc.

sudo ./make_ext4fs -s -l 512M -a system my_new_system.ext4 output/ sudo umount sys rm -fr sys​

this will unmount it and pack it to a new IMG (same ext4 raw)

... then you continue with steps.

BTW this should not be part of this thread and it's not its purpose. this thread explains how to decompress DAT files and compress them back.

... but how to edit a standard ext4 image has already been discovered and explained on google/xda. the decompression of a dat file no.
[Android Software/Hacking General [Developers Only]] hardythaker:
Thanks a lot man u made our work so much easy

Thank You So much

:thumbup::thumbup::thumbup::):)
[Android Software/Hacking General [Developers Only]] hardythaker:
when i execute this line it always says

"hardik@hardy:~/final/rom$ sdat2img system.transfer.list system.new.dat system.new.dat.ext4

sdat2img: command not found"

what's worng ??​
[Android Software/Hacking General [Developers Only]] xpirt:
system.new.dat.ext4? should be system.new.dat only.

anyway, the binary must be in final/rom, is it there?
[Android Software/Hacking General [Developers Only]] hardythaker:
yup its there

and system.new.dat.ext4 is output file so it doesnt matter

edit:

i need to install java or what ??? coz i just only installed ubantu in vmbox and running your binaries
[Android Software/Hacking General [Developers Only]] xpirt:
try

./sdat2img system.transfer.list system.new.dat system.ext4
[Android Software/Hacking General [Developers Only]] hardythaker:
Yeah...!!! That's Worked :good::good::good:

make change in the OP sir :):):)
[Android Software/Hacking General [Developers Only]] xpirt:
glad it worked :good:
[Android Software/Hacking General [Developers Only]] carlese:
When I launch the command it says that i don't have the permission to launch it.. How can i solve it?

edit: solved, i had to flag it to be used as a program :)
[Android Software/Hacking General [Developers Only]] hardythaker:
Note if you cant able to delete/move/copy files from the mounted img (system.ext4)

run this command:

in my case that was:

---------- Post added at 04:54 PM ---------- Previous post was at 04:45 PM ----------

now this error : hardik@hardy:~/final/Extracted$ sudo ./make_ext4fs -s -l 512M -a system my_new_system.ext4 output/ sudo umount sys rm -fr sys

sudo: unable to execute ./make_ext4fs: No such file or directory
[Android Software/Hacking General [Developers Only]] xpirt:
you have to download make_ext4fs binary, on google you'll find it.
[Android Software/Hacking General [Developers Only]] carlese:
I get the same error when creating the new edited img

[MENTION=753984]xpirit[/MENTION] I have the binary, like sdat2img, in the same working folder..
[Android Software/Hacking General [Developers Only]] hardythaker:
i have that binary in that folder and also outside that folder

trying so many things but the same error
[Android Software/Hacking General [Developers Only]] xpirt:
try:

apt-get update

apt-get install ia32-libs
[Android Software/Hacking General [Developers Only]] hardythaker:
same error

root@hardy:/home/hardik/final/Extracted/output# sudo ./make_ext4fs -s -l 512M -a system system.ext4 /home/hardik/final

sudo: unable to execute ./make_ext4fs: No such file or directory
[Android Software/Hacking General [Developers Only]] xpirt:
without ./ or without sudo?
[Android Software/Hacking General [Developers Only]] hardythaker:
my files are like "home/final/Extracted"

Extracted folder contains

1)output folder (mounted folder)

2)system.new.dat(img)

3) make_ext4fs (for testing purpose also copied "in output folder, and in bin folder")

now commands:

hardik@hardy:~/final/Extracted/output$ sudo

./make_ext4fs

-s -l 512M -a system system.ext4 output/

sudo: ./make_ext4fs: command not found

hardik@hardy:~/final/Extracted/output$ sudo

/make_ext4fs

-s -l 512M -a system system.ext4 output/

sudo: /make_ext4fs: command not found

hardik@hardy:~/final/Extracted/output$ sudo

make_ext4fs

-s -l 512M -a system system.ext4 output/

sudo: unable to execute /bin/make_ext4fs: No such file or directory

hardik@hardy:~/final/Extracted/output$ sudo su

root@hardy:/home/hardik/final/Extracted/output#

./make_ext4fs

-s -l 512M -a system system.ext4 output/

bash: ./make_ext4fs: No such file or directory

root@hardy:/home/hardik/final/Extracted/output#

make_ext4fs

-s -l 512M -a system system.ext4

output/

bash: /bin/make_ext4fs: No such file or directory

root@hardy:/home/hardik/final/Extracted/output# make_ext4fs -s -l 512M -a system system.ext4

/output

bash: /bin/make_ext4fs: No such file or directory

root@hardy:/home/hardik/final/Extracted/output# sudo

./make_ext4fs

-s -l 512M -a system system.ext4 /output

sudo: ./make_ext4fs: command not found

root@hardy:/home/hardik/final/Extracted/output# sudo

/make_ext4fs

-s -l 512M -a system system.ext4 /output

sudo: /make_ext4fs: command not found

and so many combinations
[Android Software/Hacking General [Developers Only]] xpirt:
you have to be in /Extracted folder and run the binary from there without sudo but with ./

give it a try
[Android Software/Hacking General [Developers Only]] carlese:
Still no luck for me.. I have all the binaries in /home/carlese/Scrivania/Rom

Then i created a folder inside named output

I was able to mount the system.new.dat to the output folder, then I type:

sudo ./make_ext4fs -s -l 512M -a system system.ext4 output/

from inside the Rom folder but nothing happens. The same without using sudo..

Does it work for you mate?
[Android Software/Hacking General [Developers Only]] hardythaker:
Just shuted down the PC, trying from 4hrs with no joy, its 1am here

Will in form you tomorrow and xpirt thanks for your instant helps Thank you so much :):):thumbup::thumbup:
[Android Software/Hacking General [Developers Only]] sparksco:
If you use sudo even one time it can really mess up permissions of output. Nuke everything related, all old files and whatnot.
[Android Software/Hacking General [Developers Only]] carlese:
Managed to make it work by installing lib32stdc++6

BTW the mounted image is locked and not editable.. What can I use to change my files inside the mounted folder?

Also, since I've read that Ubuntu has python 3 already installed, should I give the command python3 instead of python, right?

Thanks [MENTION=753984]xpirit[/MENTION] :)
[Android Software/Hacking General [Developers Only]] hardythaker:
Read post no. 113 by me :)
[Android Software/Hacking General [Developers Only]] carlese:
Gonna try that this evening.. Let me know if you fix tour problem with what no said in the post, so we help each other!
[Android Software/Hacking General [Developers Only]] hardythaker:
sure bro :good::good::fingers-crossed:

how starange we are helping each other in different different Posts :laugh::laugh::laugh:

btw guys here is a fix if you get error of

sudo: unable to execute ./make_ext4fs: No such file or directory

here is a fix foubd by [MENTION=2290290]carlese[/MENTION] thanks to him :good:

run this command as root user

[B]apt-get install lib32stdc++6[/B]
[Android Software/Hacking General [Developers Only]] hardythaker:
now this one :crying::crying::rolleyes::rolleyes::eek::confused:

hardik@hardy:~/final/Extracted$ python img2sdat.zip my_new_system.img /new

/usr/bin/python: can't find '__main__' module in 'img2sdat.zip'
[Android Software/Hacking General [Developers Only]] xpirt:
oh.. probably uploaded wrong zip. will check tomorrow.
[Android Software/Hacking General [Developers Only]] hardythaker:
[MENTION=2290290]carlese[/MENTION]

You got this error ?

hardik@hardy:~/final/Extracted$ python img2sdat.zip my_new_system.img /new

/usr/bin/python: can't find '__main__' module in 'img2sdat.zip'
[Android Software/Hacking General [Developers Only]] carlese:
Didn't try it yet, maybe later ;)
[Android Software/Hacking General [Developers Only]] xpirt:
didn't have time to update the file, in the meanwhile you can transfer the IMG to windows and use my img2sdat.exe to compress it in DAT file.
[Android Software/Hacking General [Developers Only]] hardythaker:
Ohh so that's something can do with it, thanks for idea...:thumbup::thumbup:
[Android Software/Hacking General [Developers Only]] xpirt:
i've compiled everything for windows but img2simg, so it could be helpful for windows users. the only step that must be done on linux/cygwin is step 2.

edit: updated the step 1 and step 3 for windows too + updated img2sdat.zip, now should work on linux too.
[Android Software/Hacking General [Developers Only]] hardythaker:
in windows

C:\Users\meena\Desktop\guest>img2sdat sparse_system_new.img /new

Total of 101045 4096-byte output blocks in 321 input chunks.

Traceback (most recent call last):

File "img2sdat.py", line 31, in <module>

File "img2sdat.py", line 13, in main

TypeError: Compute() takes 2 positional arguments but 3 were given

in ubantu also:

hardik@hardy:~/final/output$ sudo python img2sdat.zip sparse_system_new.img /home/hardik/final

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

and if i using this:

hardik@hardy:~/final/output$ sudo python3 img2sdat.zip sparse_system_new.img /home/hardik/final

hardik@hardy:~/final/output$ sudo python3m img2sdat.zip sparse_system_new.img /home/hardik/final

no error comes but output file is also not there
[Android Software/Hacking General [Developers Only]] xpirt:
in windows try playing with new folder parameter, setting it to new/ or only new.

I'll take a look into it in the meanwhile.
[Android Software/Hacking General [Developers Only]] hardythaker:
tried new , new/, /new , new\ , \new , . /new,

didn't worked
[Android Software/Hacking General [Developers Only]] hardythaker:
i tried with this but flashing completed in ~10secs (with no os installed)
[Android Software/Hacking General [Developers Only]] xpirt:
try typing this only:

img2sdat sparse_system_new.img
[Android Software/Hacking General [Developers Only]] Dryblow:
To last step I cant load img into "new" directory.

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

Why It can't find __main__?
[Android Software/Hacking General [Developers Only]] hardythaker:
i already tried that

but again

C:\Users\meena\Desktop\guest>img2sdat system_new.img

Total of 101045 4096-byte output blocks in 321 input chunks.

Traceback (most recent call last):

File "img2sdat.py", line 31, in <module>

File "img2sdat.py", line 13, in main

TypeError: Compute() takes 2 positional arguments but 3 were given

---------- Post added at 04:24 PM ---------- Previous post was at 04:21 PM ----------

same here if i do in ubantu 14.10 x64
[Android Software/Hacking General [Developers Only]] Dryblow:
I'm to Ubuntu 14.04lts x64 but I think isn't a problem with python but a zip bug.
[Android Software/Hacking General [Developers Only]] hardythaker:
Got any solution ?
[Android Software/Hacking General [Developers Only]] rogersa2k:
Just a quick note. I was getting the same error on two different Ubuntu 14.10 64-bit boxes. I tried a lot of stuff and didn't get anywhere. I then tried to download the latest img2dat.zip from the following site but couldn't figure it out (i.e. I don't speak Chinese):

http://download.csdn.net/download/howellzhu/8375811

I then remembered that [MENTION=6262977]howellzhu[/MENTION] attached a version of img2sdat.zip earlier in the thread. When I compared the files I saw that the one in the OP is from 2015/01/29 while those in his zip are from 2015/01/17. When I used his it worked! I did have to use sudo to avoid permissions errors and I may have had to chmod 777 img2sdat.zip.

http://xdaforums.com/showpost.php?p=58412929&postcount=75

Note: I have *not* yet tried flashing the resulting file. I have no idea if that will work or not. I intend to get back to it later today or most likely tomorrow afternoon. Good luck!

mkdir new

sudo python ./img2sdat.zip my_new_system.img new/
img2sdat tools from Howellzhu@gmail.com
Total of 524256 4096-byte output blocks in 665 input chunks.
Generating digraph...
Finding vertex sequence...
Removing backward edges...
0/0 dependencies (0.00%) were violated; 0 source blocks removed.
Reticulating splines...

ls -al new/
total 2097040
drwxr-xr-x 2 root root 4096 Feb 10 12:09 .
drwxr-xr-x 6 root root 4096 Feb 10 12:06 ..
-rw-r--r-- 1 root root 2147352576 Feb 10 12:09 system.new.dat
-rw-r--r-- 1 root root 0 Feb 10 12:09 system.patch.dat
-rw-r--r-- 1 root root 41 Feb 10 12:09 system.transfer.list

- Aaron
[Android Software/Hacking General [Developers Only]] hardythaker:
So now what are the working steps for ubantu/windows ?? or now also its not working ??
[Android Software/Hacking General [Developers Only]] rogersa2k:
You can try the version I linked to and then use the instructions from the OP.

I'll give this another try today and see if I can figure out what I did to get it to work.

- Aaron
[Android Software/Hacking General [Developers Only]] hardythaker:
I done and got three files including system.new.DAT

But when I tried to flash using those 3 files

"/system unable to mount" in TWRP
[Android Software/Hacking General [Developers Only]] tobitege:
It depends on multiple things, iirc:

- the mount command used in the updater-script and the included updater-binary which has to support the command

- the system partition may already be mounted and the updater-script may need an IF clause to avoid an error

Sometimes it may also check for it being mounted already like this (the below notation may also differ):

if ! is_mounted("/system") then
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system", "");
endif;

and other times only this:

mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system", "");

Maybe this helps your research into the issue.
[Android Software/Hacking General [Developers Only]] hardythaker:
Thanks for the help bro...will look into this
[Android Software/Hacking General [Developers Only]] evogp:
Sorry, and files to .img?
[Android Software/Hacking General [Developers Only]] xpirt:
make_ext4fs
[Android Software/Hacking General [Developers Only]] Hero:
In case anyone is wondering, this is how I got it working on Windows 8.1 64bit

Prerequisites:

Use the zip from [MENTION=6262977]howellzhu[/MENTION]'s post: http://xdaforums.com/showpost.php?p=58412929&postcount=75

Download Python 2.7 from here: https://www.python.org/downloads/

IMPORTANT: When you install Python 2.7 make sure the python.exe is in your PATH​

Download Cygwin 64bit and install the 'devel' packages from here: https://cygwin.com/install.html

Put

img2sdat.zip

and your

system.img

in the SAME directory (ex. .../Desktop/my_rom)

Steps to compress system.new.dat:

In a Cygwin terminal, 'cd' to the directory where you have img2sdat.zip and system.img

Execute the following command:

python img2sdat.zip system.img new

The following files will appear in the 'new' directory

system.new.dat
system.patch.dat
system.transfer.list

Hopefully this helps some of you :)