yashsingh1/xdaforums huggingface dataset:
[Android Software Development] 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
[Android Software Development] A.S._id:
Well you has two ways:

This http://www.zlib.net/

or

make clean
make clear
./configure
cd ./zlib/src
./configure
make
sudo make install
cd ../..
make clean
make
[Android Software Development] 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.
[Android Software Development] A.S._id:
1. zlib1g-dev - не входит в состав zlib

2. у меня установлена Ubuntu 13.10 amd64 gcc 4.8

поэтому - не могу точно ответить по 12.04

gt.
[Android Software Development] alexyuh:
Assembly must be done on 64 bit OS. Only installing zlib-1.2.8

View attachment 2510914

And the following packages

sudo apt-get update
sudo apt-get install ia32-libs

gcc 4.8 can be set separately
[Android Software Development] desalesouche:
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.
[Android Software Development] alexyuh:
Old binary do not work with newer versions of android
[Android Software Development] desalesouche:
does that tool can take binaries from one kernel to port it to another?
[Android Software Development] A.S._id:
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
[Android Software Development] Odysseus1962:
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.
[Android Software Development] A.S._id:
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...
[Android Software Development] rogerscrack:
why is this error?
[Android Software Development] A.S._id:
cd zlib/src

make clean

./configure

make

sudo make install

and try again...
[Android Software Development] bovirus:
Thanks. I believe that you mentioned the Google Drive link in first post.

I propose, to avoid misunderstanding between file and version, to remove the file attachments (old version 5.1) from second post and leave only Google Drive link in first post.
[Android Software Development] linhbs:
- I want to ask you this question:

- On linux to mount and edit system.img "$ mount -t ext4 -o loop system.raw.img system_mnt"

- On cygwin I do not know how to mount and edit system.img?

- Can you guide me on cygwin? Big thanks pro.
[Android Software Development] bovirus:
To edit an image you have to use Linux to maintain file permission.

The cygwin tools are only to view/extract files.
[Android Software Development] A.S._id:
You can't to mount file img ext4 into windows, but you can create new file system in the sparse img via make_ext4fs from folder with extracted files system for example.

make_ext4fs fixing permissions and selinux contexts via operand -a mount point and -S file_contexts...

For example:

$ ./mkuserimg.sh -s system system.img ext4 /system 2324M file_contexts
[Android Software Development] linhbs:
If so, files ext2sing.exe and make_ext4fs.exe. what effect?

Thanks pro.
[Android Software Development] A.S._id:
mkuserimg.sh working via make_ext4fs...
[Android Software Development] linhbs:
I've got it. Thank you very much.
[Android Software Development] A.S._id:
No, it isn't true...

Into cygwin you can make full flash image with full unix permissions and selinux contexts from folder
[Android Software Development] bovirus:
[MENTION=2976903]A.S._id[/MENTION]

Proposal

- Lnux tools

Please update your Linux script with version 5.1.0_r5 and 5.1.1_r1

- Cygwin tools

Change section title "android_5.1_img_repack_tools_CYGWIN (beta)" in "Android image repack tools (CYGWIN) " (no reference about version)

Please add (and maintain) in the post the info about current latest version of Cygwin tools (currently 5.1.1_r1).

Thanks for your work.
[Android Software Development] linhbs:
[MENTION=2976903]A.S._id[/MENTION]

Cygwin tools.

- I unpack & repack system work. But when flash rom my phone is lost imei, flash back stock rom is normal imei

- Can you help me. Thank you very much.
[Android Software Development] bovirus:
[MENTION=2976903]A.S._id[/MENTION]

Could you please update the Linux tool script in first post with 5.0.1_r5 and 5.1.1_r1?

I edited the 5.1.0_r3 configure changing the reference 5.1.0_r3 to 5.1.0_r5. It worked

I edited the 5.1.0_r3 configure changing the reference 5.1.0_r3 to 5.1.1_r1.

Didn't work. Errore about stable/cm12.0.

I changed stable/cm12.0 to stable/cm12.1- Didn't work

