[GUIDE] How to extract system files from stock firmware

Search This thread

Al936

Senior Member
Mar 10, 2007
269
246
First of all: Tool to be used in this guide was developed by user And_pda from Russian 4pda.ru forum. So all credits must go to And_pda
The original thread (in Russian) is here. Actually the original thread is about several tools to works with different images for different phones. But we will talk only about Moto X.

The guide will describe how to extract all files from system partition from stock firmware. The tools works under Windows (I personally tested it on Win 7).

If you unzip any stock firmware you will find one file, which represents system partition: system.img.

To extract all files from system.img please do:
1. Download ImgExtractor_1_3_4.rar and extract it.
2. Create directory System in the folder where system.img is located;
3. Copy ImgExtractor.exe into the folder where system.img is located;
4. Run CMD and "cd" to the folder where system.img is located
5. In CMD run the following: ImgExtractor system.img System
After ImgExtractor finished you will have all system files and folders in System directory.

That's all :)

PS. ImgExtractor also can extract modem firmware (NON-HLOS.bin)
 

Attachments

  • ImgExtractor_1_3_4.rar
    75.6 KB · Views: 29,356

carbonat87

Senior Member
Aug 22, 2014
64
22
Dnipropetrovsk
Can you get this to work with motoboot.img? It'll make it possible to downgrade to bootloaders such as 4-21, 3-15, etc.

Phone's cid partition changes with every firmware update so bootloader downgrade will not work. The phone just won't boot up. I know the man who tried all this tricks - he flashed dumps from phones with unlocked bootloaders.
 

djcristi

Senior Member
Aug 27, 2007
77
33
Bucharest
it would be great if the author patched/forked the original ext4 unpacker, so it can open newer img's like this (sparse with moded header) , so we would've had a GUI, because imgextractor is only text.
 

djcristi

Senior Member
Aug 27, 2007
77
33
Bucharest
yes, even with Samsung Galaxy Note 4 / S6 and newer devices, on the IMG file - the ext4 sparse header is not standard, but i said, since this program (imgextractor) is based on ext4 unpacker sources, it could've keeped that GUI and only mod a little.

Anyway, you could also open IMG with the original ext4 unpacker if you fix it first with IMGEXTRACTOR. to fix: convert IMG file from MODED SPARSE EXT4 to normal EXT4 (> imgextractor.exe original.img temp.ext4 -conv) and then back to FIXED SPARSE EXT4 (> imgextractor.exe temp.ext4 fixed.img -conv). Now open fixed.img in ext4 unpacker program and it will work.

l.e. I found what the problem was, on Samsung Exynos devices, and the newer ones, the IMG files headers are 32 bytes, instead of the normal 28, Chainfire explains it here. So that's why ext4 unpacker gives error on opening. For alternative fix (instead of the conversion i explain upper in this post using imgextractor) you can use Chainfire's sgs4ext4fs tool , works on Windows/Linux, builds and other useful tool here.

Also there is a tool for Motorola IMG files there, see the Usage section.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 31
    First of all: Tool to be used in this guide was developed by user And_pda from Russian 4pda.ru forum. So all credits must go to And_pda
    The original thread (in Russian) is here. Actually the original thread is about several tools to works with different images for different phones. But we will talk only about Moto X.

    The guide will describe how to extract all files from system partition from stock firmware. The tools works under Windows (I personally tested it on Win 7).

    If you unzip any stock firmware you will find one file, which represents system partition: system.img.

    To extract all files from system.img please do:
    1. Download ImgExtractor_1_3_4.rar and extract it.
    2. Create directory System in the folder where system.img is located;
    3. Copy ImgExtractor.exe into the folder where system.img is located;
    4. Run CMD and "cd" to the folder where system.img is located
    5. In CMD run the following: ImgExtractor system.img System
    After ImgExtractor finished you will have all system files and folders in System directory.

    That's all :)

    PS. ImgExtractor also can extract modem firmware (NON-HLOS.bin)
    9
    Latest version if any need it
    2
    yes, even with Samsung Galaxy Note 4 / S6 and newer devices, on the IMG file - the ext4 sparse header is not standard, but i said, since this program (imgextractor) is based on ext4 unpacker sources, it could've keeped that GUI and only mod a little.

    Anyway, you could also open IMG with the original ext4 unpacker if you fix it first with IMGEXTRACTOR. to fix: convert IMG file from MODED SPARSE EXT4 to normal EXT4 (> imgextractor.exe original.img temp.ext4 -conv) and then back to FIXED SPARSE EXT4 (> imgextractor.exe temp.ext4 fixed.img -conv). Now open fixed.img in ext4 unpacker program and it will work.

    l.e. I found what the problem was, on Samsung Exynos devices, and the newer ones, the IMG files headers are 32 bytes, instead of the normal 28, Chainfire explains it here. So that's why ext4 unpacker gives error on opening. For alternative fix (instead of the conversion i explain upper in this post using imgextractor) you can use Chainfire's sgs4ext4fs tool , works on Windows/Linux, builds and other useful tool here.

    Also there is a tool for Motorola IMG files there, see the Usage section.
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone