[Tools][windows][Pie]Auto System Image Exctractor - Android General

==============================================
Auto System Image Exctractor
==============================================
==============================================
Supports
1) system.new.dat
2) system.new.dat.br
3) payload.bin
==============================================
==============================================
Requiremnets
==============================================
1. python v3.x
2. 7-Zip
Note 1: make sure your environment variables path is correctly set for python and 7-Zip(set it in system properties-->advance-->environment variable-->path)
Note2: while installing python, set the environment variables in installer itself​
==============================================
How To
==============================================
1) extract system_new_dat_extractor.zip into a folder (preferable in a path where there are no name spaces)
2) place your rom zip file in the directory where you extracted
3) open the file system_image_extractor_V4.cmd
4) wait for it to extract everything
5) folder with extracted content will open automatically
6) have fun tweaking
*make sure to delete the created folders every time you want to extract
==============================================
Credits
==============================================
1) And_pda for imgextractor
2) xpirt for sdat2img.py
3) google
4) cyxx
5) ius
6) @aIecxs
==============================================
Change-log
==============================================
Code:
* initial release
-----------------------------
V2 supports Nougat
converts file_contexts.bin to file_contexts
-----------------------------
V3
[U]Now Supports[/U]
1) system.new.dat
2) system.new.dat.br
3) payload.bin
V4 (25-06-2019)
1) changed the entire script.
2) Fixed issues where user files got deleted automatically
-it was due spaces in path
source​

Im testing m8

Note: make sure your environment variables path is correctly set for python and 7-Zip(set it in system properties-->advance-->environment variable-->path) @chiragkrishna, pls explain me or help me clear instructions. tks so much

romano19 said:
Note: make sure your environment variables path is correctly set for python and 7-Zip(set it in system properties-->advance-->environment variable-->path) @chiragkrishna, pls explain me or help me clear instructions. tks so much
Click to expand...
Click to collapse
{
"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"
}
add the location of your python(C:\Program Files (x86)\Python27) and 7-Zip(C:\Program Files\7-Zip) to the path!!!

Hello, nicie you made it, but how to repack it back to system.new.dat? Thanks for answering

supports system.new.dat from nougat?

Hi, I receive the following error:
WARNING
file_contexts not found!!
Click to expand...
Click to collapse

Jancar 52 mcpe said:
supports system.new.dat from nougat?
Click to expand...
Click to collapse
Wondering the same thing, will this work on Nougat, LineageOS 14.1 ROMs?

Neo3D said:
Wondering the same thing, will this work on Nougat, LineageOS 14.1 ROMs?
Click to expand...
Click to collapse
I asked this because it doesn't support the file_contexts.bin, if it does not detect it or it does not support it I can not recompress it again, and at the time of installing that compressed package with the other files gives error

Jancar 52 mcpe said:
supports system.new.dat from nougat?
Click to expand...
Click to collapse
Neo3D said:
Wondering the same thing, will this work on Nougat, LineageOS 14.1 ROMs?
Click to expand...
Click to collapse
Jancar 52 mcpe said:
I asked this because it doesn't support the file_contexts.bin, if it does not detect it or it does not support it I can not recompress it again, and at the time of installing that compressed package with the other files gives error
Click to expand...
Click to collapse
updated with Nougat support
converts file_contexts.bin to file_contexts text file

My simple script - Python not needed
Hi chiragkrishna, thank you for the tool.
Unfortunately it doesn't work for me, it gets stuck on the file_contexts.bin
In light of this I made my own super simple bat file, that extracted the whole system folder successfully.
Then I went a step further and created a EXE from the provided python script, so there would be no python requirement.
But you do have to manually unzip the system.transfer.list and system.new.dat files from your rom (turns out, no other files required for Nougat).
My simple script:
works on Nougat (tested on 7.1.2 NitrogenOS)
no Python needed
just unzip system.transfer.list and system.new.dat files, and place them in rom folder
run start.bat

minibraun said:
Hi chiragkrishna, thank you for the tool.
Unfortunately it doesn't work for me, it gets stuck on the file_contexts.bin
In light of this I made my own super simple bat file, that extracted the whole system folder successfully.
Then I went a step further and created a EXE from the provided python script, so there would be no python requirement.
But you do have to manually unzip the system.transfer.list and system.new.dat files from your rom (turns out, no other files required for Nougat).
My simple script:
works on Nougat (tested on 7.1.2 NitrogenOS)
no Python needed
just unzip system.transfer.list and system.new.dat files, and place them in rom folder
run start.bat
Click to expand...
Click to collapse
The most under appreciated post

Deleted

minibraun said:
Hi chiragkrishna, thank you for the tool.
Unfortunately it doesn't work for me, it gets stuck on the file_contexts.bin
In light of this I made my own super simple bat file, that extracted the whole system folder successfully.
Then I went a step further and created a EXE from the provided python script, so there would be no python requirement.
But you do have to manually unzip the system.transfer.list and system.new.dat files from your rom (turns out, no other files required for Nougat).
My simple script:
works on Nougat (tested on 7.1.2 NitrogenOS)
no Python needed
just unzip system.transfer.list and system.new.dat files, and place them in rom folder
run start.bat
Click to expand...
Click to collapse
Please start a new thread. As I use many extractors nothing is extract my system new data but your tool done. Great.

