yashsingh1/xdaforums huggingface dataset:
[Android Q&A, Help & Troubleshooting] DahakePL:
Thanks! I will know what to do now, I have kitchen and cygwin already installed so no problem :fingers-crossed:
[Android Q&A, Help & Troubleshooting] kingdevil731:
quick question !

hey

got a quick question what is the use of Admin Access in this Script? because i'm pretty sure it works without them!

and Why use ping into localhost / local ip ?

:admin_
>>nul 2>>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM -->> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto PERM
) else ( goto start )
:PERM
echo Set UAC = CreateObject^("Shell.Application"^) >> "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B

:ex_t
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo Thanks for using
ping -n 2 -w 200 127.0.0.1 > nul

:start
::If you are copying these then you should be ashamed
::of your self asshole Instead use your brain to created
::something else. -Thanks
SET count=1
FOR %%G IN (.,..,...,....,.....) DO (
ping -n 2 -w 200 127.0.0.1 > nul
echo %count%
cls
echo.
echo.
echo.
echo Welcome To matrix's System Extract and Repack
echo.
echo loading %%G
set /a count+=1 )
goto home
[Android Q&A, Help & Troubleshooting] matrixex:
So you predicts future of samsung phones(one of your posts)

Anyway

I have used admin rights for some action like deleting a folder which is for sometime not allowed as user.(displays a message "permission is Denied")

Ping is used here for delay purpose.

Remove ping and you will get your answer.

Here how it works

ping -n 2 -w 200 127.0.0.1 > nul

Ping -to check the destination IP address you want to reach.

-w--Enables you to adjust the time-out (in milliseconds).

Got it right.
[Android Q&A, Help & Troubleshooting] kingdevil731:
lol... i don't predict nothing :p

i was only commenting on a thread made by another user :cool:

okh... i know about the ping related stuff

just was curious why using admin xD

by the way your Tool Is dope :good::highfive:
[Android Q&A, Help & Troubleshooting] matrixex:
Hey i finally found a solution for Repack of cm based ROM

Just wait one or two days

Edit

Soory but it will take more than a week

Because it contains a lot of tools and code

Sounds like i am making kitchen right

But not, it will take a year to make kitchen
[Android Q&A, Help & Troubleshooting] superceege:
edit nevermind was using the wrong method...
[Android Q&A, Help & Troubleshooting] ilichva:
System_Extractor_4.0 CM13. On repack - Bootloop Calculation Size Please Wait....
[Android Q&A, Help & Troubleshooting] DahakePL:
So, how is it?

Is it working? :silly:
[Android Q&A, Help & Troubleshooting] matrixex:
what a timming bro just uploading it
[Android Q&A, Help & Troubleshooting] DahakePL:
Really!? :D

That's great :laugh: :highfive:
[Android Q&A, Help & Troubleshooting] matrixex:
check it out and for repack

read "repack_info.txt"

thoug it is not to tough to understand
[Android Q&A, Help & Troubleshooting] DahakePL:
Thanks!
[Android Q&A, Help & Troubleshooting] matrixex:
Does it worked or not

Well if not then i will provide my ROM META-INF folder
[Android Q&A, Help & Troubleshooting] DahakePL:
I will test when I have time
[Android Q&A, Help & Troubleshooting] ilichva:
Thank you for your hard work, patience, perseverance!

But CM13 repak does not work...
[Android Q&A, Help & Troubleshooting] matrixex:
Please upload a image and please use file_contexts of your ROM only

Also please use version 4.0 upload tomorrow
[Android Q&A, Help & Troubleshooting] celoxocis:
will the repacked system.img be flashable via fastboot?
[Android Q&A, Help & Troubleshooting] matrixex:
Don't know but give it a try

Or you will never learn something new
[Android Q&A, Help & Troubleshooting] Phrodini:
Thanks for the program. It works as it should.
[Android Q&A, Help & Troubleshooting] psycholyzern:
Unfortunately that script gave me error:

me@serv:/home/me/Desktop/cm$ sudo mount -t ext4 -o loop,ro,noexec,noload sys.raw.img sys
[sudo] password for me:
mount: wrong fs type, bad option, bad superblock on /dev/loop2,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
[Android Q&A, Help & Troubleshooting] matrixex:
Sorry i don't know much about linux

Try this

http://xdaforums.com/showthread.php?t=1588461

sudo mount -t ext4 -o loop,ro,noexec,noload sys.raw.img sys