I changed stable/cm12.0 to cm12.1. It worked. Is it right?
[Android Software Development] A.S._id:
Dear Sir! I'm following the release of updates is not worse than you. If I have not done it because of lack of time. Please, do not need to be reminded that I need to do! I'm doing what I think is necessary, as far as possible and opportunity ...
[Android Software Development] bovirus:
i posted my tentative because if you can help (confrim that it's rigfht), could be usefull for all users (while you are updating your tools).
[Android Software Development] bovirus:
[MENTION=2976903]A.S._id[/MENTION]

Google released branches: 5.5.1_r2 and 5.1.1_r3.

https://android.googlesource.com/platform/manifest/+refs
[Android Software Development] Andro-Man:
Just to make it more clear for me:

## Creating new android sparse img for flashing (android 2.3.6-4.2)

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

## Create new FS or converting ext4 img to sparse img for flashing (android 4.3-etc)

$ ./mkuserimg.sh -s system system.img ext4 /system 2324M file_contexts
or
$ ext2simg -v system.raw.img system_new.img

So does that mean when we configure the tool with android-4.3_r3.1 and above so all *.img files will be unpacked and repacked using ./mkuserimg.sh -s system system.img ext4 /system 2324M file_contexts or ext2simg whatever they are Snabdragon or exynos (except octa)?

And when we configure the tool with android-4.2.2_r1.2 and below so all *.img files will be unpacked and repacked using make_ext4fs whatever they are Snabdragon or exynos (except octa)?
[Android Software Development] A.S._id:
yes, for exynos octa after creating sparse img you must change size of img header to 32 bytes via sgs4ext4fs
[Android Software Development] Andro-Man:
Thanks for fast support :)

So in this case why we need to select between Snapdragon and Exynos dual / quad img menu?

As the configuration step will automatically select the suitable ( mkuserimg.sh or make_ext4fs or ext2simg ) according to the Android version, So we can unpack and repack Snapdragon and Exynos Dual / Quad img using any one of the img menu?

In clear words if I have Snapdragon img file android v4.4.4 then i can unpack and repack using Exynos Dual / Quad menu Or using Snapdragon menu and i should get the same result.

Is that right or there is something I missed?
[Android Software Development] A.S._id:
You can use the same menu for snapdragon and exynos quad, but for exynos I'm realise creating new img ext4 via make_ext4fs, but for snapdragon ext2simg converting raw img to sparse for saving selinux contexts
[Android Software Development] Andro-Man:
Indeed I noticed that when I unpack and repack SM-G350H Android v4.4.4 system.img.ext4 via Snapdragon menu the new created system.img.ext4 size was 969MB when the original size before unpacking is 954MB.

the same happend when I do it for I8552 Android v4.1.2, Also the new System.img.ext4 was bigger than the original, In addition to that I test it on S7582 which has Broadcom BCM21664 | Dual-core 1.2 GHz Cortex-A9 and flash the new system.img and working good without any errors :)
[Android Software Development] Andro-Man:
Last time I tried to use this great tool to unpack and repack SM-G355H System.img using Exynos dual menu, But after repack the flashing failed via Odin3 at system.img.

my Q is:

as in Android 4,3 and above this script will be used

## Create new FS or converting ext4 img to sparse img for flashing (android 4.3-etc)

$ ./mkuserimg.sh -s system system.img ext4 /system 2324M [B]file_contexts[/B]

So do I need to add file_contexts? And if Yes, So where and how I can do that?
[Android Software Development] A.S._id:
android 4.3 ext4 file system is support selinux, but kernel isn't using, so you can don't add file contexts on using make_ext4fs, or use ext2simg for saving attributes

p.s. same you can create adding file contexts for make_ext4fs into command script...
[Android Software Development] Andro-Man:
So from this info, I guess it is much better to use ext2simg for Android 4.3 and above, And keep the make_ext4fs for the older versions of Android, That will be easier :) as I do not know how to add file contexts.

Q: Do I need to configure the tool each time I need to unpack and repack new *.img?

I mean if I configured the tool via 0 option at the start menu and select for example the android-5.0.2_r1 to work with Android 5.0.2 *.img,

So later If I have Android 4.1.2 *.img Do I need to reconfigure the tool again and select android-4.1.2_r2.1? Or when I configure the tool with the newer version then I can use it with all the Older Android versions?
[Android Software Development] Manh_IT:
Can use the tools to decompile & recompile System.sin (Sony) ?

Thank
[Android Software Development] bovirus:
[MENTION=5116431]Manh_IT[/MENTION]

Try yourself.
[Android Software Development] QTeknology:
I need for a help:

I've a 5.0.2 Lollipop ROM in this format:

system.new.dat

system.transfer.list

file_contexts

I would edit system and this is what I do:

1) sdat2img system.transfer.list system.new.dat system.img