How can I repack the modified system in system.new.dat after extracting?

Mr.Ak said:
How can I repack the modified system in system.new.dat after extracting?
Click to expand...
Click to collapse
I have no idea, these tools are just for extracting.
I see people are having trouble all over the place.
You can try this tool and hope for the best:
https://forum.xda-developers.com/chef-central/android/tool-extract-repack-dat-img-android-5-8-t3670763

minibraun said:
I have no idea, these tools are just for extracting.
I see people are having trouble all over the place.
You can try this tool and hope for the best:
https://forum.xda-developers.com/chef-central/android/tool-extract-repack-dat-img-android-5-8-t3670763
Click to expand...
Click to collapse
Thank you for the recommendation.I tried almost every tool available,but haven't tried this one yet.I'll give this a try.Unfortunately,I have to dirty build the rom everytime to get the changes done.Hopefully,this tool will maybe able to repack fine.

minibraun said:
Hi chiragkrishna, thank you for the tool.
Unfortunately it doesn't work for me, it gets stuck on the file_contexts.bin
In light of this I made my own super simple bat file, that extracted the whole system folder successfully.
Then I went a step further and created a EXE from the provided python script, so there would be no python requirement.
But you do have to manually unzip the system.transfer.list and system.new.dat files from your rom (turns out, no other files required for Nougat).
My simple script:
works on Nougat (tested on 7.1.2 NitrogenOS)
no Python needed
just unzip system.transfer.list and system.new.dat files, and place them in rom folder
run start.bat
Click to expand...
Click to collapse
good work

minibraun said:
Hi chiragkrishna, thank you for the tool.
Unfortunately it doesn't work for me, it gets stuck on the file_contexts.bin
In light of this I made my own super simple bat file, that extracted the whole system folder successfully.
Then I went a step further and created a EXE from the provided python script, so there would be no python requirement.
But you do have to manually unzip the system.transfer.list and system.new.dat files from your rom (turns out, no other files required for Nougat).
My simple script:
works on Nougat (tested on 7.1.2 NitrogenOS)
no Python needed
just unzip system.transfer.list and system.new.dat files, and place them in rom folder
run start.bat
Click to expand...
Click to collapse
getting this error
------------------------------------
------------------------------------
SYSTEM.NEW.DAT to SYSTEM FOLDER
by minibraun
------------------------------------
------------------------------------
Extract system.transfer.list and system.new.dat from your ROM.zip into the ROM folder
------------------------------------
Press any key to continue . . .
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the file specified.
Could Not Find C:\WINDOWS\system32\system_statfile.txt
Extraction complete!
Press any key to continue . . .

minibraun said:
Hi chiragkrishna, thank you for the tool.
Unfortunately it doesn't work for me, it gets stuck on the file_contexts.bin
In light of this I made my own super simple bat file, that extracted the whole system folder successfully.
Then I went a step further and created a EXE from the provided python script, so there would be no python requirement.
But you do have to manually unzip the system.transfer.list and system.new.dat files from your rom (turns out, no other files required for Nougat).
My simple script:
works on Nougat (tested on 7.1.2 NitrogenOS)
no Python needed
just unzip system.transfer.list and system.new.dat files, and place them in rom folder
run start.bat
Click to expand...
Click to collapse
The link is not working, can you please update?

Related

Porting Android One Cross Dev Roms to 6582/92