Just rename your file system.ext4 to sys.raw.img
[Android Q&A, Help & Troubleshooting] Astrubale:
Error in repacking for S6 AOSP (cm 13) based rom
[Android Q&A, Help & Troubleshooting] matrixex:
Explain,post screen, also read carefully the new repack menu of 1st post
[Android Q&A, Help & Troubleshooting] popo72:
Really thank you for this great tool.....

One aspect is not clear to me: when repacking system to system.img, how to set back the correct permissions and symlink? I tried with file context but didn't work!

Thansk in advance
[Android Q&A, Help & Troubleshooting] matrixex:
Did you tried to flash it using fastboot

If not worked then here how to do it

A system.img is sparsed ext4 loop file

So you need to create a sparsed file with proper symlink and permissions set

Here how to do it

Download make_ext4fs binary

And download its libs eg: cygcc...,etc you will find in this link named end with ". Dll"

https://github.com/matriex/System_Extractor/tree/master/bin

Place all in a same folder

copy your system folder to current location and also copy file_contexts which has been modified as needed

Open cmd on current folder(inside which you placed make_ext4fs binary) by holding right shift+RMS (MOUSE BUTTON)

And choosing option "open a command Window here"

Type this

"make_ext4fs -T 0 -S file_contexts -l size -a system system.img system"

where size is the current size of your system folder in bytes+

100000000 bytes (100 mb extra)

HINT

(select properties of system folder for size and add 100000000 Bytes by your self manually, do the math)

also system is the name of you system folder

Replace size with your calculated value, if you find any coma b/w digits then remove it

And hit enter

(Like type 500000000)

After doing this you will see that conversion starts after that you will get a system.img file having proper permissions as stated in file_contexts

Now you will get a file(system.img) which is a ext4 file

Again you have to convert it to sparse image file for flashing the conversion is simple just download "img2simg" binary

Then copy your system.img and img2simg file in same folder and again open command Window by selecting folder (where you placed system.img and img2simg) + RMS

And choosing option "open a command Window here"

Type

"img2simg system.img system_sparse.img"

Then flash system_sparse.img

And reply it worked or not
[Android Q&A, Help & Troubleshooting] popo72:
First of all rellay thanks for your useful reply!

Actually I didn't try to flash it since, based on my knoweldge, system has permission and symlink embedded and if not correctly set it will not work I guess.

I will then try the process you wrote, but just one question: should I install cgwin?
[Android Q&A, Help & Troubleshooting] Code1X:
malware issue

Any idea why is it being detected as malware by these Anti virus's (not saying it has malware) ?

Antivirus	Result	Update

Ikarus	Trojan.Python.Agent	20160530

Jiangmin	Trojan.Generic.oktq	20160530

NANO-Antivirus	Trojan.Win32.Agent.dzsyem	20160530

Rising	Malware.RDM.39!5.2D	20160530

Zillya	Adware.ICLoader.Win32.2661	20160528
[Android Q&A, Help & Troubleshooting] matrixex:
I honestly don't know but i think some of batch scripts which gains admin rights and executes commands/scripts are detected harmful by some of antivirus

That's i think or u could use extractor by disabling your antivirus for some time

Belive me i haven't made a script that can steal your INFO or destroy your computer

You are free to see my codes by opening it using any text editor!

Crap that's too much
[Android Q&A, Help & Troubleshooting] matrixex:
No continue on "cmd" of windows (quite powerful tool)

Also search the web for more information of "cmd"
[Android Q&A, Help & Troubleshooting] Code1X:
I believe you .. it just had made me curious .. I used it either ways yesterday .. Thanks for making it .. Excellent work !
[Android Q&A, Help & Troubleshooting] rinart73:
simg2img doesn't work properly.

Traceback (most recent call last):
File "sdat2img.py", line 97, in <module>
main(sys.argv)
File "sdat2img.py", line 86, in main
print('Copying {} blocks into position {}...'.format(block_count, begin))
ValueError: zero length field name in format
[Android Q&A, Help & Troubleshooting] matrixex:
I don't tkow python but i can tell the reason is in system.transfer.list may be due to no zero command found in system.transfer.list or zero commands have beeen replaced by any variables etc look system.transfer.list by another rom (Script is working as it should your rom transfer.list contains some unexpected contents)or

forget these i recommended you to uninstall the python and the script that i provided(extractor) will automatically transfer to compiled "sdat2img.exe" binary due to non availability of python environment.
[Android Q&A, Help & Troubleshooting] rinart73:
So it's ok? ('Skipping zero command.')

Skipping zero command.
Copying 32767 blocks into position 0...
Copying 2 blocks into position 32768...
Copying 2 blocks into position 32889...
...