2) open system.img with ext2explorer and I save all in a folder (called output)

3) I edit all the files I want in extracted system folder

4) I (try) to rebuild system.img doing this: make_ext4fs -T 0 -S file_contexts -l xxxxxxxx -a system system_new.img output/

xxxxxxxx is the length in bytes of my folder and I use right mouse click on folder, property, I copy the size on disk...

I put it and for example I used this:

make_ext4fs -T 0 -S file_contexts -l 1443111168 -a system system_new.img output/

I got an error "error: ext4_allocate_best_fit_partial: failed to allocate 2986 blocks, out of space?

So I add some bytes to 1443111168 and I change it to 1543111168

Then make_ext4fs works and I get a system_new.img

5) I try to see the system_new.img with ext2explore and I can browse all the file

6) I reconvert system_new.img to system.new.dat and I got it with system.transfer.list

7) I put these 2 files on ROM and I try to flash but It fails to flash

where I wrong ?

Thanks a lot for your replies ;)

---------- Post added at 03:27 PM ---------- Previous post was at 03:07 PM ----------

I did a simply test right now...

I extracted system.new.dat and system.transfer.list

I converted them in system.img

the I straight reconverted system.img to system.new.dat without touch it

and I got the same error when trying to flash...

so my problem is rimg2sdat or maybe update-binary.......
[Android Software Development] bovirus:
[MENTION=2976903]A.S._id[/MENTION]

Could you please update Cygwin source/utilities to th4 lat4st sources (5.1.1 r4)? Thanks.
[Android Software Development] thehacker911:
Working make_ext4fs for 64 Bit Exynos 7420 (Galaxy S6 SM-G920F)?
[Android Software Development] A.S._id:
Why not?
[Android Software Development] thehacker911:
Sure? And Odin maker works for Exynos 7?

Edit: Odin Maker v003 not working on SM-G920F. Stock system.img is 3.6 GB, my system.img is 3.8 GB. I mount the system.img and repack it.

Gesendet von meinem SM-G920F mit Tapatalk
[Android Software Development] A.S._id:
how can you claim if yon didn't flash your img?
[Android Software Development] thehacker911:
Flash with Odin was fine but phone boots after flash in dl mode.

Gesendet von meinem SM-G920F mit Tapatalk
[Android Software Development] A.S._id:
so, if flash fine this means tool is working...

but if system isn't downloads this is only your errors...

I think was some wrong permissions or selinux contexts...

you can debuild your img and compare your permissions with original...
[Android Software Development] Andro-Man:
So from this info, I guess it is much better to use ext2simg for Android 4.3 and above, And keep the make_ext4fs for the older versions of Android, That will be easier as I do not know how to add file contexts.

Q: Do I need to configure the tool each time I need to unpack and repack new *.img?

I mean if I configured the tool via 0 option at the start menu and select for example the android-5.0.2_r1 to work with Android 5.0.2 *.img,

So later If I have Android 4.1.2 *.img Do I need to reconfigure the tool again and select android-4.1.2_r2.1? Or when I configure the tool with the newer version then I can use it with all the Older Android versions?
[Android Software Development] GigilinE:
Same for me... all permission is like stock image, odin flash img but after phone is stock on spalsh of the kernel (SM-G920F)

i have tryed also repack img mounted only with out mod and not start
[Android Software Development] A.S._id:
What command are you using for make img?
[Android Software Development] GigilinE:
1 step: simg2img system.img system.raw.img

2 step: mkdir system_mnt

3 step: mount -t ext4 -o loop system.raw.img system_mnt

4 step: cp -r system_mnt system_mod

5 step: mkuserimg.sh -s system_mod system_new.img ext4 ./temp 3600M

6 step: sgs4ext4fs --bloat system_new.img systemMOD.img

7 step: make tar for odin
[Android Software Development] A.S._id:
if you want touse make_ext4fs, you must add selinux contexts for android 4.4 etc, without this your system not will to work...

Better use ext2simg, then don't lost contexts...

p.s. or add contexts

$ ./mkuserimg.sh -s system system.img ext4 /system 3600M file_contexts
[Android Software Development] GigilinE:
thx for you rapid answer :)

i don't understand all, now i make a small replay, you can check?

1 step:

simg2img system.img system.raw.img

OR

ext2simg -v system.raw.img system_new.img ???

2 step: mkdir system_mnt

