• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[tool] ANDROID_IMG_REPACK_TOOLS

Search This thread

A.S._id

Inactive Recognized Developer
Sep 21, 2010
1,211
2,575
[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
 
Last edited:

A.S._id

Inactive Recognized Developer
Sep 21, 2010
1,211
2,575
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
 

Attachments

  • Android_ROM_IMG_Repacker_v2.zip
    234 KB · Views: 6,774
  • Android_ROM_IMG_Repacker_v21.zip
    234.3 KB · Views: 2,795
  • Android_ROM_IMG_Repacker_v22.zip
    234.3 KB · Views: 29,418
Last edited:

A.S._id

Inactive Recognized Developer
Sep 21, 2010
1,211
2,575
[tool] ANDROID_IMG_REPACK_TOOLS - CYGWIN EXE

Android_img_repack_tools - cygwin exe
 

Attachments

  • ANDROID_IMG_REPACK_TOOLS_CYGWIN_x32_4.1.2_r2.1.zip
    1.5 MB · Views: 3,206
  • ANDROID_IMG_REPACK_TOOLS_CYGWIN_x64-86_4.1.2_r2.1.zip
    1.4 MB · Views: 2,958
  • ANDROID_IMG_REPACK_TOOLS_CYGWIN_x32_5.1.0_r5.zip
    1.7 MB · Views: 1,475
  • ANDROID_IMG_REPACK_TOOLS_CYGWIN_x64-86_5.1.0_r5.zip
    1.7 MB · Views: 1,806
  • ANDROID_IMG_REPACK_TOOLS_CYGWIN_x32_5.1.1_r1.zip
    1.7 MB · Views: 1,772
  • ANDROID_IMG_REPACK_TOOLS_CYGWIN_x64-86_5.1.1_r1.zip
    1.7 MB · Views: 2,585
  • ANDROID_IMG_REPACK_TOOLS_CYGWIN_x32_6.0.0.zip
    1.7 MB · Views: 1,112
  • ANDROID_IMG_REPACK_TOOLS_CYGWIN_x64-86_6.0.0.zip
    1.8 MB · Views: 1,701
  • ANDROID_IMG_REPACK_TOOLS_CYGWIN_x32_6.0.1.zip
    1.7 MB · Views: 4,866
  • ANDROID_IMG_REPACK_TOOLS_CYGWIN_x64-86_6.0.1.zip
    1.8 MB · Views: 14,623
Last edited:

MATPOC

Senior Member
Jun 25, 2010
59
9
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
 

A.S._id

Inactive Recognized Developer
Sep 21, 2010
1,211
2,575
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
 
Last edited:

A.S._id

Inactive Recognized Developer
Sep 21, 2010
1,211
2,575
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.
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
 
Last edited:

alexyuh

Senior Member
Jan 7, 2012
319
515
Saint-Peterburg
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.
Assembly must be done on 64 bit OS. Only installing zlib-1.2.8
View attachment zlib-1.2.8.tar.gz
And the following packages
Code:
sudo apt-get update
sudo apt-get install ia32-libs
gcc 4.8 can be set separately
 
Last edited:
  • Like
Reactions: linhbs

desalesouche

Senior Member
Feb 6, 2012
3,651
4,295
hi sir. may i ask you to update op with more explanation of what can do your tool?
i understood that it unpack and repack boot.img and compile binaries...
and after that i am wondering what more? what for?
i use kernel tool master to unpack and repack boot.img...
what is the diffeence and the purpose of you tools?
thank you...
i know i miss of knowledge so that is why i ask.
 

alexyuh

Senior Member
Jan 7, 2012
319
515
Saint-Peterburg
hi sir. may i ask you to update op with more explanation of what can do your tool?
i understood that it unpack and repack boot.img and compile binaries...
and after that i am wondering what more? what for?
i use kernel tool master to unpack and repack boot.img...
what is the diffeence and the purpose of you tools?
thank you...
i know i miss of knowledge so that is why i ask.

Old binary do not work with newer versions of android
 
  • Like
Reactions: desalesouche

Odysseus1962

Senior Member
Sep 30, 2013
690
562
Miami
The way is not into repacking boot image, but different version of android has different parametrs of FS. Example android 4.3 ext4 FS has support SELinux, but 4.1 and older hasn't

I still don't get the purpose of these tools. I've been running Gentoo Linux as my primary OS for a dozen years, all the tools I need to compile kernels, create boot images, ramdisks, initrds, extract and manipulate from already created images, are already installed on my system by default. Why would I need these too? Are these supposed to be time-savers? Shortcuts? I still don't understand.
 

A.S._id

Inactive Recognized Developer
Sep 21, 2010
1,211
2,575
I still don't get the purpose of these tools. I've been running Gentoo Linux as my primary OS for a dozen years, all the tools I need to compile kernels, create boot images, ramdisks, initrds, extract and manipulate from already created images, are already installed on my system by default. Why would I need these too? Are these supposed to be time-savers? Shortcuts? I still don't understand.

Well, how I can see, you're HTC user, and maybe this utilities isn't you needs, because htc don't use sparse images, and different header block size in self rom. But samsung, sony, asus and different brands using it...
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 115
    [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
    34
    [tool] ANDROID_IMG_REPACK_TOOLS - CYGWIN EXE

    Android_img_repack_tools - cygwin exe
    32
    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
    25
    Odin3 ROM Editor

    Reserved
    9
    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