I've got an error on repacking system folder to system.new.dat. As I understand if I'll just use system folder with an updater script OTA won't work?
[Android Q&A, Help & Troubleshooting] matrixex:
No it will work if system.new.dat didn't worked for you then no problem

You can still use system folder and for flashing and don't forget to set permission on updateR-script otherwise I'll not work.

You may wonder during flashing of sparse system.new.dat, there is no symlink, permission set in updater-script

But there is that is file_contents is used to set permission

I'm also using this method because system.new.dat always not works for me.
[Android Q&A, Help & Troubleshooting] rinart73:
This is bad, where do I get a updater-script that compatible with my ROM?! As I understand it's a unque thing (or almost) since I'm changing Resurrection ROM, not AOSP.

Sorry but I didn't understand nothing of this. Maybe because of my English knowledge. Can you explain this in a bit simplier way?
[Android Q&A, Help & Troubleshooting] matrixex:
THERE IS NOTHING RELATED TO ENGLISH VOCABULARY

Sorry i thought you were famalier with updater-scripts

Anyway you will be able to understand these after you understand updater-scripts

Or also called as edify programming

Also you have to create your own updater-scripts

Here is how to do it

http://xdaforums.com/showthread.php?t=1931585
[Android Q&A, Help & Troubleshooting] rinart73:
There is must be some way to pack to .dat files normally! Many teams like Resurrection, Teamsuperluminal do this.

And updater-script is something where you can easily get a mistake. Thanks for you link, but I don't think that it's something that I can do.
[Android Q&A, Help & Troubleshooting] rinart73:
Update :)

Ok, I think I made it work. It repacks system.new.dat now.

One strange thing that I've got is that new size is slighlty smaller than the original one (917MB vs 957MB). But I've compared original extracted .dat and new one. They're identical.

So.. give a try :)

One thing that I doesn't like in repack process is that it gets to right size of the system.img too slowly. I mean, there is a many steps from 500MB to ~1034MB(in my case). I think someone should to implement a way to get system directory size and set it to the default size of the system.img.

UPD: Updated Extractor once again. Now starting size of the ext4 image is based on the size of the system folder, so it'll take less steps to get to the right ext4 image size.
[Android Q&A, Help & Troubleshooting] matrixex:
Hi

Actually Resurrection Team builds from source or scratch, there is no system folder

They programme sripts to repack/combine all files to system.new.dat in a machine/host

Of you make a ROM from scratch then you will understand it.
[Android Q&A, Help & Troubleshooting] matrixex:
Actually I wanted but if we put actual size of system then make_ext4fs binary doesn't works

"Error :FAILED TO ALLOCATE 36 BLOCKS, OUT OF MEMORY"

This is the result when you try to put original size instead I put a loop to slightly increase size

And also I have manage to make another option of input size

That is you have to input size manually only in system image repack
[Android Q&A, Help & Troubleshooting] rinart73:
I think I fixed that. Firstly we take system folder size and than add +1MB to it in a cycle (as it was in the script earlier).

There is just was a problem that on some point system.img file exists but his size = 0MB, cause it's still not enough space. I made another check at this point and now it works fine.
[Android Q&A, Help & Troubleshooting] Yannn:
I get error message : empty file !

files are found but it says they are empty ! ??????

I'm on windows 8.1 64bits - is there a link ?!
[Android Q&A, Help & Troubleshooting] Astrubale:
It stop at Bluetooth when it is opening the S7 system.img
[Android Q&A, Help & Troubleshooting] matrixex:
Don't know how to solve it ,use this method

http://xdaforums.com/showthread.php?t=2285831
[Android Q&A, Help & Troubleshooting] matrixex:
I think files are broken or corrupted.

Please check with other ROMS I'm sure it will work.
[Android Q&A, Help & Troubleshooting] irfanjunaid:
[MENTION=7110463]matrixex[/MENTION] : Many thanks brother. Finally extracted samsung firmware!!! Thank you so much :angel: ;) :victory: :highfive:
[Android Q&A, Help & Troubleshooting] Dumaxa:
repack dont work for me... Win7x64 pyth 3.5.1 _ trying to pack stock 64bit 5.0.2 ROM (qualcomm 8916)
[Android Q&A, Help & Troubleshooting] phonglhie:
same here, not working in unpacking S7 system.img, got error.
[Android Q&A, Help & Troubleshooting] matrixex:
///////////////////////

FOR THEM THE REPACK OPTION NOT WORKED JIST USE THIS METHOD

//////////////////////

If it doesn't then directly flash by system folder