3 step: mount -t ext4 -o loop system.raw.img system_mnt

4 step: cp -r system_mnt system_mod

5 step: mkuserimg.sh -s system system.img ext4 /system 3600M file_contexts

6 step: sgs4ext4fs --bloat system_new.img systemMOD.img

7 step: make tar for odin

THX

update!
[Android Software Development] A.S._id:
1 step:

simg2img system.img system.raw.img

2 step: mkdir system_mnt

3 step: mount -t ext4 -o loop system.raw.img system_mnt

4 step: cp -r system_mnt system_mod

5 step:

ext2simg -v system.raw.img system_new.img

OR

mkuserimg.sh -s system system.img ext4 /system 3600M file_contexts

6 step: sgs4ext4fs --bloat system_new.img systemMOD.img

7 step: make tar for odin
[Android Software Development] GigilinE:
Now try many thx :)

Inviato dal mio SM-G920F utilizzando Tapatalk

---------- Post added at 11:29 PM ---------- Previous post was at 10:39 PM ----------

I have this error when lauch mkuserimg.sh -s system system.img ext4 /system 3600M file_contexts (my folder system now called system not system_mod)

./make_ext4fs -s -T -1 -S file_contexts -l 3600M -a /system system.img system

Creating filesystem with parameters:

Size: 3774873600

Block size: 4096

Blocks per group: 32768

Inodes per group: 7952

Inode size: 256

Journal blocks: 14400

Label:

Blocks: 921600

Block groups: 29

Reserved block group size: 231

error: xattr_assert_sane: BUG: extended attributes are not sorted
[Android Software Development] A.S._id:
Well of course, you must put into the folder with tools file_contexts...
[Android Software Development] GigilinE:
Yes i know.. i have puted and have this error

Inviato dal mio SM-G920F utilizzando Tapatalk
[Android Software Development] A.S._id:
try to add mount point system...

./mkuserimg.sh -s system system.img ext4 /system 3600M file_contexts
[Android Software Development] Andro-Man:
I did tried to unpack and repack hidden.img.ext4 of Samsung SM-N910F, It is Android v4.4.4, But after repack it failed at Odin flashing.

i configured the tool via 0 option for use it with Android 4.4.4 and select the Qualqum snapdragon menu from EXT4 menu.

any one tested this tool on SM-N910F *.img and success?
[Android Software Development] bovirus:
[MENTION=2967526]A.S[/MENTION]_id

Proposal for first post.

In Cygwin utility section please

- change "android_5.1_img_repack_tools_CYGWIN (beta)" to "android img repack tools CYGWIN (beta)"

without refernce to 5.1 (there are also 4.4/5.0/5.1 tool versions)

- report current version of your cygwin tools available

4.1.2 r2.1

5.1.0 r5

5.1.1 r1

- update cygwin tools to the latest 5.1.1 r4 (as Linux source).

- change in cygwin filename the reference to "x64-.x86" to "x64" only otherwise is not so clear that is for 64bit. Ex.

"ANDROID_IMG_REPACK_TOOLS_CYGWIN_x64-86_5.1.1_r1.zip" in "ANDROID_IMG_REPACK_TOOLS_CYGWIN_x64_5.1.1_r1.zip"

Thanks for your wonderful activities.
[Android Software Development] AskinSavascisi:
nice tool, thank you
[Android Software Development] bovirus:
[MENTION=2976903]A.S._id[/MENTION]

Are there important changes between 5.1.1_r.4 and new sources 5.1.1:r/r6/r7r8?

.
[Android Software Development] aydin.gsm1:
Hi,

I was unpack/edit/repack GT-I8190 rom using Samsung Exynos dual/quad option and everithing was successfuly.