Credits - Manish Singh ([email protected])
Simplified and detailed by me (Arun Sharma)
{
"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"
}
Base Rom - CM12.1
Port Rom - Any Rom from here
First of all Comes Extracting the system.new.dat file :laugh:
Here's how to do it:-
1) Download sdat2img tool from here
(Source - thanks to @xpirt)
2) copy it to your port rom folder
3) Shift+Right click and choose Open Command window here
4) enter the command
sdat2img system.transfer.list system.new.dat system.img
hit enter.
It'll show reading blocks, will take around 20 seconds and you'll see a System.img file, newly created
5) You can now extract that with ext4unpacker to get the system folder
just choose the image, select contents and extract anywhere you want.
Now, let's Port!
1) Open Lib folder in port rom &
Copy EGL folder,
Libandroidfw, libandroid_servers, libandroid_runtime.so
libskia, libinput ,libsurfaceflinger, libjavacore, libcamera files (except libcameracustom)
files to a new folder, name it lib
Open Bin folder, copy the file named input to a new folder, name it bin
2) Copy all Libs, Bins from cm12.1 to port Rom (leave existing ones in port rom)
after its done, copy back the files that we copied in step 1 in that lib, bin folder to port rom (original ones from port)
3) Copy vendor folder from CM12.1 to port rom
4) Copy Firmware folder from CM12.1/etc to port rom
you may also copy the lib/ hw folder from cm12.1 to port rom (if you face any issues with sensors)
5) Use boot.img of cm12.1 Or pacman or AICP
Or Make one Yourself
Making boot.img for cm12.1 based roms :-
1) Extract port and stock boot.img files using Android Kitchen
2) Copy zImage file of stock boot.img to port boot.img
3) Repack the port boot folder and use that boot.img
in case it doesn't work, copy the uevented.rc file from stock boot/ramdisk folder to port boot/ramdisk (along with zimage)
and pack it!
Done.. add this boot.img to your port rom folder)
:laugh:
------------------------------------------------------------------------------------
Now, your rom will work, however, you may see that none of the storages are mounted!
So, here's how to fix that
1) Copy the Framework-res.apk from any of the CM12.1 based roms for your device or the stock rom
2) Decompile it (TickleMyAndroid tool can be used for that)
3) open the working folder, go to res/xml folder and copy Storage-list.xml file
4) Now decompile the port rom's Framework-res.apk also, in separate folder
and paste that copied storage-list.xml file into it's res/xml folder
5) Compile it and copy back to port/framework folder.
Storage will be fixed now
6) You may wanna add some changes to build.prop also (if you want)
7) Use the meta-inf of any existing CM12.1 or CM12 rom for your device also!
8) Now, zip the rom and Copy the rom to anywhere in SDCard or internal storage
Flash from recovery!
Happy Porting :laugh:
Thanks
arun6106 said:
Credits - Manish Singh ([email protected])
Simplified and detailed by me (Arun Sharma)
Base Rom - CM12.1
Port Rom - Any Rom from here
First of all Comes Extracting the system.new.dat file :laugh:
Here's how to do it:-
1) Download sdat2img tool from here
(Source - thanks to @xpirt)
2) copy it to your port rom folder
3) Shift+Right click and choose Open Command window here
4) enter the command
sdat2img system.transfer.list system.new.dat system.img
hit enter.
It'll show reading blocks, will take around 20 seconds and you'll see a System.img file, newly created
5) You can now extract that with ext4unpacker to get the system folder
just choose the image, select contents and extract anywhere you want.
Now, let's Port!
1) Open Lib folder in port rom &
Copy EGL folder,
Libandroidfw, libandroid_servers, libandroid_runtime.so
libskia, libinput ,libsurfaceflinger, libjavacore, libcamera files (except libcameracustom)
files to a new folder, name it lib
Open Bin folder, copy the file named input to a new folder, name it bin
2) Copy all Libs, Bins from cm12.1 to port Rom (leave existing ones in port rom)
after its done, copy back the files that we copied in step 1 in that lib, bin folder to port rom (original ones from port)
3) Copy vendor folder from CM12.1 to port rom
4) Copy Firmware folder from CM12.1/etc to port rom
you may also copy the lib/ hw folder from cm12.1 to port rom (if you face any issues with sensors)
5) Use boot.img of cm12.1 Or pacman or AICP
Or Make one Yourself
Making boot.img for cm12.1 based roms :-
1) Extract port and stock boot.img files using Android Kitchen
2) Copy zImage file of stock boot.img to port boot.img
3) Repack the port boot folder and use that boot.img
in case it doesn't work, copy the uevented.rc file from stock boot/ramdisk folder to port boot/ramdisk (along with zimage)
and pack it!
Done.. add this boot.img to your port rom folder)
:laugh:
------------------------------------------------------------------------------------
Now, your rom will work, however, you may see that none of the storages are mounted!
So, here's how to fix that
1) Copy the Framework-res.apk from any of the CM12.1 based roms for your device or the stock rom
2) Decompile it (TickleMyAndroid tool can be used for that)
3) open the working folder, go to res/xml folder and copy Storage-list.xml file
4) Now decompile the port rom's Framework-res.apk also, in separate folder
and paste that copied storage-list.xml file into it's res/xml folder
5) Compile it and copy back to port/framework folder.
Storage will be fixed now
6) You may wanna add some changes to build.prop also (if you want)
7) Use the meta-inf of any existing CM12.1 or CM12 rom for your device also!
8) Now, zip the rom and Copy the rom to anywhere in SDCard or internal storage
Flash from recovery!
Happy Porting :laugh:
Click to expand...
Click to collapse
Thanks bro but this porting tut not working on Mokee LP rom......
but works for other roms......
Not Working
Getting error while enter code in CMD:crying::crying:
ZeroVirus said:
Getting error while enter code in CMD:crying::crying:
Click to expand...
Click to collapse
make sure you downloaded the correct tool
should be 5.4 mb in size
then, verify that both input files exist there:-
system.new.dat
system.transfer.list
You may want to, re-write all the OP.
otherwise, this will be closed.
...
And who built CyanogenMod 11/12/12.1 for "regular" MT6582 / 92 devices?
The most important persons you failed to mention...
You know, the ones who actually built it?
--> The 6582/92 development group.
yeah its 5.4 mb and all files are there
---------- Post added at 12:28 PM ---------- Previous post was at 12:24 PM ----------
i dont have this two file
system.new.dat
system.transfer.list
after extracting how can i compile back to system.new.dat?
hello need a help............ i have booted a rom ... but when i installed apps and trying to open its fortunately stopped... can you help.. mt6592
Even marshmallow ROMs?
Cam lib files means which can u post it please
Does it work on cm13?

[Tool] [Windows] Auto Tool Unpack Repack Rom Android .DAT

