[Dev tool] Unpack .Dat compression on Your Android phone itself [Using Termux] - Android Software/Hacking General [Developers Only]

Introduction​
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Well I was Going Through The possibilities of Termux and was extracting .Dat compression in my PC to extract some files out of system folder Then i readed in one xda thread that Termux can install Python,cmake, and all in our Android itself also seen that Python script by @xpirt on @matrixex thread for unpack repack .Dat on pc I seen that this Python script converts .dat to .img Then suddenly One idea arised in my mind Why don't I try that in my phone itself I tried and the result was just insane it worked like a charm in real. Now we want files but it is in .img extension how can we extract that then i Found This app called Zarchiver on playstore You can unpack the image now and use those files or edit them Also i found Another interesting app Android image kitchen by which you can unpack the image and make changes in the image content by import export of files but it leaves the image as it is in .img extension only can edit but can't unpack so the Zarchiver method is the best.....
This can help Rom porters and Rom developing Dev's​
Plz don't forget to hit the thnx button it can appreciate someone ???
I am still a noob so i can't answer Dev's professional questions but I think Other Dev's Moderators and Contributors will help the DEv's​
Special thnx to
@xpirt
@matrixex
@termuxAppDevloper
@ZArchiverAppDevloper
@aindroidImageKitchenAppDevloper
@dg28gadhavi Aka me

Guide​
Files to be download:
Termux app
Termux Api app
Commands.txt
Zarchiver app
AIK app
Es file explorer
Quick text editor
Links:
TermuxApp
TermuxApiApp
Zarchiver
AikApp
EsFileexplorer
Quickest ditor
Pythonscript
Commands.txt
1. Install the given apps and download all requirements
2. Open Termux app and let it be initialize 1st
3. Copy commands from command.txt step by step
4. Download python by apt-get install python (note but follow the commands.txt commands first and go step by step)
5. Make a folder name ext in internal memory/download
6. Extract the python script zip (sdatmaster.zip) and copy it in internal memory/download/ext
7. Also copy Your system.new.dat , system.transfer.list and filecontext in internal memory​/download/ext folder
8. Now Following the command.txt Type this command- termux-setup-storage
9. Now change path to directory as mentioned in command.txt- cd storage/downloads/ext
10. Now execute that python script as mentioned in commands.txt- python sdat2img.py system.transfer.list system.new.dat system.img
11. Copy the code to convert​.dat to .img
12. Use Zarchiver to unpack/extract the image
13. Unpacking done enjoy
Note
Root required
And it can't extract OEM Delta OTA updates​

Good Guide.

dg28gadhavi said:
Guide
Click to expand...
Click to collapse
We can also use Image Factory app to do this https://m.apkhere.com/app/crixec.app.imagefactory
For new brotli packages we need additional commands
Code:
cd /sdcard/Download/ext
pkg install brotli
brotli -d system.new.dat.br -o system.new.dat

Pack ke system.new.dat TO system.new.dat.br what do you do

Wahyu6070 said:
Pack ke system.new.dat TO system.new.dat.br what do you do
Click to expand...
Click to collapse
Try the below command to compress system.new.dat to brotli
Code:
cd <path to system.new.dat directory>
brotli system.new.dat -o system.new.dat.br

Repack system.new.img to system.new.dat
:good:
repack system.new.img to system.new.dat how do you do it

Wahyu6070 said:
:good:
repack system.new.img to system.new.dat how do you do it
Click to expand...
Click to collapse
https://github.com/xpirt/img2sdat
https://forum.xda-developers.com/an.../how-to-conver-lollipop-dat-files-to-t2978952

python img2simg.py system.img fail
to repack the system folder to system.img. the code that I use: python img2simg.py system.img system2.img, posted on xpirt the way it is but can't.

xpirt posts use linix instead of termux
how to use linux pc instead of android thermux and use sudo command

Wahyu6070 said:
to repack the system folder to system.img. the code that I use: python img2simg.py system.img system2.img, posted on xpirt the way it is but can't.
Click to expand...
Click to collapse
How you got system folder? Did you mounted system.img to some folder?

I rented dat to img. then I uninstall the file system.img using zarchiver, and in that folder there are build pro files, prive apps etc., and how do I change it back to img ... then to dat

