How To : Create System.IMG from System Folder - Repack System.IMG

30

itxtutor

Editor in Chief
Staff member
May 15, 2015
60,079
1
113
Hey guys,


I´ve seen that many people have problems because mtk droid tools created a system folder and not an image for the backup.


PLEASE ONLY DO THIS AFTER YOU TRIED :


1) Open mtk droid tools


2) Prepare blocks for flashtool in mtk droid tools


3) chose files.md5


4) Check if you have the image in "files to flashtool"


So today i got some time and wrote a tutorial on how to repack that folder to a system.img.


that only works for EXT4 FILESYSTEM based devices. For Yaffs i will do another tutorial.


What you need:


1) A linux pc or VM ware + Any linux distribution


2) simg2img and make_ext4fs binaries which can be downloaded from here :


http://web.djodjo.org/?a=download:android:tools:x86_linux:ext4tools


Now to start, log in on your Linux PC or start VM.


Now create a folder somewhere and copy in :


1) Simg2Img


2) Make_ext4


3) A random system.img or the system.img you want to mod! ( needrom or whatever,)


When you have done that, open a new terminal session.


Type

cd /"directory"  
to change to your directoy which contains the files.


Now we need to run those 3 commands :

1. mkdir sys                                              (creates a new folder sys in your directory)


2. ./simg2img system.img sys.raw              (unpacks system.img)


3. sudo mount -t ext4 -o loop sys.raw sys/   (mounts it)
It should look like this :








Then your system.img is mounted in sys. and you can mod it.  


Now just delete everything from that system.img and copy in the files from your backup folder. Also verify that everything is in there !





Now its time to repack to system.img !

1. sudo ./make_ext4fs -s -l 512M -a system new.img sys/


2. sudo umount sys


3. rm -fr sys
At the end it should look like this :





Now you can flash your new  "new.img" to your smartphone with sp-flashtools



I hope this solved your issues with the backup !


Cheers
 
Last edited by a moderator:
5

pepeuprog

Member
Jul 31, 2014
40
0
6
Yay! Thank you so much for your help! I managed to revive my wife's phone!
 



Is there some way to make the ".img" of nvram? (my backup didn't made it...) can i make it the same way?


Thank you so much again!
 
5

pepeuprog

Member
Jul 31, 2014
40
0
6
Hey Itxtutor!



I have some doubts...

  • have i just do this repack process by doing just: "sudo ./make_ext4fs -s -l 512M -a system new.img sys/" ?


  • will it be bugged as i told you in my topic? because my backup had only system folder and nvram folder and doesn't have the sys.raw file.


  • "sudo mount -t ext4 -o loop sys.raw sys/" was not needed to do?


  • And what about the " rm -fr sys "? what is this one for?


Thanks in advance. If you want to delete my question and answer in my note 3 post, don't mind to do it.
 
30

itxtutor

Editor in Chief
Staff member
May 15, 2015
60,079
1
113
I replied in the other thread.


pepe,


did you use a donor system.img or did you just put your system folder in the folder ?


2. ./simg2img system.img sys.raw (unpacks system.img)


extracts the SYSTEM.IMAGE !!! (not folder) to a sys.raw file !
 
5

pepeuprog

Member
Jul 31, 2014
40
0
6
Ok, Itxtutor. I just used the system folder in the folder. I got that it's for extract the " SYSTEM.IMAGE !!! " haha.


I'm talking about: "sudo mount -t ext4 -o loop sys.raw sys/ (mounts it)"


I can't mount it in because it isn't a sys.raw, it's just a folder.


I've read somewhere that my problem is because the "sys" folder is just in "read" mode and i need to change it to read-write before repack it into a .img file. Can you tell me how to do it?
 
1

RzSenseio

New Member
Oct 17, 2014
25
0
1
Admin why do i always get this error? (been changing multiple system.img from needrom cause i had no system.img of course)


 
1

RzSenseio

New Member
Oct 17, 2014
25
0
1
NVM fixed
 
30

mrsim

KingOfNoobs
Staff member
Mar 1, 2014
16,174
1
113
48
London UK
SWEET tutorial steven...will solve a lot of issues....:DD
 
1

gandolf007

New Member
Oct 24, 2014
6
0
1
hi dear friends


i have problem with unpack system.img file for nokia X


when i type /simg2img system.img sys.raw  ===> Terminal say Error :bash : ./simg2img  : No Such File Or Directory :screaming:


reason ?


what should i do ?i use vm virtual box
 
30

itxtutor

Editor in Chief
Staff member
May 15, 2015
60,079
1
113
you need to type


./simg2img system.img sys.raw


with the dot !!!!
 
1

gandolf007

New Member
Oct 24, 2014
6
0
1
i type ./simg2img system.img sys.raw


but Terminal say Error :bash : ./simg2img  : No Such File Or Directory


pls help me


 
1

gandolf007

New Member
Oct 24, 2014
6
0
1
anybody can help me ?
 
30

itxtutor

Editor in Chief
Staff member
May 15, 2015
60,079
1
113
type dir


can You See simg2img ?


If not you are in The wrong directory
 
1

milannikolov

New Member
Nov 19, 2014
1
0
1
19
Please help.


I get error message:



Code:
./simg2img: command not found
 
1

masoudsolo

New Member
Dec 18, 2014
1
0
1
30
bash permission denied what can i do with this ??????
 
1

chmielu

New Member
Aug 3, 2014
9
0
1
hi,


I have this problem


any ideas ?
 
Last edited by a moderator:
1

teemo

New Member
Feb 14, 2015
2
0
1
26
i have a problem


when i type ./simg2img system.img sys.raw it saied bash permission denied


any idea to solve this
 
30

itxtutor

Editor in Chief
Staff member
May 15, 2015
60,079
1
113
check file permission http://stackoverflow.com/questions/18960689/ubuntu-says-bash-program-permission-denied


and run as SU
 
1

teemo

New Member
Feb 14, 2015
2
0
1
26
thanks you for your answer my problem solved ... but i have another problem ... how to unpack and repack system.img for android 4.3 , 4.4.2 and 4.4.4 since simg2img can not unpack them and says : invalid parser header
 
2

Ashish Deepak

Member
Apr 3, 2015
34
0
8
Hi ITX,


Can you put up a video on how to make system.img from system folder in Ubuntu(VMware)
 
Help Users

You haven't joined any rooms.

    You haven't joined any rooms.