[Tool] [Windows] Auto Tool Unpack Repack Rom Android .DAT [No Cygwin] [No Linux]
***(Marshmallow Supported)***
Develop by MTK THAI ROM MODDER (Thiland) Group
Create Tool by: Kritsada Chaitan
SS:
Youtube : https://www.youtube.com/watch?v=nKYozWOETIU
-NOTE 1.-
***First Install Needed For Use This Tool.***
1. Java SDK
2. Python v3.xx
-NOTE 2.-
***First Copy system.new.dat , system.transfer.list To "Paste-DAT-Here" Folder.***
Download:
MEGA
Thank you Original Thread by: "xpirt" https://forum.xda-developers.com/member.php?u=5132229
Thanks for the tool
Bebooo43 said:
Thanks for the tool
Click to expand...
Click to collapse
Good.... ^^
It is a wonderful tool, brother.
is this tool works fine?
Getting error about incompatible operating system when recompressing dat so I tried on windows and got the same do I have to install the java or the phyton to a certain directory or the auto tool to a certain directory it extracted fine thanks in advance for the feedback
Can someone lend a hand.... Program works great. After removing a couple apps, one from 'app' another from 'priv-app', I made a zip file with 7zip and tried flashing but it fails. Is 7zip okay to make a zip file? was I not supposed to remove a 'priv-app' ? I can't find any solid guides on editing a MM rom. thanks in advance.
i succesfully unpack .dat files and repack .dat files (without edit anything) using this tool .
then i replace the repack .dat file to the rom and zip it and flash it .
but the problem is, when i flash i get error 7 system partition has unexpected contents after ota update . any solution ?
can't unpack system.new.dat cm14 (7.1)
Thank you very much, really useful
update - https://forum.xda-developers.com/an...tool-tool-unpack-repack-dat-img-v2-0-t3284806
Is it work for N based ROMs
tooolll
worked for me also...
t.y.
please update it to new version waiting for it.

For (WINDOWS) Tool Android Unpack\Repack system.new.dat Nougat 7.х.х