Wahyu6070 said:
I rented dat to img. then I uninstall the file system.img using zarchiver, and in that folder there are build pro files, prive apps etc., and how do I change it back to img ... then to dat
Click to expand...
Click to collapse
I dont know how to do that from a folder....
But If you are using mobile you can mount it somewhere and tweak it....
Code:
mkdir /data/local/system
mount -t ext4 -o rw,noatime <system.img path> /data/local/system
You can now tweak /data/local/system folder ...
After tweaking that system folder you have to unmount /data/local/system
Code:
umount /data/local/system
img2simg system.img system_sparse.img
img2simg binary can be found in FlashFire apk lib folder for your arch...
Then you have to use img2sdat.py code.....

HemanthJabalpuri said:
I dont know how to do that from a folder....
But If you are using mobile you can mount it somewhere and tweak it....
Code:
mkdir /data/local/system
mount -t ext4 -o rw,noatime <system.img path> /data/local/system
You can now tweak /data/local/system folder ...
After tweaking that system folder you have to unmount /data/local/system
Code:
umount /data/local/system
img2simg system.img system_sparse.img
img2simg binary can be found in FlashFire apk lib folder for your arch...
In flashfire.apk / lib / exist 2 folders (armeabi-v7a and x86) and deep in the folders of the fishery format libimg2simg.so not img2simg.py do I have to change the format
Click to expand...
Click to collapse

Wahyu6070 said:
In flashfire.apk / lib / exist 2 folders (armeabi-v7a and x86) and deep in the folders of the fishery format libimg2simg.so not img2simg.py do I have to change the format
Click to expand...
Click to collapse
You have to rename it to img2simg.......
Note that img2simg and img2sdat.py are different ones.....

HemanthJabalpuri said:
I dont know how to do that from a folder....
But If you are using mobile you can mount it somewhere and tweak it....
Code:
mkdir /data/local/system
mount -t ext4 -o rw,noatime <system.img path> /data/local/system
You can now tweak /data/local/system folder ...
After tweaking that system folder you have to unmount /data/local/system
Code:
umount /data/local/system
img2simg system.img system_sparse.img
img2simg binary can be found in FlashFire apk lib folder for your arch...
Then you have to use img2sdat.py code.....
Click to expand...
Click to collapse
I think the code that is used cannot
Code:
1|[email protected]:/data/data/com.termux/files/home #
rw,noatime system.img /data/local/system <
mount: 'system.img'->'/data/local/system': No such file or directory

Wahyu6070 said:
I think the code that is used cannot
Click to expand...
Click to collapse
You need to first change working directory if you want to only use system.img as arg instead of whole path
Code:
cd <directory path to system.img>

HemanthJabalpuri said:
You need to first change working directory if you want to only use system.img as arg instead of whole path
Code:
cd <directory path to system.img>
Click to expand...
Click to collapse
Code:
ount -t ext4 -o rw,noatime <system.img path> /data/local/system <
mount: bad /etc/fstab: No such file or directory
still can't

Wahyu6070 said:
still can't
Click to expand...
Click to collapse
Your code is wrong...
Place system.img extracted from .dat file in /sdcard/Music folder and type following
Code:
su
mkdir /data/local/system
mount -t ext4 -o rw,noatime /sdcard/Music/system.img /data/local/system
Now you can go to /data/local/system and tweak it and unmount afterwards
Place img2simg binary in /sdcard/Music and
Code:
umount /data/local/system
exit
cp /sdcard/Music/img2simg $HOME
chmod +x $HOME/img2simg
cd $HOME
./img2simg /sdcard/Music/system.img /sdcard/Music/system_sparse.img

HemanthJabalpuri said:
Your code is wrong...
Place system.img extracted from .dat file in /sdcard/Music folder and type following
Code:
su
mkdir /data/local/system
mount -t ext4 -o rw,noatime /sdcard/Music/system.img /data/local/system
Now you can go to /data/local/system and tweak it and unmount afterwards
Place img2simg binary in /sdcard/Music and
Code:
cp /sdcard/Music/img2simg $HOME
chmod +x $HOME/img2simg
umount /data/local/system
cd $HOME
./img2simg /sdcard/Music/system.img /sdcard/Music/system_sparse.img
Click to expand...
Click to collapse
Code:
/system/bin/sh: su: not found
127|[email protected]:/data/data/com.termux/files/home #
d/Music/system.img /data/local/system <
[email protected]:/data/data/com.termux/files/home #
cp /sdcard/Music/img2simg $HOME
cp: //img2simg: Read-only file system
1|[email protected]:/data/data/com.termux/files/home #
chmod +x $HOME/img2simg
chmod: //img2simg: No such file or directory
1|[email protected]:/data/data/com.termux/files/home #