I think its the best way to flash anything.

And repack is only fully completable when build from source.
[Android Q&A, Help & Troubleshooting] matrixex:
Are you still on XP

That's the main reason for not working because some binaries/scripts that were made around 2015-16 doesn't works with xp's

And I should suggest u to use this link

http://xdaforums.com/showthread.php?t=2285831
[Android Q&A, Help & Troubleshooting] phonglhie:
Same error using windows 8.1
[Android Q&A, Help & Troubleshooting] matrixex:
Then this is not problem of OS , well I really don't known the cause, you should follow the link that I given you above that is a very useful method why don't you give it a try
[Android Q&A, Help & Troubleshooting] quanqw:
My firmware don't have file_context.
[Android Q&A, Help & Troubleshooting] SuperSaket:
Device stucks at Cyanogemod Logo

I followed every step.

Everything done perfectly

Signed the zip.

But device stucks at CM logo.

I used the Extractor Update provided here by [MENTION=5522680]rinart73[/MENTION] #80

Using Moto G3 Developing CM 13
[Android Q&A, Help & Troubleshooting] SuperSaket:
How did you make your rom work only using system folder ?
[Android Q&A, Help & Troubleshooting] DahakePL:
I didn't I left it, didn't have time to do anything
[Android Q&A, Help & Troubleshooting] KaMyKaSii:
After extracting system.new.dat to /system and then put to repack for system.img , old system folder is deleted and created a new empty. The way around this is to rename /system for anything and accept to repack system.img, delete the new /system and rename the old to /system again. Please fix it.
[Android Q&A, Help & Troubleshooting] Guizão BR:
Have any linux version?
[Android Q&A, Help & Troubleshooting] Floating Point:
I'm just testing this tool. I had to make some changes to the script.

Changed line 117 to:

py --version 2>NUL

So Python can actually be recognized by the script.

Changed lines 410-413 to:

if exist system (
goto cmatrix
::echo.
::bin\cecho {0a}Cleaning system folder before began....{#}

So system folder is not deleted after unpacking the images.

make_ext2fs also fails with the exit message error: init_bg: failed to reserve 88349 blocks in block group 0 (had to comment out all the CLS lines so I see the output), the command line is broken, you don't need to put the "M" after the partition size, e.g:

bin\make_ext4fs.exe -s -l 1422282752 system.img system

But this render the image useless since it won't keep file permissions and ownership.

And many other stuff is broken and need rework :eek:
[Android Q&A, Help & Troubleshooting] matrixex:
That was my plan to delete old files since it becomes over crowded and I get confused so I decided/implemented scripts to delete it after extraction
[Android Q&A, Help & Troubleshooting] matrixex:
I am glad you helped anyway create pull request on git and I will mearge it

I may not able to relpy from on now so do whatever you want to on script to make it work better, whenever I have time I will merge it and upload.

"

bin\make_ext4fs.exe -s -l 1422282752 system.img system

But this render the image useless since it won't keep file permissions and ownership."

Add the file_contexts to the image repacking it will keep the permissions and ownership.
[Android Q&A, Help & Troubleshooting] matrixex:
Use simple method

Do flash by system folder

Works with any android xx
[Android Q&A, Help & Troubleshooting] KaMyKaSii:
But that does not make sense if the plan is to make a repack later, for example .new.dat to img. And please tell me one thing, my partition /system has 1.8GB, but only 1.4GB in use, if I do repack with auto size option and he does with 1.4GB, I will be able to install the image by TWRP and yet the partition system will stay with 1.8GB? And I've tried to do this repack, but eventually gave that process failure, unfortunately I can't show now
[Android Q&A, Help & Troubleshooting] matrixex:
I don't get it what are trying to say

And are you flashing "system.new.DAT" or "system.IMG" from TWRP

Umm if you are repacking system->system.new.DAT then don't do it. Instead use "system" folder directly.

OR

If you are repacking system->system.IMG for flashing through adb(only possible method) then It may or may not work.

And let me clear you one thing

If you are using extractor then the files that you copy to the extractor say "system.new.DAT" "file_contexts" and "system.transfer.list" will be deleted after extraction!

And you can't use TWRP TO flash a .IMG file only adb-shell is possible method to flash IMAGE files also flashing any file will not change the size of your system partition

Say if it is 1.8 GB then after flashing it will not become 2TB OR 1024KB it will stay at it's original size and if you do flashing above limit say 2GB->system then it will cause a serious damage to your partitions!
[Android Q&A, Help & Troubleshooting] KaMyKaSii:
It seems that there was a communication error. The manufacturer of my device put to download a full ota block level, so I extracted the files system.new.dat, system.transfer.list, file_contexts of zip and extract with your tool. During system.new.dat extraction to /system is make system.img with 1.8GB, which I took because it is easier to work with .img than using the stock recovery to restore rom stock and such. But as I said this image are only in use 1.4GB, so if I do repack of /system for system.img with auto size option enabled the final image will stay with 1.4GB? The difference may seem little but I want this decrease in size. Unfortunately when I tried to do this was a error, I believe that what you described above. I can install imgs with SP FlashTool (for MTK devices), with fastboot or with TWRP 3.0 (it was implemented the function to install system image)

On physical size of the partition to change, of course I know it does not exist. Is that'm just afraid image comes with a size smaller than the partition itself, you know? As make a 400GB partition on a PC and let 100GB as unallocated space. I do not want it
[Android Q&A, Help & Troubleshooting] matrixex:
I don't think the remaining space will be unallocated though I am not sure but I can at least say if you are flashing system.IMG and the space that will be left are not unallocated.

"I don't know much about partitions or experimented on them so please ask developers they might know"
[Android Q&A, Help & Troubleshooting] karan2012:
While extracting the system.img of stock Note 5 mm rom I am getting stuck at all share app and then the program freezes please help
[Android Q&A, Help & Troubleshooting] Astrubale:
[MENTION=7110463]matrixex[/MENTION] Any news about error in extracting Samsung Galaxy S7 Edge firmware?
[Android Q&A, Help & Troubleshooting] matrixex:
I thought the problem was solved

Anyway please give the direct link of samsung s7 firmware I will look into it when i have time.
[Android Q&A, Help & Troubleshooting] matrixex:
Try this

And reply

http://xdaforums.com/showthread.php?t=2285831
[Android Q&A, Help & Troubleshooting] matrixex:
Thanks

Please can you make the changes at GIT i will mearge it
[Android Q&A, Help & Troubleshooting] karan2012:
No this is also not working its giving unknown format error
[Android Q&A, Help & Troubleshooting] devilmaycry2020:
Hi all

Why i can't see system.new.dat in MM 6.0.1 on xperia z5 ftf ?
[Android Q&A, Help & Troubleshooting] KaMyKaSii:
There is a big difference between firmware package from a specific manufacturer and OTA package
[Android Q&A, Help & Troubleshooting] zround:
WAW amazing, :cool:
[Android Q&A, Help & Troubleshooting] nebulac:
Separated system.new.dat

[IMG="separated system.new.dat"]https://c1.staticflickr.com/9/8085/28501591685_d60949ab69_o.jpg[/IMG]

I found separated system.new.dat from vivo X7 firmware. (system.new.dat.1,2,3....15)

How to join or unpack them?:confused:

＊Firm Link : http://www.vivo.com.cn/dl/252
[Android Q&A, Help & Troubleshooting] Flounderist:
Hi, I get error 11 in TWRP 3.0.2.1 while flashing a ported cm13 ROM for UMI Super.

I used your unpacker/repacker and I get this error message while completing the repack: "rimg2sdat.exe has stopped working".

After that the program runs until I have the file and the md5 file for integrity, but,while installing, flashing stops while patching system with error code 11. Please could you help?

Here is the part of my TWRP log:

I:Zip contains SELinux file_contexts file in its root. Extracting to /file_contexts

I:Legacy property environment initialized.

Target: umi/cm_super/super:6.0.1/MRA58K/1466057390:userdebug/test-keys

Target: umi/cm_super/super:6.0.1/MRA58K/1466057390:userdebug/test-keysdetected filesystem ext4 for /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/systemdetected filesystem ext4 for /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system

about to run program [/tmp/install/bin/backuptool.sh] with 2 args

Not backing up files from incompatible version: 13.0

run_program: child exited with status 127

about to run program [/tmp/install/bin/otasigcheck.sh] with 1 args

Patching system image unconditionally...performing update

Patching system image unconditionally...

Il processo Updater è terminato con segnale: 11

I:Legacy property environment disabled.

Errore durante l'installazione dello Zip '/sdcard/Download/cm_13_cooked.zip'

The sha1 file gave me that:

//

// File Checksum Integrity Verifier version 2.05.

//

4ad46fb7675c11f85d79049cfc9017672a04c13b system.new.dat

Pls could you help me?

Thank you! :)
[Android Q&A, Help & Troubleshooting] JamFlux:
New tool

Try this enchanced tool

htcmania dot com / showthread.php?t=1213083