A tool to Repack the firmware image system.new.dat Nougat 7.x.x
the author of the tool by Karan Sangaj thank you :good: on XDA haven't found the original post
The usage is very simple, I hope many will be useful.
thanks for the help ajsmsg78
1) install Python 2.7.13
2) original post File contexts.bin converter thank you
another File context tools thank you
video instruction
https://www.youtube.com/watch?v=OsHWPdIgGjY
https://plus.google.com/u/0/collection/EiQ1NE
sory for my English
cannot convert my_new_system.img.
how to convert it exactly?
Any solution??
Traceback (most recent call last):
File "C:\Users\pc\Desktop\Android Unpack Repack Nougat\tools\img2sdat.py", line 10, in <module>
import common, blockimgdiff, sparse_img
File "C:\Users\pc\Desktop\Android Unpack Repack Nougat\tools\common.py", line 112
print " running: ", " ".join(args)
^
Esakren17 said:
Any solution??
Traceback (most recent call last):
File "C:\Users\pc\Desktop\Android Unpack Repack Nougat\tools\img2sdat.py", line 10, in <module>
import common, blockimgdiff, sparse_img
File "C:\Users\pc\Desktop\Android Unpack Repack Nougat\tools\common.py", line 112
print " running: ", " ".join(args)
^
Click to expand...
Click to collapse
I am getting the same error as this, what should I do to fix it?
Have installed python v2.7.13+3.6.1, latest java jdk and jre and .NET framework v4.7 and running windows 10, it had worked on the first try but started showing this error suddenly.
It works, but after install ROM the battery discharges very quickly and heats up... I think that incorrectly exposed file permissions, because if i flash "system" folder with setting simlinks and set_metadata in updater-script ROM works fine and battery is ok.
ROM work only with system.img, system.new.dat dont flash, error 7 in TWRP...
best tools ,thanks!!
raghuM said:
I am getting the same error as this, what should I do to fix it?
Have installed python v2.7.13+3.6.1, latest java jdk and jre and .NET framework v4.7 and running windows 10, it had worked for the first time but started showing this error suddenly
Click to expand...
Click to collapse
same here
Anyway to repack oreo
Got a problem with this tool.....
it works perfectly to extracting system.new.dat and unpack system.img I modify and remove some files in the system folder (remove some apks and fonts, add some hosts....) so the size of the system folder change and when I type the 04 option got this error message.....
0 [main] make_ext4fs 7236 cygwin_exception:pen_stackdumpfile: Dumping stack trace to make_ext4fs.exe.stackdump
Impossible de trouver C:\Users\RAYMAN95\Desktop\Android Unpack Repack Nougat\temp_size.txt
How is it possible to made some modifications and repack it to system.new.dat????
thank's for the help
This tool is very nice.... But please help me guys... On the last step I'm failed to repack system.img to new.system.dat... SYNTAX ERROR... how to fix it?
By the way it is very great tool... Thx to Dev ^^
Can't Unpack system.img
Ok Bro .. That's awesome Tutorial.
I have the system.img of Note 8 AP file .. I try to unpack it directly but it Ext4Extractor.exe is stopping working.
I don't have system.new.dat file so I'm trying to unpack system.img directly but it doesn't work.
As these images show the error:
https://imgur.com/a/jlZvb
Thank you very much for your tools very easy to use Thank you again
iMenesi said:
Ok Bro .. That's awesome Tutorial.
I have the system.img of Note 8 AP file .. I try to unpack it directly but it Ext4Extractor.exe is stopping working.
I don't have system.new.dat file so I'm trying to unpack system.img directly but it doesn't work.
As these images show the error:
https://imgur.com/a/jlZvb
Click to expand...
Click to collapse
The link is not working.
You need to have a custom ROM, and in it system.transfer.list and system.new.dat.
Use this method:
[DEV] sdat2img 1.0 - img2sdat 1.2 ◦ Unpack/re-pack android DAT files
For a long time I use and have not found Android ROM 5.1.1 - 8.0.0, which can not be unpacked using sdat2img.py.
Thank you authors @xpirt , @luxi78 , @howellzhu !
You dont need a custom rom or the system.transfer.list, or system.new.dat. This unpacks images just fine. It will not unpack factory images tho. I got it to work just fine unpacking nexus 6 system.img by placing the image in the output_converted_dat_to_ext4 folder then telling the bat file what the size is and unpacking it. Do the same thing for oreo and the ext4 exe crashes.
ze7zez said:
The link is not working.
You need to have a custom ROM, and in it system.transfer.list and system.new.dat.
Use this method:
[DEV] sdat2img 1.0 - img2sdat 1.2 ◦ Unpack/re-pack android DAT files
For a long time I use and have not found Android ROM 5.1.1 - 8.0.0, which can not be unpacked using sdat2img.py.
Thank you authors @xpirt , @luxi78 , @howellzhu !
Click to expand...
Click to collapse
iMenesi said:
Ok Bro .. That's awesome Tutorial.
I have the system.img of Note 8 AP file .. I try to unpack it directly but it Ext4Extractor.exe is stopping working.
I don't have system.new.dat file so I'm trying to unpack system.img directly but it doesn't work.
As these images show the error:
https://imgur.com/a/jlZvb
Click to expand...
Click to collapse
greeshan said:
It works, but after install ROM the battery discharges very quickly and heats up... I think that incorrectly exposed file permissions, because if i flash "system" folder with setting simlinks and set_metadata in updater-script ROM works fine and battery is ok.
ROM work only with system.img, system.new.dat dont flash, error 7 in TWRP...
Click to expand...
Click to collapse
flash "system" folder with setting simlinks and set_metadata in updater-script ROM
Click to expand...
Click to collapse
How did you fix the problem?
How did you do that?
master.robot said:
How did you fix the problem?
How did you do that?
Click to expand...
Click to collapse
i use commands set_metdata(xxxx); after block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat") ||
abort("E1001: Failed to update system image.");
Is this tool work with oreo roms ?
wgmmmx said:
Is this tool work with oreo roms ?
Click to expand...
Click to collapse
No i think
link77kz said:
A tool to Repack the firmware image system.new.dat Nougat 7.x.x
the author of the tool by Karan Sangaj thank you :good: on XDA haven't found the original post
The usage is very simple, I hope many will be useful.
thanks for the help ajsmsg78
1) install Python 2.7.13
2) original post File contexts.bin converter thank you
another File context tools thank you
video instruction
https://www.youtube.com/watch?v=OsHWPdIgGjY
https://plus.google.com/u/0/collection/EiQ1NE
sory for my English
Click to expand...
Click to collapse
rom isn't booting after editing system.new.dat. any help ?
For anyone having syntax errors converting systemsparse.img to system.new.dat just download the updated img2sdat files from the link below and extract all files ending in .py to the tools folder of this batch tool. There's also an updated sdat2img.py linked below which goes in the same tools folder. Overwrite all the old files when prompted.
Edit: I've attached a zip that has the tools already updated. Maybe the OP can update the first post?
img2sdate update: https://github.com/xpirt/img2sdat
sdat2img update: https://github.com/xpirt/sdat2img

[Guide][SC8830/SC7731/SC9830]Custom ROMs Porting Guide for Spreadtrum phones.