Related

[GUIDE]To Unpack/Repack livesuit flashable images

While browsing XDA i didn't find anything for unpacking Livesuite images so i created this THREAD.
Things you need
Allwiner kitchen
Stock Firmware
Linux image tool
Ubuntu 64 bit
Click to expand...
Click to collapse
Lets start
Step 1
Extracting and building the stock image (Windows)
Extract a10_flash_kitchen_v1.zip and look inside the directory, you'll see packer_gb and packer_ics. packer_ics is for Android ICS, so that is the one you will be using.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Open packer_ics and you will notice a bunch of directories and a couple of .bat scripts. We will spend a lot of time in these directories.
Extract the stock firmware you downloaded earlier, and copy the .img file into this directory. Rename the file to original.img.
Run the extract_image.bat script, and a command window will pop up while it is extracting.
The command window will output like the following, it will display Press any key to continue . . . when it is complete. Press a key to close the window.
Once the command window is closed, open the _extract directory and all of the extracted files will be there. The three following files are the ones we are interested in: RFSFAT16_BOOT_00000000000.fex (the boot partition), RFSFAT16_RECOVERY_0000000.fex (the recovery partition), RFSFAT16_SYSTEM_000000000.fex (the system partition, ext4 sparse).
NOTE and WARNING Some systems may also have a RFSFAT16_BOOTLOADER_00000.fex, which may also be required for your device to boot properly. There are some vague instructions @ this TechKnow forums post. I (the reader) will attempt to clarify and modify this page with the updated additional instructions for these devices to aid in making these instructions more universal for anyone using LiveSuit.
Click to expand...
Click to collapse
Step 2
Extracting, modifying and building partitions (Linux)
Copy your Extracted files to ubuntu
Rename the files as follows:
RFSFAT16_BOOT_00000000000.fex -> boot.img
RFSFAT16_RECOVERY_0000000.fex -> recovery.img
RFSFAT16_SYSTEM_000000000.fex -> system.fex
Click to expand...
Click to collapse
Copy the tools.tar.gz archive you downloaded earlier into the same directory.
To extract the tools, right click on the file and click Extract here.
This will extract the tools into a tools subdirectory.
Type terminal to show the terminal application. Hit enter and the terminal will appear.
Boot partition
Code:
$ cd "custom image"
$ tools/split_bootimg.pl boot.img
$ ls
Now extract the ramdisk file into a ramdisk subdirectory.
Code:
$ mkdir ramdisk
$ cd ramdisk
$ gunzip -c ../boot.img-ramdisk.gz | cpio -i
$ ls
You are now able to modify the files as needed.
Once you have finished modifying the file, we will rebuild the image. Run the following commands.
Code:
$ cd ..
$ tools/mkbootfs ramdisk | gzip > ramdisk-new.gz
$ tools/mkbootimg --base 0x40000000 --kernel boot.img-kernel --ramdisk ramdisk-new.gz --cmdline 'console=ttyS0,115200 rw init=/init loglevel=8' -o new-boot.img
$ ls
Recovery partition
his follows the same process as the boot partition. Execute the following commands to extract the image:
Code:
$ tools/split_bootimg.pl recovery.img
$ rm -rf ramdisk
$ mkdir ramdisk
$ cd ramdisk
$ gunzip -c ../recovery.img-ramdisk.gz | cpio -i
$ ls
rebuild the image with the following commands:
Code:
$ cd ..
$ tools/mkbootfs ramdisk | gzip > ramdisk-new.gz
$ tools/mkbootimg --base 0x40000000 --kernel recovery.img-kernel --ramdisk ramdisk-new.gz --cmdline 'console=ttyS0,115200 rw init=/init loglevel=8' -o new-recovery.img
$ ls
System partition
The process for the system partition is different, because it is not bootable and because it is ext4 sparse, so it cannot be mounted straight away. Execute the following commands to convert and mount the image:
Code:
$ tools/simg2img system.fex system.img
$ mkdir system
$ sudo mount -o loop system.img system
$ cd system
$ ls
Once you are done, execute the following commands to rebuild the system image:
Code:
$ cd ../tools
$ sudo ./mkuserimg.sh -s ../system ../new-system.fex ext4 ../tmp 300M
$ cd ..
$ sudo umount system
$ ls
Now switch back to the file browser and you will see many new files in your directory. The three files that you are interested in are new-boot.img, new-recovery.img, new-system.fex
Copy these to your Windows drive to the directory a10_flash_kitchen_v2/packer_ics/_input
Click to expand...
Click to collapse
Step 3
Building the new image (Windows)
Once the files are copied, jump back to Windows and rename the files as following:
new-boot.img -> root.fex
new-recovery.img -> recovery.fex
new-system.fex -> system.fex
Click to expand...
Click to collapse
http://i.imgur.com/klTA5.png/img]
Now we need to make some modifications to the image config file. Navigate to the files directory and you should see image.cfg.
[img]http://i.imgur.com/Wg6Ov.png/img]
Open this file using your text editor that supports Unix line endings. Using Notepad will break this file. Locate the two lines that reference OEM and VOEM as is highlighted below.
[img]http://i.imgur.com/YxczH.png
Comment these lines by adding a semicolon ( to the start of each line. Do not make any other modifications. Save the file once you have made the change.
http://i.imgur.com/urMMN.png/img]
Go back to the packer_ics root directory and find the create_image.bat script. It will open a console while it is creating the new image.
[img]http://i.imgur.com/X2O6l.png
Once the process is complete, you will see Press any key to continue . . . and you will have a new image called output.img.
AND JUST FLASH IT AND YOU ARE DONE
Click to expand...
Click to collapse
Credits
miniandwiki
To ME
To Everyone who helped me creating this one
do i have to use 64bit liux?? i only have a 32 bit computer?? thnx
Permission denied
Hey....
I installed Ubuntu on an external disk. But even logged at su (also tried sudo su) I dont have the permission to perform with the Linux-tool. When I click at the roo-folder, it is already set to rw permission for root.
What am I doing wrong?
Links are broken, can you kindly update them.
Links are broken Pls Upload to another host

How to mount & modify system.img (Ubuntu)

Hi to all. I am a newbie ... but I try to do all my best
Above all please make a directory under /mnt (I called the directory "MyMount1"); "mylogin" represents your login name.
Open the terminal and type the next commands:
-sudo mkdir /mnt/MyMount1
-sudo chown mylogin:mylogin /mnt/MyMount1
-copy system.img & paste it into MyMount1 (computer/mnt/MyMount1)
-cd /
-cd mnt
-cd MyMount1
-mkdir sys/ && sudo mount -t ext4 -o loop system.img sys/
-sudo chown mylogin:mylogin sys (without this command you will not be able to copy and modify anything)
-cd sys
-sudo chown mylogin:mylogin addon.d (without this command you will not be able to copy and modify anything)
-then copy addon.d & paste it into Ubuntu Desktop (now you can make any changes you want)
-then delete addon.d into /mnt/MyMount1/sys
-copy addon.d (into Ubuntu Desktop) & paste it into /mnt/MyMount1/sys
-then apply the same command to every folder inside system.img (/mnt/MyMount1/sys) and repeat the procedure (copy it into Ubuntu Desktop, make changes and paste it into /mnt/MyMount1/sys).
The following screenshot will help you better understand all the steps :
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Before "sudo chown mylogin:mylogin sys" command :
After "sudo chown mylogin:mylogin sys" command :
Before "sudo chown mylogin:mylogin addon.d" command :
After "sudo chown mylogin:mylogin addon.d" command :
That's all ... for now
XDA:DevDB Information
System.img, ROM for all devices (see above for details)
Contributors
Cleopatra Bianchi
ROM OS Version: 6.0.x Marshmallow
Version Information
Status: Testing
Created 2016-03-24
Last Updated 2016-03-24
hey there!!! i can give you a couple of suggestion, even if i don't get if you are only extracting or also editing and repacking since i don't see any repack code.. anyway.. first of all you definitely should use -R in yoour chown code.. this means recursive.. so you don't have to do it for every folder, subfolder and so on!! do a chown -r for sys and you're done with it.
then another thing.. i personally use a script that will handle all this by itself, i put it in the file explorer script folder and so you can access it from everywhere just right-clicking on the file you want to mount.. it will need to edit path for pass it as variable, but it's easy.. at least once you know how to
so this is my script:
Code:
#!/bin/bash
CWD=(pwd)
simg2img [email protected] img.img; mkdir /tmp/system; mate-terminal -x sudo mount -t auto -o loop img.img /tmp/system; mate-terminal -x sudo chown -R login:login /tmp/system
just to explain, you see simg2img because i work with sparse img ( from samsung) that must be converted to regular img before get mounted, so i have the simg2img binary compiled and moved into /usr/local/bin path to access it from any path.. you will need to do the same or to remove that part if you don't need it.
also you must change mate-terminal to plain terminal since you're on unity i can see
then move the script to /home/your_login/.nautilus/script (again because you're on unity using nautilus i think) check if it has the exec bit enbled from permission and then enjoy..
oh another thing.. in case you need to copy keeping the permissions and ownership, so that you don't ahve to fix all that later you simply don't set the last part of the script - the chown part, since you can access the subfolders and files anyway and for ex. use the "cp -a /tmp/system/app /your_desired_path to work on it.
Wuby986 said:
hey there!!! i can give you a couple of suggestion, even if i don't get if you are only extracting or also editing and repacking since i don't see any repack code.. anyway.. first of all you definitely should use -R in yoour chown code.. this means recursive.. so you don't have to do it for every folder, subfolder and so on!! do a chown -r for sys and you're done with it.
then another thing.. i personally use a script that will handle all this by itself, i put it in the file explorer script folder and so you can access it from everywhere just right-clicking on the file you want to mount.. it will need to edit path for pass it as variable, but it's easy.. at least once you know how to
so this is my script:
Code:
#!/bin/bash
CWD=(pwd)
simg2img [email protected] img.img; mkdir /tmp/system; mate-terminal -x sudo mount -t auto -o loop img.img /tmp/system; mate-terminal -x sudo chown -R login:login /tmp/system
just to explain, you see simg2img because i work with sparse img ( from samsung) that must be converted to regular img before get mounted, so i have the simg2img binary compiled and moved into /usr/local/bin path to access it from any path.. you will need to do the same or to remove that part if you don't need it.
also you must change mate-terminal to plain terminal since you're on unity i can see
then move the script to /home/your_login/.nautilus/script (again because you're on unity using nautilus i think) check if it has the exec bit enbled from permission and then enjoy..
oh another thing.. in case you need to copy keeping the permissions and ownership, so that you don't ahve to fix all that later you simply don't set the last part of the script - the chown part, since you can access the subfolders and files anyway and for ex. use the "cp -a /tmp/system/app /your_desired_path to work on it.
Click to expand...
Click to collapse
Thank you very much for your suggestions
I have to admit that I am a newbie/noob ... particularly on Linux (I have installed Ubuntu OS just a week ago ... I come from the planet Windows). I have tried "android_img_repack_tools-android-6.0.1_r3_x64.tar.gz" ... but simg2img doesn't works (I am not able to convert system.img in raw). I'm trying to mod a system.img Mediatek Marshmallow.
Kindest Regards.
Cleopatra Bianchi said:
Thank you very much for your suggestions
I have to admit that I am a newbie/noob ... particularly on Linux (I have installed Ubuntu OS just a week ago ... I come from the planet Windows). I have tried "android_img_repack_tools-android-6.0.1_r3_x64.tar.gz" ... but simg2img doesn't works (I am not able to convert system.img in raw). I'm trying to mod a system.img Mediatek Marshmallow.
Kindest Regards.
Click to expand...
Click to collapse
i hano NO idea about mediatek devices, you should ask in the corresponding fora, but most likely you don't need simg 2 img since that's not a sparse img, so you could be able to mount it strait away.. or at least try first without converting it.
what's the error you're getting in terminal?
Wuby986 said:
i hano NO idea about mediatek devices, you should ask in the corresponding fora, but most likely you don't need simg 2 img since that's not a sparse img, so you could be able to mount it strait away.. or at least try first without converting it.
what's the error you're getting in terminal?
Click to expand...
Click to collapse
This is the error in terminal :
Cleopatra Bianchi said:
This is the error in terminal :
Click to expand...
Click to collapse
yeah then is definitely not a sparse img.. maybe a regular img or other kinda of..
you should search for the mtk device forum for this info.. or better yet maybe the @dsixda kitchen has a conversion binary for it, so you can see which is and use it instead of the simg2img.. this kitchen is not anymore updated, so you cannot use it for everything like repack or root, but should work for unpack
Wuby986 said:
yeah then is definitely not a sparse img.. maybe a regular img or other kinda of..
you should search for the mtk device forum for this info.. or better yet maybe the @dsixda kitchen has a conversion binary for it, so you can see which is and use it instead of the simg2img.. this kitchen is not anymore updated, so you cannot use it for everything like repack or root, but should work for unpack
Click to expand...
Click to collapse
Ok ... I'll do it. Thank you very much for your suggestions.
Happy Easter
Cleopatra Bianchi said:
Hi to all. I am a newbie ... but I try to do all my best
Above all please make a directory under /mnt (I called the directory "MyMount1"); "mylogin" represents your login name.
Open the terminal and type the next commands:
-sudo mkdir /mnt/MyMount1
-sudo chown mylogin:mylogin /mnt/MyMount1
-copy system.img & paste it into MyMount1 (computer/mnt/MyMount1)
-cd /
-cd mnt
-cd MyMount1
-mkdir sys/ && sudo mount -t ext4 -o loop system.img sys/
-sudo chown mylogin:mylogin sys (without this command you will not be able to copy and modify anything)
-cd sys
-sudo chown mylogin:mylogin addon.d (without this command you will not be able to copy and modify anything)
-then copy addon.d & paste it into Ubuntu Desktop (now you can make any changes you want)
-then delete addon.d into /mnt/MyMount1/sys
-copy addon.d (into Ubuntu Desktop) & paste it into /mnt/MyMount1/sys
-then apply the same command to every folder inside system.img (/mnt/MyMount1/sys) and repeat the procedure (copy it into Ubuntu Desktop, make changes and paste it into /mnt/MyMount1/sys).
The following screenshot will help you better understand all the steps :
Before "sudo chown mylogin:mylogin sys" command :
After "sudo chown mylogin:mylogin sys" command :
Before "sudo chown mylogin:mylogin addon.d" command :
After "sudo chown mylogin:mylogin addon.d" command :
That's all ... for now
XDA:DevDB Information
System.img, ROM for all devices (see above for details)
Contributors
Cleopatra Bianchi
ROM OS Version: 6.0.x Marshmallow
Version Information
Status: Testing
Created 2016-03-24
Last Updated 2016-03-24
Click to expand...
Click to collapse
pro tip use -R to make chown reclusive and include all the subfolders
sudo chown login:login -R (folder in sys)
---------- Post added at 08:59 AM ---------- Previous post was at 08:59 AM ----------
Cleopatra Bianchi said:
Hi to all. I am a newbie ... but I try to do all my best
Above all please make a directory under /mnt (I called the directory "MyMount1"); "mylogin" represents your login name.
Open the terminal and type the next commands:
-sudo mkdir /mnt/MyMount1
-sudo chown mylogin:mylogin /mnt/MyMount1
-copy system.img & paste it into MyMount1 (computer/mnt/MyMount1)
-cd /
-cd mnt
-cd MyMount1
-mkdir sys/ && sudo mount -t ext4 -o loop system.img sys/
-sudo chown mylogin:mylogin sys (without this command you will not be able to copy and modify anything)
-cd sys
-sudo chown mylogin:mylogin addon.d (without this command you will not be able to copy and modify anything)
-then copy addon.d & paste it into Ubuntu Desktop (now you can make any changes you want)
-then delete addon.d into /mnt/MyMount1/sys
-copy addon.d (into Ubuntu Desktop) & paste it into /mnt/MyMount1/sys
-then apply the same command to every folder inside system.img (/mnt/MyMount1/sys) and repeat the procedure (copy it into Ubuntu Desktop, make changes and paste it into /mnt/MyMount1/sys).
The following screenshot will help you better understand all the steps :
Before "sudo chown mylogin:mylogin sys" command :
After "sudo chown mylogin:mylogin sys" command :
Before "sudo chown mylogin:mylogin addon.d" command :
After "sudo chown mylogin:mylogin addon.d" command :
That's all ... for now
XDA:DevDB Information
System.img, ROM for all devices (see above for details)
Contributors
Cleopatra Bianchi
ROM OS Version: 6.0.x Marshmallow
Version Information
Status: Testing
Created 2016-03-24
Last Updated 2016-03-24
Click to expand...
Click to collapse
pro tip use -R to make chown reclusive and include all the subfolders
sudo chown login:login -R (folder in sys)

[TOOL][ARM]sdat2img for Android!

sdat2img for Android!
Most of us, have no pc for converting system.new.dat to system.img...
So, this is why i create this tool!​
Code:
[B]Post 1[/B] → Introduction, installation, downloads
[B]Post 2[/B] → Changelog
[B]Post 3[/B] → How to use
sdat2img is a tool, that write on python language, to convert system.new.dat into system.img
This tool was only work on Windows and Linux
So i adapt it into android that can be runned in the Terminal​
Requirements:
Custom Recovery
Around 30-50MB of free system
a Terminal
Installation:
Download the zip
Install via custom recovery
Reboot!
Uninstalling:
I should have the uninstaller, but it is gone somewere in my PC. So maybe later gonna add this.
Download links:
AndroidFileHost
Credits:
@xpirt for sdat2img.py
@7175 for python for android
XDA:DevDB Information
sdat2img for Android, Tool/Utility for the Android General
Contributors
RendyAK
Version Information
Status: Beta
Current Beta Version: 0.2
Created 2016-08-27
Last Updated 2016-08-27
Changelog:
0.2 BETA
Code:
[Fixed] Convert error
Old Changelog
Code:
[B]0.1 BETA[/B]
- Intial Release
How to use!
Well, this is pretty simple, haha.
Just like the @xpirt sdat2img.
Code:
Usage: sdat2img <system_transfer_list> <system_new_file> <system_img>
And wait for the process finish.
WARNING!
I SUGGEST YOU TO "cd" TO THE DIRECTORY OF system.new.dat FIRST!
How to extract the system.img?
Just simply enter this command
Dont forget to "cd" to the directory of system.img
Code:
mkdir system
mount -t ext4 -o loop system.img system
cp -rf system system2
And the output is on system2 folder.
Dont forget to press enter each command you type!
Reserved for some case.
Update!
0.2 BETA
Code:
[Fixed] Convert error
Incredible! Thank you so much for this, can't wait to try it out! :good:
RendyAK said:
Changelog:
0.2 BETA
Click to expand...
Click to collapse
After unpacking the file sdat2img-android-arm-0.2.zip, catalog python3.4.2 occupies 42.6 MB of valuable space on the system partition.
Could you just leave these components python that are needed?
Thanks.
ze7zez said:
After unpacking the file sdat2img-android-arm-0.2.zip, catalog python3.4.2 occupies 42.6 MB of valuable space on the system partition.
Could you just leave these components python that are needed?
Thanks.
Click to expand...
Click to collapse
I didnt know whats the python main file.
But it think for best result its need all of the python files.
On Android! Just what I was searching for. Thank you @RendyAK. This is awesome stuff.
hi @RendyAK
I have a cm12 system.new.dat. What will your program do to this
I floop the pig
Everything had worked fine till i tried to convert a dat file of over 4gb. It says
[email protected]:/ $ su
[email protected]:/ # cd /storage/sdcard1
system.transfer.list system.new.dat system.img <
Traceback (most recent call last):
File "/system/python3.4.2/sdat2img.py", line 99, in <module>
main(sys.argv)
File "/system/python3.4.2/sdat2img.py", line 78, in main
init_output_file_size(output_img, commands)
File "/system/python3.4.2/sdat2img.py", line 73, in init_output_file_size
output_file_obj.flush()
OSError: [Errno 27] File too large
1|[email protected]:/storage/sdcard1 #
adithbalan said:
Everything had worked fine till i tried to convert a dat file of over 4gb. It says
0_a1[email protected]:/ $ su
[email protected]:/ # cd /storage/sdcard1
system.transfer.list system.new.dat system.img <
Traceback (most recent call last):
File "/system/python3.4.2/sdat2img.py", line 99, in <module>
main(sys.argv)
File "/system/python3.4.2/sdat2img.py", line 78, in main
init_output_file_size(output_img, commands)
File "/system/python3.4.2/sdat2img.py", line 73, in init_output_file_size
output_file_obj.flush()
OSError: [Errno 27] File too large
1|[email protected]:/storage/sdcard1 #
Click to expand...
Click to collapse
Please make sure you have 4-8GB free on your sdcard.
PiggyFlooper said:
hi @RendyAK
I have a cm12 system.new.dat. What will your program do to this
I floop the pig
Click to expand...
Click to collapse
It just do the same with the xpirt's sdat2img.
Go to xpirt thread for more info
@RendyAK, can you give me a link to the python for android
When i write this command
mount -t ext4 -o loop system.img system
Then it shows device or resource busy
@RendyAK
Hi is there a way to uninstall this zip ?
Help me !
RendyAK said:
Well, this is pretty simple, haha.
Just like the @xpirt sdat2img.
Code:
Usage: sdat2img <system_transfer_list> <system_new_file> <system_img>
And wait for the process finish.
WARNING!
I SUGGEST YOU TO "cd" TO THE DIRECTORY OF system.new.dat FIRST!
How to extract the system.img?
Just simply enter this command
Dont forget to "cd" to the directory of system.img
Code:
mkdir system
mount -t ext4 -o loop system.img system
cp -rf system system2
And the output is on system2 folder.
Dont forget to press enter each command you type!
Click to expand...
Click to collapse
After I type and enter " Usage: sdat2img...." , terminal display this "
/system/bin/sh: syntax error: '< ' unexpected
"
Lordlight said:
After I type and enter " Usage: sdat2img...." , terminal display this "
/system/bin/sh: syntax error: '< ' unexpected
"
Click to expand...
Click to collapse
Don't type it literally. You supposed to replace stuff in brackets with your filenames. "Usage:" should be there too.
Thanks a lot !
Not_Sure said:
Don't type it literally. You supposed to replace stuff in brackets with your filenames. "Usage:" should be there too.
Click to expand...
Click to collapse
Could you please give me an example ?
It is better.
Binary sdat2img, no python

[Question] How to extract system data

I am try extract system.IMG to system data but not working.
In phone or computer?
For Linux, I used this: https://forum.xda-developers.com/showthread.php?t=1588461
basically, download simg2img, run a terminal and
Code:
mkdir mounted
./simg2img SYSTEM.img sys.raw
sudo mount -t ext4 -o loop sys.raw mounted/
Edit: As you see, you can't extract system.img as is.

Question [SOLVED] How to extract files from super.img?

I am using global ROM in TB-J706F but I wanted to extract the original wallpaper from chinese ROM, so I downloaded the one available in lolinet.
Then I did (I am using Linux):
Extract files
Merge super_* to a single file with
Bash:
cat super_1.img super_2.img super_3.img super_4.img > super.img
Extract system_a.img with
Bash:
lpunpack -p system_a super.img ./super
Now I don't know how to mount system_a.img, this is what I tried:
Bash:
> simg2img super/system_a.img super/system_a.ext4.img
Invalid sparse file format at header magic
Failed to read sparse file
Bash:
> sudo mount -t ext4 -o loop super/system_a.img ./system
mount: ./system: wrong fs type, bad option, bad superblock on /dev/loop2, missing codepage or helper program, or other error.
Bash:
> file super/system_a.img
super/system_a.img: data
What am I missing?
P.S.
Anyway if someone has the wallpaper and can upload it somewhere would be great.
MrCrayon said:
I am using global ROM in TB-J706F but I wanted to extract the original wallpaper from chinese ROM, so I downloaded the one available in lolinet.
Then I did (I am using Linux):
Extract files
Merge super_* to a single file with
Bash:
cat super_1.img super_2.img super_3.img super_4.img > super.img
Extract system_a.img with
Bash:
lpunpack -p system_a super.img ./super
Now I don't know how to mount system_a.img, this is what I tried:
Bash:
> simg2img super/system_a.img super/system_a.ext4.img
Invalid sparse file format at header magic
Failed to read sparse file
Bash:
> sudo mount -t ext4 -o loop super/system_a.img ./system
mount: ./system: wrong fs type, bad option, bad superblock on /dev/loop2, missing codepage or helper program, or other error.
Bash:
> file super/system_a.img
super/system_a.img: data
What am I missing?
P.S.
Anyway if someone has the wallpaper and can upload it somewhere would be great.
Click to expand...
Click to collapse
Have you read the link below?
Editing system.img inside super.img and flashing our modifications
I'm trying to modify my system.img (/system/build.prop) to include support for multi users. After struggling a lot, I've succeeded following your guide (that's an awesome work btw) to unpack, mount, modify, umount and repack super.img. Then...
forum.xda-developers.com
mardon85 said:
Have you read the link below?
Editing system.img inside super.img and flashing our modifications
I'm trying to modify my system.img (/system/build.prop) to include support for multi users. After struggling a lot, I've succeeded following your guide (that's an awesome work btw) to unpack, mount, modify, umount and repack super.img. Then...
forum.xda-developers.com
Click to expand...
Click to collapse
Yes, I got some of the commands from there, as far as I understand what they do there is aimed to mount system rw so I shouldn't need it, I tried to mount read only and it gives the same error.
Also I cannot use resize2fs or e2fsck because it's not recognized as an image, I get:
Bad magic number in super-block
I think system_a.img needs an additional step but it's not even compressed, so I'm stuck.
Ok, I solved it.
It was actually very easy, starting from the ROM:
Extract files
Mount super_2.img for system with:
Bash:
sudo mount -t ext4 -o ro,loop super_2.img ./system
The trick is that it needs to be mounted read only with ro.
Nicely done. Did you find the wallpaper?
Yes, it was in system/media/wallpaper.

Categories

Resources