but try edit SM-G850A rom (system.img.ext4) using Qualcomm Snapdragon option and repack it, when flashing give error and phone stay logo.
[Android Software Development] Andro-Man:
when I use the tool with android 4.4.4 configuration the md5 is not valid :(
[Android Software Development] bovirus:
[MENTION=2976903]A.S._id[/MENTION]

In the script 5.1.1_r4 there is

BRANCH_EXT=stable/cm-12.1

when I run ./configure I see a message that there isn't a match with stable/cm-12.1.

Is it right or should be

BRANCH_EXT=cm-12.1

To use branch 5.1.1_r8 is it enough to change

BRANCH=android-5.1.1_r8

Thanks.
[Android Software Development] Kalashnikitty:
can some compile the tools for 5.1.x (latest) and upload it? i cant compile it with arch linux :(
[Android Software Development] bovirus:
[MENTION=2649981]Kalashnikitty[/MENTION]

Why cannot compile it? Please report the details.
[Android Software Development] Kalashnikitty:
because of this error:

Building libpcre...
ar: pcre/*.o: Datei oder Verzeichnis nicht gefunden
Makefile:113: die Regel für Ziel „libpcre“ scheiterte
make: *** [libpcre] Fehler 1

But pcre is there. i also get an error with ./configure

WARNING: 'aclocal-1.14' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
Makefile:1346: die Regel für Ziel „dist/aclocal.m4“ scheiterte
make: *** [dist/aclocal.m4] Fehler 127

google said its a automake problem - i have installed automake 1.15-1.

linux is bbqlinux (arch)
[Android Software Development] bovirus:
[MENTION=2649981]Kalashnikitty[/MENTION]

I had thes ame problem in the past with Ubunto 10.04.

The onlyway that I found to solve this problem is to update the operative system to more recent version.

I hope that [MENTION=2976903]A.S._id[/MENTION] could find a solution that not reqiuire system operative change.
[Android Software Development] aydin.gsm1:
can any one help me??!
[Android Software Development] Andro-Man:
Please In case anyone test this great tool in Unpack / edit / repack any Samsung model share the option he used and the result he got, That will help us so much
[Android Software Development] bovirus:
[MENTION=2976903]A.S._id[/MENTION]

Is there a tool to unpack system.img?
[Android Software Development] Wuby986:
Several kitchens or if you are on linux these 2 comands from terminal will do the job:

$ mkdir -p /tmp/system

$ mount -t auto -o loop system.img /tmp/system

Of course you need to cd into the folder that contains the system.img you want and it must be not sparse img.. If it is you need first to convert it with simg2img binary (or kitchens will handle this for you)

Once you have it in tmp you can do

$ cp -a /tmp/system /your_location
[Android Software Development] bovirus:
[MENTION=5493353]Wuby986[/MENTION]

Thanks.

I'm interested to cygwin utils and for that I'm looking for a solution not in a Linux machine (now I have it an a VM).
[Android Software Development] Wuby986:
Well you can use cygwin as linux.. I do sometimes at work, for example dsixda kitchen works on cygwin and could be a nice tool, but do not rely on it for the repack, since it is not updated you will have trouble in set metadata and symlinks , same goes for root.. Unpack no problem at all!!
[Android Software Development] bovirus:
I'm so sorry but in Cygwin -t and loop options are nota avilable

Usage: mount [OPTION] [<win32path> <posixpath>]

mount -a

mount <posixpath>

Display information about mounted filesystems, or mount a filesystem

-a, --all mount all filesystems mentioned in fstab

-c, --change-cygdrive-prefix change the cygdrive path prefix to <posixpath>

-f, --force force mount, don't warn about missing mount

point directories

-h, --help output usage information and exit

-m, --mount-entries write fstab entries to replicate mount points

and cygdrive prefixes

-o, --options X[,X...] specify mount options

-p, --show-cygdrive-prefix show user and/or system cygdrive path prefix

-V, --version output version information and exit

Valid options are: acl,auto,binary,bind,cygexec,dos,exec,ihash,noacl,nosuid,notexec,nouser,override,posix=0,posix=1,sparse,text,user
[Android Software Development] Wuby986:
Holy crap, you're right!!! It is soo long that i don't use cygwin that i forgot you are supposed to use a program called DiskInternals Linux Reader on windows to mount and extract img file..

Sorry if i gave you wrong info.. Anyway it is already included in dsixda's kitchen
[Android Software Development] Andro-Man:
Anyone can confirm or not: If I configure this tool with Android-5.1.1_r4 So if after that I want to unpack any img with older Android version, Do I need to reconfigure the tool with the older version again? Or No need as it is already is configured on the latest Android version (5.1.1)?
[Android Software Development] bovirus:
The tool built from latest Abdroid build can work akso with file of previous Abdroid vesion.

Tools are compatilble With sny previous version.
[Android Software Development] Andro-Man:
So I can just configure the tool with the latest android-5.1.1_r4 and use it with all the older android version ( 5.0.2 - 5.0. - 4.4.4 ... 2.3.6 )... No need to configure it again :)!!!???
[Android Software Development] bovirus:
No. I explaned before.

New version is backward compatible.