Thread will be best viewed in website
Code:
[CENTER][COLOR="red"]Your warranty is now void.[/COLOR]
I am not responsible for bricked devices, dead SD cards,
thermonuclear war, or you getting fired because the alarm app failed. Please
do some research before asking help and reporting bugs.
Please read the entire OP instructions and FAQ,if any.
You are choosing to make these modifications, and if
you point the finger at me for messing up your device, I will laugh at you.
A lot.[/CENTER]
This thread is for spreadtrum Marshmallow, lollipop and KitKat phones. I made this guide for porting especially CM/CM based ROMs. This thread is in under progress, I'll be keep adding and changing things. These lines will be removed when I think I'm done.
Requirements
A PC /Laptop /Even your android phone is enough for porting, since your not building ROM, provided that you know how to get things done
Android Image Kitchen
A ZIP archiver(winzip,7z,etc)
Notepad++/your favorite one
HEX Editor (for Android available on play store)
A working brain with basic understanding skills properly installed
An Android device with the chipset as per the title (of cource this will work on iPhone and Windows phones but sadly my kitten eaten flashing instructions , so blame my kitty:silly
A working custom recovery (if you don't have one, this thread might help you)
Aroma File Manager (this is used to skip the process of extracting system files from system.ext.win and system.new.dat and compressing it back)
Stock ROM (extracted to easily accessable folder, since we are going to port the ROM not using normal File Manager but a recovery based file manager
Custom ROM(S) (download links are in the 2nd post)
I'll suggest you to concentrate on booting the ROM rather fixing bugs at first shot, because if we are sure that the ROM boots we can go further, otherwise it's waste of time.
{
"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"
}
Marshmallow ROM porting guide
=> Download and Extract the ROM. Since ROM(S) is zipped out of custom recovery backup you'll see system.ext4.win (which is a compressed system folder) boot.emmc.win (boot.img) and some, maybe, compressed using system.new.dat.
Porting boot.img
=> Copy stock boot.img to working directory of AIK
=> Unpack boot.img and rename ramdisk to ramdisk.s and split_img to spli_img.s
=> Copy boot.emmc.win to working directory of AIK and rename it to boot.img
=> Unpack boot.img
=> Replace the following
/ramdisk/lib/modules with /ramdisk.s/lib/modules
/ramdisk/lib/modules/mali.ko with /system/lib/modules/mali.ko from stockrom
=> delete split_img and rename split_img.s to split_img
repack it and rename image-new.img to boot.emmc.win and replace Custom ROM boot.emmc.win with ported boot.emmc.win.
Porting System
=> Boot to recovery and wipe system, data, cache and dalvik-cache and flash the CM13/Marshmallow ROM
=> Go back to tab menu of TWRP tap on 'Mount tab' Mount system and go back to flash tab and flash aroma file manager zip
=> Now you are on Aroma FM. Copy and replace the following files with stock ROM files:
/system/lib/hw/<all files> except files audio.primary.sc8830.so & bluetooth.default.so
/system/etc/ all audio related files except audio_effect.conf
/system/etc/codec_pga.xml
/system/etc/ media related files
/system/etc/tiny_hw.xml
/system/lib/egl/libGLES_mali.so
/system/lib/libEGL.so
/system/lib/libGLES_trace.so
/system/lib/libGLESv1_CM.so
/system/lib/libGLESv2.so
/system/lib/libMali.ko,if any
=> After replacing files exit Aroma FM and reboot the system. Booting will take a while (~10m) so please be patient.
Bug Fixing Guide
Camera Fix
Open lib files one by one on stock rom lollipop & search for "_ZN7android5Fence4waitEj"(without quotes) with notepad++ (mainly look into the files related to camera.sc8830.so, to know open it with HeX editor and see what are the necessary lib***.so files)
In my case "_ZN7android5Fence4waitEj" are available on stock libui.so where that file needed by camera.sc8830.so
SO open camera.sc8830.so with HexEditor and search for libui.so
Then rename libui.so of stock rom file to libcm.so and save it
Copy and paste modified file to the exact directory and wipe data, cache, dalvik-cache (data is nedded because if the camera HAL fails to load at first time CM ROMs won't show camera app in that case it is must to wipe data)
Then reboot & make sure camera.sc8830.so loaded correctly with logcat
Fix for possible bootloops when porting Marshmallow ROM using lollipop kernel
Soon.....
Note:-I'm sure the marshmallow ROM(s) will boot on lollipop device also (because I personally tested with my phone but I need confirmation that this works on marshmallow devices also.
Lollipop ROM porting guide
Porting boot.img
=> Copy stock boot.img to working directory of AIK
=> Unpack boot.img and rename ramdisk to ramdisk.s and split_img to spli_img.s
=> Copy custom ROM boot.img to working directory of AIK
=> Unpack boot.img
=> Replace the following:
/ramdisk/lib/modules with /ramdisk.s/lib/modules
/ramdisk/lib/modules/mali.ko with /system/lib/modules/mali.ko from stockrom
delete split_img and rename split_img.s to split_img
repack it and rename image-new.img to boot.img and replace Custom ROM boot.img with ported boot.img.
Porting system
=> Boot to recovery and wipe system, data, cache and dalvik-cache and flash the CM12/lollipop ROM
=> Go back to tab menu of TWRP tap on 'Mount tab' Mount system and go back to flash tab and flash aroma file manager zip
=> Now you are on AromaFM. Copy and replace the following files with stock ROM files:
/system/lib/egl/libGLES_mali.so
/system/lib/hw/<all files> except files audio.primary.sc8830.so & bluetooth.default.so
/system/lib/modules<all files>
/system/vendor/lib/libbt-vendor.so with stockrom /system/lib/libbt-vendor.so.
=> After replacing files exit Aroma FM and reboot the system. Booting will take a while (~10m) so please be patient.
Typing Bug Fixing Guide
KitKat ROM porting guide
Porting boot.img
=> Copy stock boot.img to working directory of AIK
=> Unpack boot.img and rename ramdisk to ramdisk.s and split_img to spli_img.s
=> Copy custom ROM boot.img to working directory of AIK
=> Unpack boot.img
=> Replace the following
/ramdisk/sbin files with /ramdisk.s/sbin files
/ramdisk/init.sc8830.usb.rc with /ramdisk.s/init.sc8830.usb.rc
/ramdisk/init.usb.rc with /ramdisk.s/init.usb.rc
=> Delete split_img and rename split_img.s to split_img
repack it and rename image-new.img to boot.img and replace Custom ROM boot.img with ported boot.img.
Porting system
=>Replace the following:
/system/lib/egl/<all files>
/system/lib/hw (following files) :
camera.sc8830.so
camera2.sc8830.so
gralloc.default.so
gralloc.sc8830.so
hwcomposer.sc8830.so
keystore.default.so
lights.sc8830.so
local_time.default.so
power.default.so
sensors.sc8830.so
sprd_gsp.sc8830.so
/system/lib/modules<all files>
/system/vendor/lib/libbt-vendor.so with stock ROM /system/lib/libbt-vendor.so
Booting will take a while (~10m) so please be patient)
NOTE: If you stuck at Splash Logo (Manufacturer's logo) then delete CM11/system/lib/egl/libGLES_mali.so from recovery and then wipe data, cache, dalvik-cache and reboot.
Bug Fixing Guide
Camera Fix
Copy files camera.sc8830.so, camera2.sc8830.so & libandroidfw.so from stock ROM
Rename libandroidfw.so to libandroidcm.so
=> Download and install Hex Editor (Users who are using Android for porting can use Hex editor from playstore)
Open camera.sc8830.so with Hex Editor and search for libandroidfw.so & rename it to libandroidcm.so
Save camera.sc8830.so file, copy and paste it to CM/CM based ROM
Do the same for camera2.sc8830.so
This will fix the error "Cannot load Camera HAL" which is caused by camera.sc8830.so mising start_SprdPrefTracking & stop_SprdPrefTracking argument which is available only on original libandroidfw.so on your stockrom.
Reboot your device
If you haven't seen camera app then you may need to wipe the data and dalvik-cache but there is an alternative for this. The alternative is using third party camera app from play store if the camera works then you are good to go
but to have CM stock camera you must need to wipe data
WiFi/Hotspot fix
Part - I
Make sure your stock ROM WiFi (WLAN) driver name is sprdwl.ko on /system/lib/modules
Copy the following folder(s) from stok rom & paste to cm-11.0 rom
--/system/etc/wifi/<all files>
/system/etc/dhcpcd/<all files>
--/system/etc/connectivity_calibration.ini (related to WiFi connectivity)
--/system/etc/connectivity_configure.ini (related to Bluetooth connectivity)
I suggest you to replace files from Aroma FM (since we don't need to set permissions, etc which will automatically done by Aroma FM)
If you are replacing files from root explorer you need to properly set the permissions and Ownership/Group of particular for otherwise there will be no point in replacing the files and this will result in either unfixed bug or bootloop for this properly note down the permissions and Ownership/Group of individual files
for ex: /system/etc/dhcpcd/dhcpcd-run-hooks has permissions "-r-xr-x--- or 0550" and Owner is "dhcp" and Group is "shell"
Part - II
Unpack cm-11.0/based ported boot.img and replace "init.wifi.rc" file with this init.wifi.rc
Flash the modified boot.img using Flashify/ from recovery using flash image option (recommended)
To test whether the WiFi driver properly loaded or not
use terminal emulator type
Code:
su
<enter>
cat /proc/modules
<enter>
see whether the sprdwl.ko present on loaded modules list.
Try to use WiFi and immediately see the logs (use logcat Extreme app from play store) set if there are any errors
Do the same with Hotspot
as a result you may need to replace some files under --/system/bin/
ex:
--/system/bin/dhcpcd
--/system/bin/hostopad
--/system/bin/wcnd
--/system/bin/wpa_cli
--/system/bin/wpa_supplicant
etc
To root flash Magisk (systemless-root only for lollipop and above) or SuperSU
Credits: Hadi Khoirudin, Advan S4p [Official] fb group, @@ki,
@Jitheshwar (it's me :silly: )​
Created 2/10/2017
Last Updated 3/10/2017
Downloads:-
Marshmallow
CyanogenMd 13.1
Bug fix Update (extract zip and replace files and port boot.img and then zip it, boot to recovery wipe cache and dalvik-cache flash the zip and reboot)
=====================
Resurrection Remix 5.7.4
Offline Charging fix
PAC-MAN ROM
Lollipop ROMs
CyanogenMod 12.1
=====================
Resurrection Remix
WiFi-Hotspot-fix-for-CM/based-lollipop-ROMs
KitKat ROMs
PAC-MAN ROM
=====================
MIUI7-7.4.26
Video codec fix
WiFi-Hotspot-fix-for-CM/based-KitKat-ROMs
More links have been adding​
Reserved
You could have given me the credits.......well nice thread.....just a updated version of my thread
@ki said:
You could have given me the credits.......well nice thread.....just a updated version of my thread
Click to expand...
Click to collapse
But I took nothing from your work. I made this thread keeping CM ROMs in mind. But I have given credits to you in recovery porting thread since I used some of your work. Anyway you have given me Idea. PM me with more suggestions.
Edit: credits updated.
Jitheshwar said:
But I took nothing from your work. I made this thread keeping CM ROMs in mind. But I have given credits to you in recovery porting thread since I used some of your work. Anyway you have given me Idea. PM me with more suggestions.
Edit: credits updated.
Click to expand...
Click to collapse
Sorry for being so rude.......well i will try to suggest if anything good comes to my mind
Will the camera fix work with evercrossmod rom
[email protected] said:
Will the camera fix work with evercrossmod rom
Click to expand...
Click to collapse
No. That fix is for CM/CM based roms only. For stock based ROMs you just need replace camera libs.
Jitheshwar said:
No. That fix is for CM/CM based roms only. For stock based ROMs you just need replace camera libs.
Click to expand...
Click to collapse
This did not worked...the camera icon is showing but it says app not installed.I replaced the previous hw files (camera.sc8830.so and the camera2.sc8830.so). Now the app is opening but can't connect to camera.
[email protected] said:
This did not worked...the camera icon is showing but it says app not installed.I replaced the previous hw files (camera.sc8830.so and the camera2.sc8830.so). Now the app is opening but can't connect to camera.
Click to expand...
Click to collapse
You have to replace files having name "libcamera****.so" too.
How to unpack and repack system.ext4.win ?
[email protected] said:
How to unpack and repack system.ext4.win ?
Click to expand...
Click to collapse
just rename the file to system.ext4.win.tar.gz
and open it like a norma zip file
[email protected] said:
How to unpack and repack system.ext4.win ?
Click to expand...
Click to collapse
rename extension with .tar and extract it as usual but while repacking make sure you're using .tar compression type only. But I recommend using Aroma FM since extracting and compressing system.ext4.win may result in incorrect file permissions, as it is compressed by recovery.
@ki said:
just rename the file to system.ext4.win.tar.gz
and open it like a norma zip file
Click to expand...
Click to collapse
no need of .tar.gz, .tar is sufficient. As it is backuped in recovery by disabling "Enable Compression option" means we'll see the system files after extracting the system.ext4.win and not the system.ext4.win (compressed system image).
Jitheshwar said:
no need of .tar.gz, .tar is sufficient. As it is backuped in recovery by disabling "Enable Compression option" means we'll see the system files after extracting the system.ext4.win and not the system.ext4.win (compressed system image).
Click to expand...
Click to collapse
Now which software extracts .tar file. Plz tell me a software for windows
Jitheshwar said:
no need of .tar.gz, .tar is sufficient. As it is backuped in recovery by disabling "Enable Compression option" means we'll see the system files after extracting the system.ext4.win and not the system.ext4.win (compressed system image).
Click to expand...
Click to collapse
Yup....i forgot to mention that......just thought why anyone wants to backup without compression......
[email protected] said:
Now which software extracts .tar file. Plz tell me a software for windows
Click to expand...
Click to collapse
A zip archiver like 7zip, Winzip, etc. Mist if these software will be available for free. If you are using mobile to port I recommend ZArchiver.
After i'm port cm12 rom to sc7731 my device, is say Android is starting.... After that is restart and do that again, what i'm do wrong?
RustyDiamond said:
After i'm port cm12 rom to sc7731 my device, is say Android is starting.... After that is restart and do that again, what i'm do wrong?
Click to expand...
Click to collapse
your kernel....
RustyDiamond said:
After i'm port cm12 rom to sc7731 my device, is say Android is starting.... After that is restart and do that again, what i'm do wrong?
Click to expand...
Click to collapse
You may not replaced necessary lib(s).
Wipe everything before flashing the ROM (it is suggested to wipe internal storage also).
Don't replace everything (like camera libs) because they might give issues that you are facing, first key the device boot then fix bugs. If possible take logs using adb.

[GUIDE] How to flash payload.bin as fastboot images

I just finished an update to my flashing script, now it will work with payload.bin and unpacked payload files.
Currently, only gsi_sdm660_64 models are available for this option.
And Windows only, too.
PLEASE ENSURE YOUR PHONE HAS UNLOCKED BOOTLOADER, OTHERWISE THIS GUIDE IS USELESS.
Let me introduce you how to use the new script:
DL: https://github.com/HikariCalyx/OSTRemote/releases
source: https://github.com/HikariCalyx/OSTR...Script/generic_flash_script_gsi_sdm660_64.bat
If you use unpacked nb0 extension stock firmware as before, please follow this guide:
https://forum.xda-developers.com/nokia-7-plus/how-to/guide-workaround-flashing-sparse-t3906070
Click to expand...
Click to collapse
1. You must have Python 3 installed. It can be downloaded from https://www.python.org/downloads/
2. Extract the payload.bin from full OTA package (e.g. March 2019 update known as B2N-351F-0-00WW-B04)
3. Put the script file (and required files if you prefer original script source) and the payload.bin altogether
4. Download payload_dumper.py and update_metadata_pb2.py from the URL given by the script, and place them to the same directory of the script.
5. Type lowercase "yes" (without quotes) and press Enter, wait for the procedure complete.
6. The script will dump the payload.bin and process both system and vendor image to flashable sparse image.
7. After that, you should know what to do next.
If you already have dumped payload and converted system.img / vendor.img, the script will tell you if you want to flash the unpacked OTA packages, you can simply type "yes" and proceed.
You needn't to waste the time of processing payload.bin again, once you don't delete them.
I'm considering port this script to universal for almost every A/B Android devices, if it works great.
Nice job dude, this will be very useful to many people.
Very well Hikari, nice script
Very very much appreciated work!
Can't wait to try it out!
Thanks !
Mod edit - Translated by Google Translate:
Very supportive! !! !!
*********************
非常支持!!!
does this work for other Nokia models? Such as 3.2?

Categories

Resources