FORUMS
Remove All Ads from XDA

[tool] ANDROID_IMG_REPACK_TOOLS

1,206 posts
Thanks Meter: 2,488
 
By A.S._id, Recognized Developer on 6th January 2014, 10:54 PM
Post Reply Email Thread
[tool] ANDROID_IMG_REPACK_TOOLS
&
Android_ROM_IMG_Repacker



android_img_repack_tools is a kit utilites for unpack/repack android ext4 and boot images in LINUX & WINDOWS


includes binaries:
mkbootfs
simg2simg
make_ext4fs
make_ext4fs_def
mkbootimg
ext2simg
simg2img
img2simg
sgs4ext4fs - Chainfire's tool
unpackbootimg - CyanogenMod tool
mkbootimg_tools - xiaolu

Android_ROM_IMG_Repacker




sources used:
https://android.googlesource.com
https://github.com/CyanogenMod/android_system_core.git
https://github.com/Chainfire/sgs4ext4fs





how to make:

Preparation OS:

Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind libreadline6-dev gcc-multilib g++-multilib libc6-dev x11proto-core-dev libx11-dev libz-dev gawk texinfo automake libtool cvs libsdl-dev
Dowload repo:

Code:
git clone https://github.com/ASdev/android_img_repack_tools
Choose branch, for example:

Code:
cd android_img_repack_tools
git checkout android-4.4.4_r2.0.1
Building tools:

Code:
chmod +x configure
./configure
will download source from android git repositories

Code:
make
will compille binaries: mkbootfs simg2simg make_ext4fs mkbootimg sgs4ext4fs unpackbootimg ext2simg img2simg simg2img

Code:
make clean
will remove binaries

Code:
make clear

wiil remove sources

credits:
android.googlesource
Chainfire
CyanogenMod


go to the repository

Already have a branch:
android-2.3.7
android-4.0.4
android-4.1.1
android-4.1.2
android-4.2.2
android-4.3
android-4.4.2
android-4.4.3
android-4.4.4
android-5.0.0
android-5.0.2
android-5.1.0
android-5.1.1
android-6.0.0
android-6.0.1


Usage:


Code:
## Converting sparse flashing system.img from flashing android sparse img to ext4 img

$ simg2img system.img system.raw.img
## or all parts of sparse img
$ simg2img system.img* system.raw.img

## Mounting ext4 img for edit

$ mkdir system_mnt
$ mount -t ext4 -o loop system.raw.img system_mnt
Code:
## Creating new android sparse img for flashing (android 2.3.6-4.2)

$ mkuserimg.sh -s system_mnt system_new.img ext4 ./system [size partition MB for example 1024M]
## or
$ make_ext4fs -s -l 1024M system_new.img system_mnt

more

$ mkuserimg.sh -s system system.img ext4 /system [size partition MB for example 1024M] file_contexts
Code:
## Converting ext4 img to sparse img for flashing (android 4.3-etc)

$ ext2simg -v system.raw.img system_new.img
Code:
## Changing sparse img header size from 28bit to 32bit (for Samsung Exynos Octa)

$ sgs4ext4fs --bloat system_new.img system_32bit.img
Code:
## Remove Moto extra header... (for Motorola G-series, making after unsparse img)

$ mv system.raw.img system.moto.img
$ dd if=system.moto.img of=system.raw.img ibs=131072 skip=1





ANDROID_IMG_REPACK_TOOLS_CYGWIN WINDOWS


ANDROID_IMG_REPACK_TOOLS_CYGWIN is a kit utilites for unpack/repack android ext4 and boot images in WINDOWS


mkbootfs.exe
simg2simg.exe
make_ext4fs.exe
mkbootimg.exe
ext2simg.exe
img2simg.exe
simg2img.exe
sgs4ext4fs.exe - Chainfire's tool
unpackbootimg.exe - CyanogenMod tool


Already have a branch:
android-4.1.2
android-5.1.0
android-5.1.1
android-6.0.0
android-6.0.1

Already have a .exe:
WINDOWS REPO






XDA:DevDB Information
android_img_repack_tools, Tool/Utility for the Android General

Contributors
A.S._id

Version Information
Status: Testing

Created 2014-01-06
Last Updated 2016-04-17
The Following 91 Users Say Thank You to A.S._id For This Useful Post: [ View ]
 
 
6th January 2014, 10:54 PM |#2  
A.S._id's Avatar
OP Recognized Developer
Thanks Meter: 2,488
 
Donate to Me
More
Odin3 ROM Editor
Reserved
The Following 25 Users Say Thank You to A.S._id For This Useful Post: [ View ]
6th January 2014, 10:54 PM |#3  
A.S._id's Avatar
OP Recognized Developer
Thanks Meter: 2,488
 
Donate to Me
More
Android ext4fs ROM editor
Android_ROM_IMG_Repacker

It is automatise for android_img_repack_tools for Linux & Windows CYGWIN

Instructions:



credits:
android.googlesource
@Chainfire
@Chenglu
@xpirt

Added v.2.1

* Configure:
Auto choice OS for compilation android_img_repack_tools

* MOUNT ext4 img:
Auto converting sparse to raw img
Auto find magic sparse img and remove vendor extra header
Auto choice OS for mount or extract raw img

* MAKE_EXT4FS - new img ANDROID permission:
Auto extract 'file_contexts' from recovery.img (if exist)

* EXT2SIMG - raw to sparse
Auto choice chunk header (28/32 bytes)

Added v.2.2

* Fixed some bugs
The Following 20 Users Say Thank You to A.S._id For This Useful Post: [ View ]
8th January 2014, 11:52 AM |#4  
Member
Thanks Meter: 28
 
More
mod edit
Thank you very much. I'm waiting for you.
The Following 2 Users Say Thank You to linhbs For This Useful Post: [ View ] Gift linhbs Ad-Free
8th January 2014, 01:08 PM |#5  
A.S._id's Avatar
OP Recognized Developer
Thanks Meter: 2,488
 
Donate to Me
More
[tool] ANDROID_IMG_REPACK_TOOLS - CYGWIN EXE
Android_img_repack_tools - cygwin exe
The Following 14 Users Say Thank You to A.S._id For This Useful Post: [ View ]
8th January 2014, 02:23 PM |#6  
Member
Thanks Meter: 28
 
More
Thanks you. I got it!
The Following User Says Thank You to linhbs For This Useful Post: [ View ] Gift linhbs Ad-Free
8th January 2014, 05:28 PM |#7  
A.S._id's Avatar
OP Recognized Developer
Thanks Meter: 2,488
 
Donate to Me
More
added branches:
android-2.3.7_r1
android-4.0.4_r2.1
android-4.2.2_r1.2
android-4.3_r3.1
android-4.4.2_r1
The Following 7 Users Say Thank You to A.S._id For This Useful Post: [ View ]
12th January 2014, 10:51 AM |#8  
Member
Thanks Meter: 7
 
More
Some headers missed. I am using Ubintu 12.04 and installed zlib1g-dev for compiling zlib_host. But make_ext4fs don't compiling:

Building make_ext4fs...
extras/ext4_utils/make_ext4fs.c: In function 'build_directory_structure':
extras/ext4_utils/make_ext4fs.c:175:27: error: 'struct stat' has no member named 'st_stat'
extras/ext4_utils/make_ext4fs.c:176:26: error: 'struct stat' has no member named 'st_stat'
extras/ext4_utils/make_ext4fs.c:177:26: error: 'struct stat' has no member named 'st_stat'
make: *** [make_ext4fs] Error 1
The Following 2 Users Say Thank You to MATPOC For This Useful Post: [ View ] Gift MATPOC Ad-Free
12th January 2014, 11:05 AM |#9  
A.S._id's Avatar
OP Recognized Developer
Thanks Meter: 2,488
 
Donate to Me
More
Quote:
Originally Posted by MATPOC

Some headers missed. I am using Ubintu 12.04 and installed zlib1g-dev for compiling zlib_host. But make_ext4fs don't compiling:

Building make_ext4fs...
extras/ext4_utils/make_ext4fs.c: In function 'build_directory_structure':
extras/ext4_utils/make_ext4fs.c:175:27: error: 'struct stat' has no member named 'st_stat'
extras/ext4_utils/make_ext4fs.c:176:26: error: 'struct stat' has no member named 'st_stat'
extras/ext4_utils/make_ext4fs.c:177:26: error: 'struct stat' has no member named 'st_stat'
make: *** [make_ext4fs] Error 1

Well you has two ways:
This http://www.zlib.net/
or
Code:
make clean
make clear
./configure
cd ./zlib/src
./configure
make
sudo make install
cd ../..
make clean
make
The Following 5 Users Say Thank You to A.S._id For This Useful Post: [ View ]
12th January 2014, 12:46 PM |#10  
Member
Thanks Meter: 7
 
More
Quote:
Originally Posted by A.S._id

Well you has two ways:
This http://www.zlib.net/

As I said I have compiled zlib_host by installing zlib1g-dev. Compile broken at ext4fs - maybe there are no extra headers for ext4fs, such as for struct stat.
12th January 2014, 12:59 PM |#11  
A.S._id's Avatar
OP Recognized Developer
Thanks Meter: 2,488
 
Donate to Me
More
Quote:
Originally Posted by MATPOC

As I said I have compiled zlib_host by installing zlib1g-dev. Compile broken at ext4fs - maybe there are no extra headers for ext4fs, such as for struct stat.

1. zlib1g-dev - не входит в состав zlib
2. у меня установлена Ubuntu 13.10 amd64 gcc 4.8
поэтому - не могу точно ответить по 12.04

gt.
Quote:

1. zlib1g-dev - not part of zlib
2. I have installed Ubuntu 13.10 amd64 gcc 4.8
so - I can not exactly answer to 12.04

Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes