yashsingh1/xdaforums huggingface dataset:
[Android Software Development] shoey63:
Yep, just built 2.8.7.0 for yuga. No problems there. The weird thing is, I can't unpack/repack stock ramdisk, With or without modifications on LP 5.02. It won't get past kernel splash screen :confused: What have Sony done? Not blaming the kitchen in any way though. Any theories?
[Android Software Development] osm0sis:
Sony always liked using ELF instead. What's the header of the image look like in a hex editor?
[Android Software Development] :
I wonder if this could handle elf? Unfortunately, I have not been able to build it successfully. Always fails for me on my system.

Guess maybe,

mm bootimage-utils

just doesn't cut it [MENTION=4179234]trevd[/MENTION] lol.
[Android Software Development] storm119:
Bacon + AIK

[MENTION=4544860]osm0sis[/MENTION]

Today i'm playing around with latest TWRP 2.8.7.0 with AIK...both on my Linux distro also within my device OnePlus One aka bacon. Unpack/repack image (+splash screen) are damn easy and work flawlessly....and flashing (with the new shiny TWRP Materialised afterward) the latest BlissPop rom, BanksGapps, AK kernel + another 5 flashable zip files works without issue :good:

Kudos and thank you for this superb tool...really appreciates ;)

btw....out of curiosity...why *bacon* are not listed as *Known Working Devices* on the first page....any insight ? :D
[Android Software Development] osm0sis:
Because nobody had told me so yet. Thanks! I'll add it! :)
[Android Software Development] Natakranta:
It's about damn time :D

But seriously, thanks for mobile AIK!

I've been using it with Materialised theme on TWRP for long time and I can't imagine life before repacking TWRP splash screens and having to call with the stock one.

I've just installed 2870 on flo using 2861 with materialised theme and Mobile AIK. That's how you install new recovery nowadays, simply and with style!

:D

The Answer to The Ultimate Question of Life, the Universe, and Everything is: CLEAN FLASH.
[Android Software Development] trevd:
Yeah dude ... you've got no chance lol. It works on nexus devices which is just about it, I was surprised it actually worked on those still what with device tree and all that fun stuff.

[MENTION=4544860]osm0sis[/MENTION] Don't know whether you saw that Google converted their mkbootimg tool to python. https://android.googlesource.com/platform/system/core/+/master/mkbootimg/mkbootimg .
[Android Software Development] :
Python??? Really??? I am getting sick of this language popping up everywhere......... To use Python on Android is a headache from Hades itself and takes up WAY TOO MUCH SPACE.
[Android Software Development] trevd:
It's just as part of the AOSP build system on the host machine. They do love their python in the AOSP, but yeah not a fan of python. Mainly because i've not been bothered to properly learn it and also the indentation/whitespace as a delimiter thing is a bit weird. lol
[Android Software Development] :
Well, good news about Python is that it isn't too far from C. So it wouldn't take long to learn and understand or translate for that matter. I hate it simply because it's a pain to run Python (cross compiled) on an Android device and to do so requires a lot of space. I did this a while back because I wanted to make use of the twrp_fonts.py script since I am hardly by the computer but soon realized it just wasn't worth it lol.
[Android Software Development] trevd:
Nah Python's a solved problem lol , there's an oem who includes it in their open source code releases , I think it's either Sony or LG ( tbh I can't remember so it could be any of them lol ) ... I was going to say that perl is where the pain's at cross-compiling wise but it looks like that got solved too http://perltricks.com/article/97/2014/6/16/How-to-build-Perl-on-Android-4-4 .... which might just mean that with my make "port" and Linaro's native gcc build, it should be possible to compile a kernel inside of android on the device .....

Anyway I'm getting way OT here and got way too much on to be thinking about that, :p
[Android Software Development] :
I wouldn't dare build a kernel from a device haha. Would take forever.
[Android Software Development] munjeni:
I am sure guys this https://github.com/munjeni/android_real_web_server from 10.jan.2014 will be usefull to you? :D
[Android Software Development] munjeni:
Maybe this http://xdaforums.com/crossdevice-dev/sony/tools-generate-custom-font-cwm-recovery-t2973877 help you ?
[Android Software Development] :
Not compatible for TWRP but still an interesting thread. Will check it out. Thanks.
[Android Software Development] :
[MENTION=4179234]trevd[/MENTION], thanks for sharing the link to Perl. Gonna give it a go :D and feeling excited about it lol.
[Android Software Development] JohnCorleone:
Confirmed working on the HTC One M9 (GSM variant) with the latest TWRP. I have changed several themes and a few curtains using the AIK 1.8 zip. I am doing everything directly from TWRP now on my M9 and several older WiFi only devices like my Evo 4G LTE, Galaxy Nexus, and I am about to try it on the old NS4G now...I love the flexibility here!
[Android Software Development] Er. Aditya:
edit : got it . thanks aton dev :D
[Android Software Development] PhantomApollyon:
Is there a flashable zip that removes the AIK Mobile install?
[Android Software Development] osm0sis:
Too simple. Just delete /data/local/AIK-mobile and the aik symlink in /system/xbin/; Done! :)
[Android Software Development] PhantomApollyon:
much appreciated, thanks for the quick response!

-phantom mobile-
[Android Software Development] Rom:
Hello osm0sis :)

Before star create new themes, do you know if it work for LG G3 ?

Thanks.
[Android Software Development] osm0sis:
G3 needs bump, right? So you can use it but you'll need to bump the img files again before you flash.
[Android Software Development] Rom:
No, i understand what you have say but we must bump the img file if, on the LG G3, there is an Lollipop bootloader, because the recovery image must be signing (security feature that include with the Lollipop bootloader..).

And if we install the official KitKat LG stock ROM and install non signing TWRP image, it will work ;)

So i have make this and now, i can use any Recovery without needed to bump img file..

I ask me if i must make another operation to make compatibility for LG G3 phone because i have don't see this model in the model phone tested.. :)

You understand ? :cool:
[Android Software Development] osm0sis:
I think I followed that. ;)

I won't include it in the list because of the bumping situation keeping it from working "out of the box," but with your particular setup, yes, it sounds like it should work fine. Easiest way is always to just try it before asking; it's about the same effort and probably less time than typing a post and waiting for a response. :p:good:
[Android Software Development] BOSSPDA:
V.2.2 bug repacking

Hello,

today I tried to use Android.Image.Kitchen.v2.2-Win32.zip to decompile twrp-2.8.7.1-fhd.img, for Asus Zenfone 2 and give me error, in final building.

Before I used a custom TWRP from hear http://xdaforums.com/zenfone2/development/alpha-tethered-twrp-asus-zenfone-2-t3123532/page57, and this tool worked.

Now with official TWRP, from TEAM WIN, I can't use this tool.

I leave hear the log when unpacking and when repacking.

I live hear, too, the official TWRP link https://twrp.me/devices/asuszenfone2.html

LOG

Android Image Kitchen - UnpackImg Script

by osm0sis @ xda-developers

Supplied image: twrp-2.8.7.1-fhd.img

Setting up work folders . . .

Splitting image to "/split_img/" . . .

BOARD_KERNEL_CMDLINE init=/init pci=noearly loglevel=0 vmalloc=256M androidboot.

hardware=mofd_v1 watchdog.watchdog_thresh=60 androidboot.spid=xxxx:xxxx:xxxx:xxx

x:xxxx:xxxx androidboot.serialno=01234567890123456789 snd_pcm.maximum_substreams

=8 ip=50.0.0.2:50.0.0.1::255.255.255.0::usb0: on debug_locks=0 n_gsm.mux_base_con (I put a space in : 0)

f="ttyACM0,0 ttyXMM0,1" bootboost=1 androidboot.selinux=permissive

BOARD_KERNEL_BASE 10000000

BOARD_NAME

BOARD_PAGE_SIZE 2048

BOARD_KERNEL_OFFSET 00008000

BOARD_RAMDISK_OFFSET 01000000

BOARD_SECOND_OFFSET 00f00000

BOARD_TAGS_OFFSET 00000100

Unpacking ramdisk to "/ramdisk/" . . .

Compression used: gzip

32321 blocks

Done!

Press any key to continue . . .

Android Image Kitchen - RepackImg Script

by osm0sis @ xda-developers

Packing ramdisk . . .

Using compression: gzip

Getting build information . . .

kernel = twrp-2.8.7.1-fhd.img-zImage

cmdline = init=/init pci=noearly loglevel=0 vmalloc=256M androidboot.hardware=mo

fd_v1 watchdog.watchdog_thresh=60 androidboot.spid=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx

androidboot.serialno=01234567890123456789 snd_pcm.maximum_substreams=8 ip=50.0.

0.2:50.0.0.1::255.255.255.0::usb0: on debug_locks=0 n_gsm.mux_base_conf="ttyACM0, (I put a space in : 0)

0 ttyXMM0,1" bootboost=1 androidboot.selinux=permissive

board =

base = 10000000

pagesize = 2048

kernel_offset = 00008000

ramdisk_offset = 01000000

tags_offset = 00000100

second = twrp-2.8.7.1-fhd.img-second

second_offset = 00f00000

Building image . . .

usage: mkbootimg

--kernel <filename>

--ramdisk <filename>

[ --second <2ndbootloader-filename> ]

[ --cmdline <kernel-commandline> ]

[ --board <boardname> ]

[ --base <address> ]

[ --pagesize <pagesize> ]

[ --kernel_offset <base offset> ]

[ --ramdisk_offset <base offset> ]

[ --second_offset <base offset> ]

[ --tags_offset <base offset> ]

[ --dt <filename> ]

-o|--output <filename>

Error!

Press any key to continue . . .

thanks in advance for your good job.

:good:
[Android Software Development] osm0sis:
Thanks for all the info and links! I can reproduce the issue and it seems to be something to do with the extensive cmdline involved. Comparing the working unofficial TWRP image you supplied to the not-working official, the added n_gsm.mux_base_conf="ttyACM0,0 ttyXMM0,1" must be the culprit; I'm guessing due to the batch script not being able to handle the double quotes. I'll see what I can do to accommodate that for the next release version. For now, try the mobile or Linux versions and see if they can fare better to get the job done for you. You may also be able to get away with changing the double quotes to single quotes in /split_img/*-cmdline before repacking. :good: :)
[Android Software Development] :
I will be curious to know what your fix is. I tested his image with my personal project and got the exact same results lol.
[Android Software Development] osm0sis:
%bin%\mkbootimg --kernel "split_img/%kernel%" %ramdisk% %second% --cmdline "%cmdline%" --board "%board%" --base %base% --pagesize %pagesize% --kernel_offset %kerneloff% --ramdisk_offset %ramdiskoff% %second_offset% --tags_offset %tagsoff% %dtb% -o image-new.img %errout%

to

%bin%\mkbootimg --kernel "split_img/%kernel%" %ramdisk% %second% --cmdline '%cmdline%' --board '%board%' --base %base% --pagesize %pagesize% --kernel_offset %kerneloff% --ramdisk_offset %ramdiskoff% %second_offset% --tags_offset %tagsoff% %dtb% -o image-new.img %errout%

fixes it, but (of course) breaks cmdlines that contain ' :rolleyes:

Is there anything you can think of that can encapsulate both? :confused:

Edit

: This batch article on StackOverflow doesn't seem hopeful... :eek:

But I might still figure out a way using delayed expansion and/or escape \'s for our particular case, we'll see... :fingers-crossed:

Edit 2

: Woot! Using a set string replacement command to swap out " for \" (which, just to make things more complicated, only works if the variable actually contains something, otherwise just sets the variable to your replacement string... dumb) actually works!

So, adding these after the echo'd output for cmdline and board, respectively, resolves the issue completely:

if defined cmdline set cmdline=%cmdline:"=\"%

if defined board set board=%board:"=\"%

:D:cowboy:
[Android Software Development] :
Very nice bro. I'm at work right now so I wasn't able to look into a solution. Knew you would resolve it though ;)
[Android Software Development] BOSSPDA:
Fixed

Thank's my friend

I made the fix, and the result is the zip uploaded.

Credits for you, my friend, for your remarkable work.
[Android Software Development] :
[MENTION=4544860]osm0sis[/MENTION], for linux/android the following will work

cmd_line=\"$cmd_line\"

However, I currently grab the cmd_line using:

cmd_line=$($od -A n -S1 -j 64 -N 512 $bootimg)

$od simply being the variable which has the path to od stored. Same with $bootimg.

Edit:

However, the following would be more proficient.

esq="'\"'\"'"

escaped_cmd_line=`echo $cmd_line | sed "s/'/$esq/g"`

cmd_line=\'$escaped_cmd_line\'
[Android Software Development] :
[MENTION=4544860]osm0sis[/MENTION], have you ever seen a recovery.img or boot.img with ANDROID! existing more than one time? That dudes image has it twice according to my personal project using:

offset=$($grep -abo ANDROID! $bootimg | $busybox cut -f 1 -d :)

The above command causes conflicts because it shows ANDROID! at offsets 0 and 14799049. I viewed his image using a Hex Editor and confirmed that there were in fact two locations for this lol.

See picture for a closer view. I applied set -x and set +x to see why the script kept showing errors and the answer was given clear as day. Crazy man lol.

Already fixed the issue by piping, head -1, to have grep grab only the first occurrence string that is matched.
[Android Software Development] osm0sis:
No, that's interesting! Is it part of the second bootloader/kernel section? That could make sense, and of course unpackbootimg, by design, would have no issues with it since it only checks the first 512kb for magic.
[Android Software Development] :
I believe it's part of the second bootloader to be honest but I never checked it out closely. Just not something I see everyday so it shocked me a bit ha!

I once upon a time used such binaries but since I am better at writing in Bash than C or C++ I take a different approach as it's easier for me to update on the fly and adapt to other unusual images like MediaTek. Need to brush up more on C and C++ though :-p.

Also tried escaping that long and crazy cmd line in his image but those double quotes kept giving me issues no matter how I tried to escape them. I had to use sed in a way that I barely could understand but know it works just to escape everything inside the cmd line by simply masking the outer double quotes with single quotes.

For starters, the cmd line is pulled by using:

cmd_line=$($od -A n -S1 -j 64 -N 512 $bootimg)

But to escape properly I had to use this:

cmd_line=$(echo $cmd_line | sed -e "s/'/'\\\\''/g; 1s/^/'/; \$s/\$/'/")

A bit intense but dang it, the job is taken care of lol.
[Android Software Development] osm0sis:
If there's a way to completely port unpackbootimg and mkbootimg to bash I'd love to adapt it for use in AnyKernel2 to make it binary-free, platform-independent and only reliant on recovery busybox. :D
[Android Software Development] :
That's the problem right there... Busybox... It lacks too much. :( I have had to compile some stuff for ARM just to make up for that. I have made my fair attempt at only using busybox but unfortunately failed. Such things as od, grep, xz, lzma, lz4, cpio, and gzip. Would love to eliminate all of those and strictly use busybox and what it has to offer. Someday, maybe lol.
[Android Software Development] h?2:
Hey,

thanks for the tools first of all! I am having difficulty using them though. I am doing a simple extract and then repack (no changes), it all reports well and the new image file is created:

% ./unpackimg.sh ~/cm-12-20150118-EXPERIMENTAL-JRUESGA-tf700t/boot.blob

Android Image Kitchen - UnpackImg Script

by osm0sis @ xda-developers

Supplied image: boot.blob

Removing old work folders and files...

Setting up work folders...

Splitting image to "split_img/"...

BOARD_KERNEL_CMDLINE

BOARD_KERNEL_BASE 10000000

BOARD_NAME

BOARD_PAGE_SIZE 2048

BOARD_KERNEL_OFFSET 00008000

BOARD_RAMDISK_OFFSET 01000000

BOARD_TAGS_OFFSET 00000100

Unpacking ramdisk to "ramdisk/"...

Compression used: gzip

2622 blocks

Done!

hannes2@debian ~/Downloads/AIK-Linux % ./repackimg.sh

Android Image Kitchen - RepackImg Script

by osm0sis @ xda-developers

Packing ramdisk...

Using compression: gzip

Getting build information...

kernel = boot.blob-zImage

cmdline =

board =

base = 10000000

pagesize = 2048

kernel_offset = 00008000

ramdisk_offset = 01000000

tags_offset = 00000100

Building image...

Done!

However it has a different md5 than the original, but similar size (not critical maybe). If I want to flash it to the device (Transformer Pad Tf700t), I get:

# fastboot flash boot image-new.img
sending 'boot' (4960 KB)...
OKAY [ 1.545s]
writing 'boot'...
OKAY [ 2.361s]
finished. total time: 3.906s

Still looking good, BUT then the device hangs. I can hard reboot it, but nothing new is applied, still old kernel and ramdisk. I also tried:

# fastboot boot image-new.img
downloading 'boot.img'...
OKAY [ 1.548s]
booting...
FAILED (remote: ()
finished. total time: 1.569s

but as you can see that doesn't work. Trying the kernel and the initram seperately doesnt work either:

# fastboot boot split_img/boot.blob-zImage ramdisk-new.cpio.gz
creating boot image...
creating boot image - 5079040 bytes
downloading 'boot.img'...
OKAY [ 1.563s]
booting...
FAILED (remote: ()
finished. total time: 1.581s

Any hints on what I could do? The original file is from a cm12-snapshot. If you want to I can upload it somewhere...

Thanks a lot for your help!
[Android Software Development] osm0sis:
Absolutely upload, per usual; I can't fly blind.
[Android Software Development] h?2:
I am not at my home computer rightnow, but the file is the boot.img from this zip:

http://xdaforums.com/devdb/project/dl/?id=10693

Thanks for your help!
[Android Software Development] osm0sis:
As soon as I saw ".blob" I had some suspicions that might somehow be why, and it seems I was correct.

"-SIGNED-BY-SIGNBLOB-........MSM-RADIO-UPDATE....<...<...................................LNX.L..." is the first chunk of the .blob, the rest is otherwise standard .img format which is why it unpacks (the ANDROID! magic is in the first 512kb so it's all no problem for the tools). You'll have to find a way to "signblob" the resulting file, or you could try copying the header over from the original to the new one using a hex editor to see if your bootloader will accept it.
[Android Software Development] :
Copying it over should do the trick. HTC devices have their own crap before the standard magic header and can confirm it works in that aspect. At least with HTC devices, but I see no reason why this wouldn't work for him either.
[Android Software Development] osm0sis:
Just checked into it, and AIK-mobile handles it well already, so no fix needed; must be the cat keeping it encapsulated in the variable, or just the way Linux handles expanding variables better than Windows.

Edit: AIK-Linux works as well. :good: :)
[Android Software Development] themonyo666:
how to unlock bootloader of asus zenfone 2 500cl ? can i use this to unlock it?
[Android Software Development] bombadier:
This thread is not for unlocking bootloaders

Go to the Zenphone 2 section of xda

http://xdaforums.com/zenfone2/general/congrats-to-bootlocker-unlocked-t3138547
[Android Software Development] themonyo666:
sorry my bad :p
[Android Software Development] Khaon:
@osm0sis

While porting your AIK for AK2, I ran into the following issue:

$bin/file -m $bin/magic *-ramdisk.gz | cut -d: -f2 | cut -d" " -f2

outputs:

LZ4

you specified this:

case $ramdiskcomp in
gzip) compext=gz;;
lzop) compext=lzo;;
xz) ;;
lzma) ;;
bzip2) compext=bz2;;
lz4) unpackcmd="$bin/$arch/lz4 -dq"; extra="stdout";;

BTW, I am using latest lz4 revision built.

Well I just add to switch lz4) to LZ4) obliviously
[Android Software Development] :
Could you send me your image that uses lz4 compression? Would be appreciated.
[Android Software Development] Khaon:
Surely I attached it.

I don't have the issue with AIK linux tho. It displays correctly lz4 instead of LZ4
[Android Software Development] osm0sis:
You need to use my custom magic file. It has some case changes to make things uniform and I removed some duplicate entries, and only used relevant parts of the magic source files that apply to Android to keep it small.
[Android Software Development] Khaon:
Yeah dunno how the heck I ended up using xiaolu's magic file!
[Android Software Development] :
It isn't his lol, it is mine under the ARM directory which I maintain for use on ARM and Linux alike. Xialou doesn't use file or magic for his part of the project. I did not make any changes to magic.mgc like [MENTION=4544860]osm0sis[/MENTION] did for his. So for mine, lzma, xz, and lz4 are reported back capitalized instead of lowercase and is handled accordingly for my part of the project.
[Android Software Development] Khaon:
Okay, thanks for the explanation ;), makes more sense.

Should have paid more attention to your raw code then.
[Android Software Development] lucainno:
bootloop

hello please i have bootloop in s4 mini i9195 with porting miui7.

was line modified for botting miui7 in galaxy s4 mini?

thanks
[Android Software Development] osm0sis:
Here are some bugfix releases with all the (minor) changes from the AOSP Marshmallow code dump and a few picks from CM. Unfortunately no Android x64 support yet since I don't know of any busybox providers building it. Also, AIK-mobile is still using file 5.20; 5.25 is now out but continues to have seg faults. I'll have to see about joining their mailinglist again to report it like I did last time it was an ongoing issue. ;)

Downloads of AIK-mobile and -Linux have remained steady over double the amount of time (ie. double the downloads). Thanks all! :D

PSA: Several reports have confirmed AIK-Linux only works with Marshmallow kernels when it has root. As a workaround, please use sudo to run the scripts and edit the ramdisk until I can work out a solution for the next release. Thanks [MENTION=5501864]USBhost[/MENTION] and [MENTION=3209971]cam30era[/MENTION]. An interim build, AIK-Linux v1.9.1, is now available, incorporating mkbootfs to correct this.

Android Image Kitchen v2.3:

- Fix for repacking with kernel cmdline containing quotes.

- Update slimmed magic file (from file 5.25) with my own fixes.

- Update mkbootimg and mkbootfs binaries from my repos.

- Update to the latest Cygwin binaries and libraries.

AIK-mobile v1.9 + AIK-Linux v1.9:

- Update slimmed magic file (from file 5.25) with my own fixes.

- Update mkbootimg binary from my repo.

- Update mkbootfs binary from my repo (AIK-mobile).

- Update xz binary (5.2.2) (AIK-mobile).

- Update lz4 binary (r131).

More on my own build changes in the commits here: https://github.com/osm0sis/mkbootimg; https://github.com/osm0sis/mkbootfs.

Installation information and details on each edition can be found in the OP for Win32 or 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] zezinhocrack:
Dear programmers ,

There are days I'm working on the boot.img ZD551KL unsecure ( Zenfone Selfie ) , I'm using the Android Kitchen Win32 ( Zenfone 2 version) , but after changing default.prop and to repack the ramdisk , where do fastboot flash via the device enters bootloop , I realized that the new file is 4KB smaller than the original , do not know if the fact of using a tool for win32 should not be the best way .

Some device information :

Snapdragon 615

Android 5.0.2

64bit support
[Android Software Development] USBhost:
[MENTION=4544860]osm0sis[/MENTION]

BUG on AIK-Linux v1.x

if i unpack a boot.img

then repack it (changing nothing)

then boot/flash it on my device

it rebootes to recovery

only on android marshmallow boot.imgs

nexus 9

nexus player

Attach File is the nexus player's stock boot.img
[Android Software Development] osm0sis:
Does it work on AIK-mobile?
[Android Software Development] USBhost:
Just tested and it does work