yashsingh1/xdaforums huggingface dataset:
[Android Software Development] :
[MENTION=4544860]osm0sis[/MENTION], I just forked your mkbootimg source and downloaded it as a zip. I went ahead and made your source in to a statically compiled multi call binary. The source is in the zip provided as an attachment below. Inside the zip is the binary called, osmosis. I got bored so figured what the Heck, why not haha. Thought I would share.
[Android Software Development] :
I forgot to add -Werror to my makefile in that zip so feel free to rebuild ;) if you decide to play with it.
[Android Software Development] osm0sis:
Thanks buddy! :)

I've still got to have lz4, xz, and file for mobile (and a f*ck-pile of Cygwin stuff for Windows), so there's no real great need to go multi-call, but still a really cool idea and good example for anyone looking to do something similar. :cowboy:

Interesting side-note on the last release: Still couldn't get file 5.19 to work (just displays "Aborted") on KitKat (ARM), but weirdly enough, it works just fine on Android L. 5.18 compiled exactly the same works on both. I'll have to report it to the file Mailinglist and see if they can/want to help. :confused: :good:

Also, the context change for the root prompt might throw up a little warning about TTY, but it doesn't actually affect anything and can be safely ignored. It's a necessary annoyance to get it working on Android L. I've told Chainfire but I'm pretty sure it's not a high priority on his list, if it made it on at all. ;)

Other thing is, I updated the AIK Build Farm with init and update functions to pull the latest sources from all the git repos for the included binaries, so it can be set up from scratch now using just Cygwin (or probably Linux if you add #!/sbin/sh or whatever), the toolchains and that shell script. :cool:
[Android Software Development] :
Well done

---------- Post added at 04:37 PM ---------- Previous post was at 04:25 PM ----------

[MENTION=4544860]osm0sis[/MENTION], would you send me the lz4, xy, and file sources for mobile in a zip?

Don't need the cygwin stuff. My phone is my computer :).
[Android Software Development] osm0sis:
If you don't want to bother with pulling the latest from git (which is all in my build script commands), then the latest (working) snapshots are here:

ftp://ftp.astron.com/pub/file/file-5.18.tar.gz

http://tukaani.org/xz/xz-5.0.5.tar.gz

https://github.com/Cyan4973/lz4/archive/r120.tar.gz

:)

lz4 throws up a -Wshadow warning starting with r120 but it doesn't seem to break anything, and as you know, Autotools (./configure) has made file and xz a nightmare to cross-compile, but wasn't too bad natively (though I had to edit gettext.c into file.c manually). However the NDK toolchain's shared libraries will still keep you from getting a true static compile, so trying to make a multi-call binary would generally ensure that they all had to be dynamic PIE, where I'm sure you'd prefer static.
[Android Software Development] :
Crap, haha, forgot I already have lz4 downloaded on my phone :P but thanks for the others bro.

---------- Post added at 04:52 PM ---------- Previous post was at 04:52 PM ----------

Nothing guaranteed but gonna mess around with them some.
[Android Software Development] :
[MENTION=4544860]osm0sis[/MENTION], the lz4 source comes with a few separate programs. In the picture below it is strictly lz4 compiled for ARM. I just need you to verify if this is what is needed? I can easily add this source as a multi call lol. Heck, for spite, I can add the other lz4 programs too. Will still need to review xy and file.
[Android Software Development] osm0sis:
For the sake of keeping things up-to-date from their sources (on top of the reasons I already explained), I really can't see the sense in a switch to using a multi-call binary. If you're just doing this for fun or for your own purposes, then by all means carry on! :D

progams/lz4 is all I've bothered to compile, since it's all I required. Unfortunately, I can't imagine file and xz will be so easy to cobble together, however; they're both quite complicated projects.

The ways I've saved time to just compile what I need from them are in my build script. :good: :)
[Android Software Development] :
Oh, it's definitely just for fun lol. At least until I come up with another idea or project. Meanwhile, keeping myself occupied.
[Android Software Development] :
Man, that xz binary is a pain to work with lol. Been configuring it left and right and still no success in a static compile...
[Android Software Development] gggg:
Samsung Tab S SM-T705, Kitkat 4.4.2 StockROM - system.img not working

THX für the kitchen. From my Sammobile StockROM file recovery.img and boot.img could be extracted by unpacking.bat, but system.img (Cache.img, hidden.img) produce the following output

Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers
Supplied image: system.img
Setting up work folders . . .
Splitting image to "/split_img/" . . .
Android boot magic not found.
Error!

as I'm a bit of a noob I also tried unlokimg.bat. First it missed cygwin1.dll, which I then put to syswow64 and finaly got theese errors:

1 Windows Message: dd.exe could not be startet oxc000007b

2

Android Image Kitchen - UnLokImg Script
by osm0sis @ xda-developers
Loki Tool by djrbliss @ xda-developers
Supplied image: system.img
command "android_win_tools\cut" written wrong or not found

Could you please advice the novice ;)
[Android Software Development] osm0sis:
In guessing unlokimg couldn't find cygwin1 because you didn't follow instructions and unzipped it somewhere other than over the main AIK directory. ;)

AIK is only for Android bootable image format. Meaning kernels packaged with ramdisks, like boot.img and recovery.img. :)

system.img is in Google/Samsung's filesystem image format. You can't edit them, but you can extract files from them as needed with the directions here (2nd last sentence after the red in the first paragraph): http://xdaforums.com/showpost.php?p=28181832&postcount=2

cache.img and userdata.img are technically also in the filesystem format, but they're sparse filesystems, meaning there's nothing in them vs. the size they occupy on-device and they most likely won't convert to .ext4.img due to this.

Not sure about hidden.img, it could literally be anything. Raw EMMC data partition would be my first guess. Nothing to extract there either.

Hope that helps with whatever you're trying to do! :p
[Android Software Development] Wuby986:
If you want to unpack the system.ext4.img i guess you might want to deodex or edit apk.. so i would most likely do it with a kitchen ( archi' s on linux only, or original dsixda' s for both, cygwin and linux)
[Android Software Development] gggg:
actually I just want to have access to certain files including their rights structure) on system.img. So best für me would be if I could mount the system.img under cygwin ...

I already tried to mount it with e.g. OSFMount (and aply ext2fsd, paragonExtFS,...), LinuxReader and under Ubuntu (Live-DVD), but the .img is not in a form that it is a readable filesystem. Something has do be done to it first like ext4unpacker which worked for ICS/JB but not for KiKat4.4.
[Android Software Development] osm0sis:
Did you use the samsung2ext4.jar I linked you to before mounting in Linux Reader? If not, read the instructions again. I use the Linux Reader method all the time with Google's factory images and it definitely works. I don't write informative posts so people can skim them. ;) :good:

Anyway this has gotten pretty out of scope and off-topic for this thread, so if you can't figure it out from what I linked you to then I'd suggest you make a Q&A thread. Best of luck! :)
[Android Software Development] bombadier:
Ignore as have managed to theme and repack the multirom version,reboot menu works,dont know what went wrong.

However seems like TWRP cannot mount my encrypted data partition,bugger I think is the word:(
[Android Software Development] gggg:
THX but I tried sgs2toext4.jar and it does not work on samung 4.4 Tab S SM-T705 system.img .. it creates a 0 Bytes file
[Android Software Development] osm0sis:
Ah well perhaps it's different then. Make a Q&A thread in your device's forum and see if they can tell you more. :good:
[Android Software Development] osm0sis:
New versions up in the OP! HUGE thank-you to [MENTION=6367467]SHM[/MENTION] for his time spent over the last week figuring out how to force Autotools package-built Makefiles to properly static compile with the Android NDK without having to alter the toolchains! Major breakthrough. More info here. :D :highfive:

AIK-mobile v1.6 + AIK-Linux v1.6

- file and xz are now true static binaries, thanks to SHM, restoring compatibility with pre-JB Android while keeping Android L compliant. (AIK-mobile)

- Latest lz4 binary (r121).

Installation information and details on each edition can be found in the AIK-mobile and AIK-Linux initial release notes.

If you are reporting a problem with your device, please clearly state your device name and model/variant as well as provide a link to the image file.
[Android Software Development] Lanchon:
hi,

under linux mint latest 64-bit, operating on the boot.img embedded in http://download.cyanogenmod.org/get/jenkins/78476/cm-11-20140804-SNAPSHOT-M9-i9100.zip i get:

$ ./unpackimg.sh boot.img

Android Image Kitchen - UnpackImg Script

by osm0sis @ xda-developers

Supplied image: boot.img

Setting up work folders...

Splitting image to "split_img/"...

Android boot magic not found.

Error!

i don't really need this solved anymore, i sidestepped the issue. but i'm still wondering why it went wrong.

thanks!
[Android Software Development] osm0sis:
Read the second post of this thread. :good:
[Android Software Development] Lanchon:
lol SGS2 confirmed not working :)

thanks!!
[Android Software Development] LaboDJ:
Thanks for the tool, it's very useful, I used it in my kernel installer (link in signature)

I'm currently trying to compile lz4 r123 myself using 4.8 NDK google toolchain, (it works, I just compiled fstrim and it runs good)

I really don't understand how to compile lz4, could you please post you buildscript/patches/makefile?

Thanks a lot
[Android Software Development] osm0sis:
Check my Odds and Ends thread. The "build farm" is down in the knowledge base links. :)
[Android Software Development] :
Hmmm, compiling lz4 was pretty easy on my end. Curious as to what the complications were?
[Android Software Development] impactor:
I am on Linux, using AIk 1.6, and I am getting an error at both unpacking, and packing.

On unpackig:

$ sh unpackimg.sh boot.img

\nAndroid Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers\n
Supplied image: boot.img\n
Setting up work folders...\n
Splitting image to "split_img/"...\n
BOARD_KERNEL_CMDLINE androidboot.hardware=qcom user_debug=31 zcache
BOARD_KERNEL_BASE 80200000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 02000000
BOARD_TAGS_OFFSET 00000100
\nUnpacking ramdisk to "ramdisk/"...\n
Compression used: gzip
1797 blocks
\nDone!
unpackimg.sh: line 84: return: can only `return' from a function or sourced script

but the boot img seems unpacked, because there are files in appropriate folders.

But when I try to run repackimg.sh, I get:

$ sh unpackimg.sh boot.img

\nAndroid Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers\n
Supplied image: boot.img\n
Setting up work folders...\n
Splitting image to "split_img/"...\n
BOARD_KERNEL_CMDLINE androidboot.hardware=qcom user_debug=31 zcache
BOARD_KERNEL_BASE 80200000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 02000000
BOARD_TAGS_OFFSET 00000100
\nUnpacking ramdisk to "ramdisk/"...\n
Compression used: gzip
1797 blocks
\nDone!
unpackimg.sh: line 84: return: can only `return' from a function or sourced script

and no boot.img is generated.
[Android Software Development] Captain_Throwback:
You pasted the same output twice?
[Android Software Development] impactor:
Sorry about that:

$ sh repackimg.sh

\nAndroid Image Kitchen - RepackImg Script
by osm0sis @ xda-developers\n
Packing ramdisk...\n
Using compression: gzip
1797 blocks
\nGetting build information...\n
kernel = boot.img-zImage
cmdline = androidboot.hardware=qcom user_debug=31 zcache
board =
base = 80200000
pagesize = 2048
kernel_offset = 00008000
ramdisk_offset = 02000000
tags_offset = 00000100
\nBuilding image...\n
Done!
repackimg.sh: line 90: return: can only `return' from a function or sourced script

But the new img files is being produced and it seems to be booting.
[Android Software Development] osm0sis:
Did you try not calling it through the sh binary? Like just ./unpackimg.sh directly?
[Android Software Development] impactor:
Yes. Makes no difference.
[Android Software Development] osm0sis:
That's new. I'll fire up the VM and check it out. What's your distro/build?
[Android Software Development] impactor:
Arch 64bit.

I think it's a cosmetic issue, because - as I said - the image is being unpacked and then repacked in a seemingly correct way.
[Android Software Development] ndrancs:
[MENTION=4544860]osm0sis[/MENTION]

Dear dev, i need permission to publish it.

https://github.com/ndrancs/AIK-Linux-x32-x64

Thanks. ;)
[Android Software Development] osm0sis:
Do 32bit binaries not execute on x64 Linux? I was under the impression there was a compatibility layer like with Windows, so multiple versions would be unnecessary.
[Android Software Development] :
If I recall, 64 won't work on 32 unless you have the right libs and such set in it's path. But will vice versa. Correct me if I am wrong though :).
[Android Software Development] osm0sis:
Right! And if I was thinking I would have remembered impactor's post above shows the binaries work just fine on x64, so yeah, no need for the fork in my opinion. :good:
[Android Software Development] ndrancs:
Yes, in linux its doesnt always work if We dont install all lib32 defencies. Arch linux based distro like bbqlinux have lib32 installed as default so 32 version will work but in some distro it doesnt. Pure x64 distro linux like my custom linux.
[Android Software Development] :
^ he has a valid point.
[Android Software Development] sscs:
Suggestions

This tool is very good, but the recent Samsung mobile phone does not support, such as G3568v boot.img, was unable to decompress the inside of the boot.img-ramdisk.cpio, but cannot be modified! Hope to solve the! Thanks a million

Supplied image: boot.img

Setting up work folders . . .

Splitting image to "/split_img/" . . .

BOARD_KERNEL_CMDLINE

BOARD_KERNEL_BASE 10000000

BOARD_PAGE_SIZE 33554432

BOARD_KERNEL_OFFSET 00008000

BOARD_RAMDISK_OFFSET 01000000

BOARD_TAGS_OFFSET f004b800

BOARD_DT_SIZE 268435712

Unpacking ramdisk to "/ramdisk/" . . .

Compression used: data

Error!
[Android Software Development] osm0sis:
Thanks for the report. I've added the Galaxy Core Mini 4G (your device) to the unsupported section in the second OP. Blame Samsung. Follow the link there for more information.

Edit: [MENTION=3452123]impactor[/MENTION], looks like your distro's echo command doesn't support escape characters by default in a subshell, I'm fixing that, and in retrospect I'm not sure why I used return instead of exit so I'll switch those over to handle those script warnings you were seeing. :good:

[MENTION=5359154]ndrancs[/MENTION], I'm going to build a x64 cross-compiler to go with my Linux-i686 one, then I'll add automatic detection and official support, thanks for all the info! :)

Edit 2: Actually, it seems like some distros also don't accept echo -e to enable escape characters, so you end up with output including "-e" all over the place. That's annoying. Oh well.. I guess "\n" all over the place is the lesser annoyance. We'll see if I feel like echoing blank lines to be portable by release time. :p
[Android Software Development] AA1973:
Great tool. Just gave TWRP's splashscreen a new look via AIK mobile edition. Brilliant and well described. Thank you [MENTION=4544860]osm0sis[/MENTION]?
[Android Software Development] superuser.pm:
i try unpack ,repack and install file TWRP_multirom_grouper_20140914.img successfully but i mod version TWRP_multirom_grouper_20141021.img then its error.

i can unpack,repack ,install file recovery date 20141021.img when boot into recovery it;s not ok

threat here : http://xdaforums.com/showthread.php?t=2011403

why ? help me!!!
[Android Software Development] osm0sis:
[MENTION=2719389]z31s1g[/MENTION] successfully repacks MultiROM TWRP imgs all the time to bundle matching curtains for his excellent themes, there must be something wrong with how you're doing it or the changes you're making.
[Android Software Development] z31s1g:
https://www.dropbox.com/s/vij44t6b18inbuc/280_play_multirom.img?dl=0

This is a 1021multirom recovery with a play curtain. Made it with aik mobile. Please test if it's working.
[Android Software Development] Guich:
[MENTION=4544860]osm0sis[/MENTION], great tool!

I was looking for a mac version if you can build it.

OSX is based on unix, so i think is not hard do a version for it :)

Thanks anyway :)
[Android Software Development] osm0sis:
Did you try the Linux version? Or search to see if there's an easy way to run Linux binaries under OSX?

If that doesn't work, then feel free to go ahead and grab my source and compile it yourself. Open source FTW. :)

My main goals for AIK now are updating from the Lollipop source push (though I have been keeping up with AOSP master the whole time) and looking at adding x64 support to AIK-mobile and Linux. Mobile should continue to work on Lollipop 32-bit just fine of course since I've been on the ball since the developer preview dropped. ;) :good:
[Android Software Development] LaboDJ:
Hi [MENTION=4544860]osm0sis[/MENTION], I'm trying to compile mkbootfs but:

gcc -o mkbootfs.o -ffunction-sections -O3 -c mkbootfs.c -I. -Werror
mkbootfs.c: In function ‘fix_stat’:
mkbootfs.c:82:46: error: passing argument 3 of ‘fs_config’ from incompatible pointer type [-Werror]
fs_config(path, S_ISDIR(s->st_mode), &s->st_uid, &s->st_gid, &st_mode, &capabilities);
^
In file included from mkbootfs.c:15:0:
./private/android_filesystem_config.h:328:20: note: expected ‘long unsigned int *’ but argument is of type ‘__uid_t *’
static inline void fs_config(const char *path, int dir,
^
mkbootfs.c:82:58: error: passing argument 4 of ‘fs_config’ from incompatible pointer type [-Werror]
fs_config(path, S_ISDIR(s->st_mode), &s->st_uid, &s->st_gid, &st_mode, &capabilities);
^
In file included from mkbootfs.c:15:0:
./private/android_filesystem_config.h:328:20: note: expected ‘long unsigned int *’ but argument is of type ‘__gid_t *’
static inline void fs_config(const char *path, int dir,
^
cc1: all warnings being treated as errors
Makefile:23: set di istruzioni per l'obiettivo "mkbootfs.o" non riuscito
make: *** [mkbootfs.o] Errore 1

Any hint? :confused:
[Android Software Development] Guich:
I've tried but seems i can't run binary Linux on mac :)

So, will see i'm able to port for mac os..

Thanks anyway!
[Android Software Development] osm0sis:
Depending on your build environment and toolchain that might be what I worked around in my native branch. Try building it instead of master. :good:
[Android Software Development] osm0sis:
Looks like there might be a bit of an issue with official 5.0 after all, just cpio having trouble with permission creating the symlinks that are often in /sbin; I might just need to look at switching the su context again to fix that. I'll reread Chainfire's docs next week probably. :good:

Edit: Nope, too busy! I'll try to get to it soon though. I want to be able to run AIK on my N7 '13 again. ;)
[Android Software Development] respider:
great tool, thanks!

is it normal to the repacked file to be much smaller than original?

my original recovery is 16mb and repacked 9mb

I've tried unpacking the new file and looks like eveything is there
[Android Software Development] osm0sis:
Sometimes there's needless padding which gets stripped out, and it might be using a different compression level than the original, but as long as it flashes and boots you have nothing to worry about. :)
[Android Software Development] osm0sis:
Good news everyone! Chainfire's new root method entirely removes the need for AIK-mobile to context switch, so until I get a release out reflecting that you can manually type su and then cd /data/local/AIK-mobile and everything should work fine.

You can also edit out the --context part of the su command in /data/local/AIK-mobile/aik and that will fix things to work normally.

Make sure you've flashed the latest SuperSU install zip.
[Android Software Development] po8pimp:
Recommended change

I just used this tool for the first time and realized that the cleanup.bat script didn't clean everything up. It left the folder ramdisk. This is not a serious issue, just thought I would help out. You can always add a line to the bottom of the bat to include this:

RMDIR \"ramdisk" /S /Q > nul 2>&1

Updated the code. The previous one I put would not delete any files that where changed. It would hang up. This one works without a hitch. To test unpack an img, place a different pic in the ramdisk/res/images folder, then repackage the img. After that run your cleanup. It will leave the folder. Add my script to the bottom line of the "cleanup.bat" and it will remove the folder completely.
[Android Software Development] osm0sis:
Works fine here, forever and ever. It's likely just a file lock on your system.
[Android Software Development] Captain_Throwback:
[MENTION=4544860]osm0sis[/MENTION]

Any reason AIK-mobile has "cwm" in the filename? Isn't CWM deprecated now in favor of more up-to-date recoveries?

It might confuse some people to think the zip will only install with CWM. Just wondering if there was a specific reason for that naming convention.
[Android Software Development] osm0sis:
Yeah, it's a throwback. ;)

I'll probably switch to UPDATE- like Chainfire for the next revision; but I mostly liked cwm- because it was short and indicated it was flashable.
[Android Software Development] r4dius:
Hi,

actually using TWRP 283X 1080 light theme and found a little typo error in the ui.xml : <listitem name="This will function uses the">1</listitem>

Thanks for the theme :)
[Android Software Development] Captain_Throwback:
Wrong thread?
[Android Software Development] 3lo0sh:
In Arch Linux /bin/sh is a symlink from /bin/bash

so when run the script you get

\nAndroid Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers\n
Supplied image: openrecovery-twrp-2.8.3.0-hammerhead.img\n
Setting up work folders...\n
Splitting image to "split_img/"...\n
BOARD_KERNEL_CMDLINE console=ttyHSL0,115200,n8 androidboot.hardware=hammerhead user_debug=31 maxcpus=2 msm_watchdog_v2.enable=1 androidboot.selinux=permissive
BOARD_KERNEL_BASE 00000000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 02900000
BOARD_TAGS_OFFSET 02700000
\nUnpacking ramdisk to "ramdisk/"...\n
Compression used: gzip
14881 blocks
\nDone!
./unpackimg.sh: line 84: return: can only `return' from a function or sourced script

Using mksh

Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers

Supplied image: openrecovery-twrp-2.8.3.0-hammerhead.img

Setting up work folders...

Splitting image to "split_img/"...

BOARD_KERNEL_CMDLINE console=ttyHSL0,115200,n8 androidboot.hardware=hammerhead user_debug=31 maxcpus=2 msm_watchdog_v2.enable=1 androidboot.selinux=permissive
BOARD_KERNEL_BASE 00000000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 02900000
BOARD_TAGS_OFFSET 02700000

Unpacking ramdisk to "ramdisk/"...

Compression used: gzip
14881 blocks

Done!
[Android Software Development] r4dius:
Ahah yeah my bad !!
[Android Software Development] osm0sis:
Ah so THAT's why the escape characters don't parse on those distros. Nice! For better cross-compatibility I've already made the change to manually print each blank line though. Stay tuned. :)