[TOOL][UTILITY] Carliv Image Kitchen for Android - unpack/repack boot-recovery

Status
Not open for further replies.
Search This thread

bluefirebird

Senior Member
Mar 23, 2013
1,027
5,034
carliv.eu
attachment.php


Hi, I present you my tool for unpacking/repacking boot and recovery images for Android phones: Carliv Image Kitchen for Android.

2016-06-30 Update to version 1.3 stable
Changelog:
- detect mtk header during unpacking;
- removed grep method;

Instructions can be found in every variant folder.

To start it just double click on carliv.bat script (windows) or carliv script (Linux) then choose "Run in terminal" from dialog box.

attachment.php
attachment.php




Credits:
yuweng for his assistance and help on testing and troubleshooting (you should thank him too guys - it was a great help);
michfood for initial starting ideea;
osm0sis for bootimg-info source and some hints from his kitchen;
Cyanogenmod for mkbootimg source folder;
Omnirom for their clean implementation of MTK header.
Pete Batard for bootimage tools windows fix.
Thomas Polaert ([email protected]) for CECHO DOS coloring tool (windows version).

If you want to share this in other websites, blogs or forums please keep the credits from script files (I wrote those from scratch), and give proper credits for me.


Contributors
carliv, yuweng
 
Last edited:

bluefirebird

Senior Member
Mar 23, 2013
1,027
5,034
carliv.eu
Drag & Drop on linux CarlivImageKitchen version! function implemented by yuweng

Alternative linux version with Drag and Drop functionality, modded by my friend yuweng! -* carliv's edit: copied here from my friend's post.

Yes, now you can also Drag&Drop to UnPack/ RePack Android images on linux using CarlivImageKitchen !
brows_zpsda58f2fa.gif

Download CarlivImageKitchen-DnD.zip & extract to your linux Desktop, copy out all the five .desktop files to your Desktop & start Dragging & Dropping . . . :laugh: You can also Drag&Drop it to same .desktop files inside CarlivImageKitchen folder & it'll to work too . . . :good:

Tested working perfectly on BBQLinux & also Ubuntu, however, for Ubuntu you need to open the .desktop launcher shortcut with any text editor & manual edit the command as below . . .
Code:
[COLOR="Blue"]gnome-terminal[/COLOR] -e "bash -c \"~/Desktop/CarlivImageKitchen/image_info %f\""
i have also tested it on numerous of linux terminal program & it works perfectly too so you gotta manual edit it if you are using those . . . :good:
Code:
[URL="https://launchpad.net/terminator"]terminator[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
[URL="https://konsole.kde.org/"]konsole[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/unpack_MTK_img %f""
[URL="http://mate-desktop.org/#mate-terminal"]mate-terminal[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
[URL="http://en.wikipedia.org/wiki/GNOME_Terminal"]gnome-terminal[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/repack_MTK_img %f""
[URL="http://wiki.lxde.org/en/LXTerminal"]lxterminal[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
[URL="http://roxterm.sourceforge.net/"]roxterm[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
[URL="https://www.enlightenment.org/p.php?p=about/terminology"]terminology[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/repack_img %f""
[URL="https://launchpad.net/sakura"]sakura[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
[URL="http://en.wikipedia.org/wiki/Xterm"]xterm[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
[URL="http://en.wikipedia.org/wiki/Terminal_(Xfce)"]xfce4-terminal[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/unpack_img %f""

No more typing to unpack/ repack, just draaaagggg & drooooopppp it like you use to do that on Windows . . . :laugh:

Full credits to Master Shifu Carliv, i just modded a few lines to support Drag&Drop, that's all . . . :eek:

Drag&Drop in Action !


Konsole_zpsowqyjhiv.png

Konsole

ROXTerm_zps1azcq0mb.png

roxterm

sakura_zpslu92dfuu.png

sakura

gnome-terminal_zpsgdofxzcw.png

gnome-terminal

LXTerminal_zpsfqooarci.png

lxterminal

mate-terminal_zpsr5so7bfo.png

mate-terminal

xterm_zpsvat5yezm.png

xterm

terminator_zpsxpivpoaj.png

terminator

Terminology_zpswsg30kdi.png

terminology

xfce4-terminal_zpsktybn2fv.png

xfce4-terminal

If you want to hit the THANKS button for yuweng's version, go here and do it.
 

Attachments

  • CarlivImageKitchen-Linux-DnD-yuweng.zip
    117.3 KB · Views: 30,320
Last edited:

bluefirebird

Senior Member
Mar 23, 2013
1,027
5,034
carliv.eu
Mirror Downloads

2015-04-08 Big Update to version 1.0 stable
Changelog:
- corrected few issues in scripts;
- rebuilt all modules also to correct some issues;
- cleaned up the source;
- added more compression support - see next;
- now the kitchen supports ramdisks compressions as following: gz, bz2, lzma, xz, lzo, lz4;
- converted to a Menu driven interface: now everything can be done from inside kitchen menu with few clicks;
- updated Instructions (can be loaded in kitchen interface for reading).

* for those of you who don't want the menu interface, there is version 0.5 in download list, with the old individual scripts structure but updated with same modules and compression support as version 1.0 (I kept this especially for windows, where it can be used with drag and drop).

2015.02.16 Update version 0.3
  • rebuilt binaries to correct few issues.
  • some fixes in scripts.
  • generate correct sha id.
  • use minigzip for repacking ramdisk as in recovery building.
  • compiled standalone bzip2 module.

So, what's this?
It's a utility (tool) for unpacking and repacking boot and recovery images for many kind of android phones. I made two versions, one for windows users and one for linux users. The windows version works by dragging&dropping over the script you want to use, while the linux version will work with terminal commans (very simple commands though).
What's inside?
For windows version the scripts are batch files and for linux bash files, but the names are the same and they do same thing:
  1. clear_all will clear the working folder deleting any unpacked boot/recovery folder, but not the boot or recovery files (original or repacked).
  2. image_info will print on screen all informations about the image you want to check (sizes, offsets, cmdline, etc.) and all these infos will be saved in a text file (which will be deleted when you clear the folder - see point 1). This is handy if you don't want to unpack the image, but only to see its infos. This script works for all kind of images (not specific to a hardware platform).
  3. unpack_img is the script for unpacking images for all kind of phones with different platforms (qcom, exynos,...) but not MTK. It will work I think for AndroidOne project phones.
  4. unpack_MTK_img is the script for unpack any MTK image, including the ones from new platforms (mt6595, mt6752, mt6753, and whatever they are).
  5. repack_img is the repacking script for regular (non-MTK) phones.
  6. repack_MTK_img is the repacking script for all MTK boot/recovery images.
Besides these in Utility folder there is a bin folder (hidden) with all executables needed by the scripts.
How to use it?
As I said, for windows just drag&drop an image (boot or recovery) you want to unpack over the corresponding script, and drag&drop the folder of the unpacked image over the repacking script when you want to repack it. Choose the scripts with MTK in name for MTK images, and the other ones for any other kind.
For linux open a terminal window in CarlivImageKitchen folder and type (or just copy/paste from here) the commands:
Code:
./unpack_img boot.img
or
Code:
./unpack_MTK_img recovery.img
or what name has your image.
To repack type like this:
Code:
./repack_img recovery
or
Code:
./repack_MTK_img boot
and so on.
NOTICE here for repacking just type the name of the folder, without slashes.

Important, my utility doesn't have any request for position on partitions or directories. In testes worked in a third sub-sub-subfolder on an external partition (both in linux and windows), and it proves to work with any kind of name (except special characters that may break the script), including spaces or dots in folders names, but I recommend you to use dashes or underscores instead of spaces, and avoid dots. In repacking procedure, the script will prompt you to introduce a name for the new image, and if it will contain dots or spaces you will see an error. Also the name must include the type of image (boot or recovery) - Eg: "boot-stock-repack" or "recovery_cwm_m7", and without the extension (.img).
Same condition about names applies for images you want to unpack; if they have other names, like "cwm-m7.img", rename it including the type of image in name: eg "recovery-cwm-m7.img". Why this? As many of you used bgcngm's tool you noticed he asked for including an argument in script command ("-boot" or "-recovery") because this is the way his script can apply the right header for ramdisks in repacking. My tool does that from image name and you don't have to add extra arguments in command.
A second note: This tool doesn't support Rockchip Android images.
What's under hood?
All modules used in my tools are compiled by me, both for windows and linux.
Also for windows, because it requires few cygwin libraries to work with compressing/uncompressing executables, I used those libraries and executables from latest cygwin release (gzip, xz, bzip2, cpio and the corresponding dlls).
But my utility doesn't require a cygwin installed. Well, linux version worked very well in cygwin environment, but it's not necessary since I provided a standalone windows version.
The executable modules:
  1. imageinfo - a initial source is shared by osm0sis here, but I used that only for inspiration because I liked the ideea; I used the unpackbootimg from cyanogenmod 12, system/core/mkbootimg and modded to get a similar output as in osm0sis bootimg-info.
  2. mkbootfs - built in cygwin for windows and normal in linux. I used the "stock" source from cyanogenmod 12 /system/core/cpio.
  3. mkbootimg - based cyanogenmod 12 source, but modded, and for windows fixed to work (the standard source it builds in windows but doesn't work). I used for fixing the ideeas from Pete Batard's source. This module repack also dtb-images back to repacked image.
  4. mtkbootimg - same as mkbootimg, but with additions from omnirom code for MTK, to append the MTK header to this kind of images. This one will check first the kernel and then the ramdisk for MTK header, and if it's not there it will append it, but if it's there will skip.
  5. unpackbootimg - from same cyanogenmod 12 source, with few extra additions by me.
  6. unpackmtkimg - same as unpackbootimg but adapted for MTK images, for which will strip the header off before unpacking, to be easy to work with.
For windows I used jeremejevs cmdcolor source to build a module which add colors in cmd console, for a pleasant experience.
All these sources are modified, improved and fixed in some aspects.

Why I did it?
Well, the trigger was the apparition of the new platforms from MTK, which didn't worked with any of the old tools. First who found out what's changed was mrjavum. Starting from his findings I explored more, and then provided the update ideea and binaries for bgcngm's tool. But that is only for linux. I know it can be used in windows with cygwin, but we had a standalone tool, michfood's tool, which now doesn't work with the new platforms.
So I started to think for a new utility for windows to solve that need. After I did it I thought I can do it for linux too even if there exists already bgcngm's tool and works great. And I made it not only for MTK phones.
That's the reason I called it Image Kitchen. It is like a tool that combines michfood's tool with osm0sis Kitchen, and serves for different platforms (I tested MTK, Qualcomm, Exynos, with or without dtb, and all worked great). But it's first release, not fully tested (I don't have all kind of phones for that), and so it is marked beta.[/HIDE]

Cygwin-windows version
Removed since it was only for some specific testing, and anyway the windows version now works and it shows exactly the same with linux, producing same result.
 

Attachments

  • logo.png
    logo.png
    30.6 KB · Views: 56,094
Last edited:

iZLeeP

Senior Member
Jan 23, 2014
528
151
Manila
This is great! No need to shuffle programs for unpacking/repacking boot and recovery images of various platforms.

Windows version working (MTK and non-MTK).

Tried to use the Linux version in cygwin and encountered the following errors:
 

Attachments

  • CIKA.jpg
    CIKA.jpg
    81.1 KB · Views: 2,715

yuweng

Senior Member
Feb 5, 2012
1,172
4,221
There are already separate package for Windows & Linux so use the appropriate package however for beta-testing sake . . . :cowboy:
  1. Copy all the *.exe from Windows package -> hidden folder bin to Linux .bin folder.
  2. Add the extension exe to all linux binary at the script
Eg.
gzip -> gzip.exe
mkbootfs -> mkbootfs.exe
unpackmtkimg -> unpackmtkimg.exe
mtkbootimg -> mtkbootimg.exe

unpackbootimg -> unpackbootimg.exe
mkbootimg -> mkbootimg.exe
Now the linux script will work on cygwin . . . :cool:
 

iZLeeP

Senior Member
Jan 23, 2014
528
151
Manila
Thanks for the suggestion.

Now, unpack (MTK and non-MTK) works but repack does not. The repacked image is much smaller in size than that of the original. It also produces errors when I unpack the repacked image.
 

Attachments

  • Untitled1.jpg
    Untitled1.jpg
    79.4 KB · Views: 2,144
  • Untitled2.jpg
    Untitled2.jpg
    79.9 KB · Views: 2,062
  • Untitled3.jpg
    Untitled3.jpg
    89.1 KB · Views: 1,969
  • Untitled4.jpg
    Untitled4.jpg
    91.1 KB · Views: 1,487

bluefirebird

Senior Member
Mar 23, 2013
1,027
5,034
carliv.eu
Thanks for the suggestion.

Now, unpack (MTK and non-MTK) works but repack does not. The repacked image is much smaller in size than that of the original. It also produces errors when I unpack the repacked image.

If you want to test it in cygwin you need to add all binaries from windows bin with exe extension except dlls (those are native) and compressing modules, and to replace those from linux. You can see in linux version all compressing modules are missing - they have to be installed in system. Same for cygwin. It's possible you got a cygwin with some packages missing. That error message you see is because it's missing cpio probably. The linux binaries are much smaller because the compiler works different in linux. In windows the modules are standalone and don't need any dll, except those for archiving from cygwin, but we are not talking about those.
Anyway what you do here is just cross testing, and you don't need to use linux version in windows because windows version works the same.
 

iZLeeP

Senior Member
Jan 23, 2014
528
151
Manila
If you want to test it in cygwin you need to add all binaries from windows bin with exe extension except dlls (those are native) and compressing modules, and to replace those from linux. You can see in linux version all compressing modules are missing - they have to be installed in system. Same for cygwin. It's possible you got a cygwin with some packages missing. That error message you see is because it's missing cpio probably. The linux binaries are much smaller because the compiler works different in linux. In windows the modules are standalone and don't need any dll, except those for archiving from cygwin, but we are not talking about those.
Anyway what you do here is just cross testing, and you don't need to use linux version in windows because windows version works the same.

Yes, I was just testing the functionality of the linux version in cygwin. As I don't have linux here (office), I use cygwin instead. I'll re-download full cygwin package and test again. Nonetheless, I have no problems with the windows version (tested in Vista and 7). I'll try it on XP at home.
 

bluefirebird

Senior Member
Mar 23, 2013
1,027
5,034
carliv.eu
Yes, I was just testing the functionality of the linux version in cygwin. As I don't have linux here (office), I use cygwin instead. I'll re-download full cygwin package and test again. Nonetheless, I have no problems with the windows version (tested in Vista and 7). I'll try it on XP at home.

It's ok, but you have to be carefull to search manually for some packages, because depending from what mirror you install cygwin, they may be there or not. This situation is very well exposed in cygwin forums. When I built mkbootfs in cygwin for windows the compiler complains for few missing packages and I had to add them one by one searching online in cygwin packages. Some of them were on mirrors.kernel.org and some on cygwin.cybermirror.org. In any other mirror site they were missing. Same for compression packages: xz was only in mirrors.kernel.org. When you install cygwin you don't see any message of something not being there.
Or maybe I don't know how to work with cygwin, I don't know...
 

iZLeeP

Senior Member
Jan 23, 2014
528
151
Manila
It's ok, but you have to be carefull to search manually for some packages, because depending from what mirror you install cygwin, they may be there or not. This situation is very well exposed in cygwin forums. When I built mkbootfs in cygwin for windows the compiler complains for few missing packages and I had to add them one by one searching online in cygwin packages. Some of them were on mirrors.kernel.org and some on cygwin.cybermirror.org. In any other mirror site they were missing. Same for compression packages: xz was only in mirrors.kernel.org. When you install cygwin you don't see any message of something not being there.
Or maybe I don't know how to work with cygwin, I don't know...

It's working now after updating cygwin. If I recall correctly, I used dsixda's instructions on how to setup cygwin for kitchen. The procedure required to install additional packages including cpio. Maybe, the files were just outdated since I had this last 2011.
 

bluefirebird

Senior Member
Mar 23, 2013
1,027
5,034
carliv.eu
Fantabulous Work Sir :good: Going To Test it :D
Sir i Think, Michfood's Recovery/Boot UnPacker/Repacker Tool Don't Need This... Right?

Yes, you're right, but his tool uses a different method. It stores the ramdisk and kernel headers on unpack in separate files and add them back for repack. My tool strip off the headers on unpack and will recreate them during repack and it need that info to determine wich header to add for ramdisk (ROOTFS or RECOVERY). :)
 

EnerJon

Senior Member
Jan 29, 2014
350
212
Yes, you're right, but his tool uses a different method. It stores the ramdisk and kernel headers on unpack in separate files and add them back for repack. My tool strip off the headers on unpack and will recreate them during repack and it need that info to determine wich header to add for ramdisk (ROOTFS or RECOVERY). :)

Got it, So Michfood's Tool Just Extracts The Headers Of The IMG File While UnPacking And Adds Them Back As it is, This Way it Don't Need To Take Care Of The IMG Type Because The Type Of Output IMG Automatically Becomes Same as input IMG in The End...
But Your Tool Needs To Know The Type Of IMG Because it Creates Those Headers By itself... Hmm, But Sir, i Don't Understand One Thing, What's Wrong With Extracting And Adding Same Headers As input IMG File?

i Think, You/OmniROM DEVs Did This To Make Boot.img Usable As Recovery.img Or Vice Versa? Thats The Only Reason Comes in My Mind :rolleyes:
 

bluefirebird

Senior Member
Mar 23, 2013
1,027
5,034
carliv.eu
Got it, So Michfood's Tool Just Extracts The Headers Of The IMG File While UnPacking And Adds Them Back As it is, This Way it Don't Need To Take Care Of The IMG Type Because The Type Of Output IMG Automatically Becomes Same as input IMG in The End...
But Your Tool Needs To Know The Type Of IMG Because it Creates Those Headers By itself... Hmm, But Sir, i Don't Understand One Thing, What's Wrong With Extracting And Adding Same Headers As input IMG File?
i Think, You/OmniROM DEVs Did This To Make Boot.img Usable As Recovery.img Or Vice Versa? Thats The Only Reason Comes in My Mind :rolleyes:

The original MTK module (mkimage) - which source is not published (I never find it anywhere), append the right header during build of a ROM, and that's for boot - ROOTFS and for recovery - RECOVERY (on ramdisk). Omnirom code will add ROOTFS to any ramdisk, and same is the code from dsixda kitchen. This may be fine and may work in some phones, but I wanted to do it the right way, as in bgcngm's tool - because of the new MTK platforms. So I changed the source code to do it as I wanted, and instead of an extra argument I'm using just the name of image. I think it's not that hard to name the new image boot-something or something-boot-something or somethingboot, etc - same for recovery.
And for extracting old headers it's nothing wrong and it's easy to do it, but for adding back it needs an extra module (michfoods use sfk166 - now I think it reached version 173) and I wanted to reduce the number of binaries involved.
And again, really, I think my method with adding the name for newly created image is better.
 
Last edited:

EnerJon

Senior Member
Jan 29, 2014
350
212
Thanks For The info Sir, Yes, its Not That Hard To Rename it, Actually i Work With Dozens Of IMGs, But No Worries, its Just a One Time Process... Previously Michfood's Boot/Recovery RePacking Tool Was Not Working if i Try To RePack The IMGs Made With Sir Yuweng's Easy Magic Tool... But Your Tool Has No Such issues... Thank You Very Much For This Great Tool :highfive:

i Just Tested it And its Working Perfectly Fine For My Qmobile-A900 (Gionee Elife E3)

Just a Suggestion:
instead Of Asking User To input Final IMG Name, The Tool Should Automatically Expand The File Name By Adding "_NEW"

For Example:
Original IMG Name ===> MyStockBoot.img
1st Modified IMG Name ===> MyStockBoot_NEW.img
2nd Modified IMG Name ===> MyStockBoot_NEW_NEW.img
3rd Modified IMG Name ===> MyStockBoot_NEW_NEW_NEW.img

The Code Of You Tool Seems To Be Very Clean, And Handles The Errors Very Well :good:
 
  • Like
Reactions: bluefirebird

bluefirebird

Senior Member
Mar 23, 2013
1,027
5,034
carliv.eu
.....Thank You Very Much For This Great Tool :highfive:
i Just Tested it And its Working Perfectly Fine For My Qmobile-A900 (Gionee Elife E3)
Just a Suggestion:
instead Of Asking User To input Final IMG Name, The Tool Should Automatically Expand The File Name By Adding "_NEW"
.... The Code Of You Tool Seems To Be Very Clean, And Handles The Errors Very Well :good:

Thanks, I worked quite a bit to make it that way because I do like clean and easy to read codes - easy to spot errors :laugh:
First test version was as you suggest without asking for a name and everything done automatic, but when I send it to my friend yuweng to test it, he came out with the ideea to ask user for the name and I think it's a good ideea and I added that prompt; this way you can repack same image with little modifications again and again, for tests purposes or other, and give related names, like boot-1, boot-2, or recovery-1, etc. In automated method for such things it needs to rename the new repacked image or the unpacked folder and at the end it creates more troubles than current method.
 
Last edited:

EnerJon

Senior Member
Jan 29, 2014
350
212
Hello Sir, i Wanted To Share My Modding Of Your Tool For Better Compression, i Also Did This Long Time Ago With Michfood's Tool, And it Works Effectively... By Doing This, Final Output IMG Can Be More Than 100KB Smaller Compared To Previous IMG Output... Which is a Releaf For 6MB Recovery/Boot Partition Devices...

For This, We Need 7zip Command Line Tool
By Downloading And Extracting "7za" Executable into The BIN Folder Of Your Tool And Modding Your Tool's RePack Script File, We Can Achieve Better Compression For GZIP'ed RAMDISKs...

Original repack_MTK_img.bat
Code:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::                                                    :::
:::          Carliv Image Kitchen for Android          :::
:::   boot+recovery images copyright-2015 [email protected]   :::
:::   including support for MTK powered phones images  :::
:::                                                    :::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
cd %~dp0
IF EXIST "%~dp0\bin" SET PATH=%PATH%;"%~dp0\bin"
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal enabledelayedexpansion
set "red=\033[91m"
set "cyan=\033[96m"
set "yellow=\033[93m"
set "deft=\033[0m"    
echo(    
echo **********************************************************
echo *                                                        *
echo *         %cyan%Carliv Image Kitchen for Android %deft%v0.1          * | klr
echo *     boot+recovery images copyright-2015 %cyan%[email protected]%deft%     * | klr
echo *    including support for MTK powered phones images     *
echo *                     WINDOWS version                    *
echo *            The repacking MTK images script             *
echo *                                                        *
echo **********************************************************
echo(
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if "%~nx1" == "" goto noinput
echo You have selected the%yellow% %~nx1 %deft%folder. | klr
echo(
echo Processing the%yellow% %~nx1 folder%deft%. | klr
echo(
set "folder=%~nx1"
icacls %folder% /grant Everyone:(IO)(CI)
cd %folder%
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo(
echo Repacking the image....
echo(
for /f "delims=" %%a in ('dir /b *-kernel') do @set nfile=!nfile!%%~na
set "file=%nfile%"
if not exist "%file%.img-kernel" goto error
set kernel=!kernel!%file%.img-kernel
echo The kernel is:%yellow%         %kernel%%deft% | klr
echo(
echo Getting the ramdisk compression....
echo(
if not exist "ramdisk" goto error
for /f "delims=" %%a in (%file%.img-ramdisk-compress) do @set compress=!compress!%%a
echo Ramdisk compression:%yellow% %compress%%deft% | klr
goto %compress%
echo(
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:gz
echo(
[COLOR="Red"]mkbootfs ramdisk | gzip > %file%.img-ramdisk.gz[/COLOR]
set ramdisk=!ramdisk!%file%.img-ramdisk.gz
echo The ramdisk is:%yellow%      %ramdisk%%deft% | klr
goto repack
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:lzma
echo(
mkbootfs ramdisk | xz -Flzma > %file%.img-ramdisk.lzma
set ramdisk=!ramdisk!%file%.img-ramdisk.lzma
echo The ramdisk is:%yellow%      %ramdisk%%deft% | klr
goto repack
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:xz
echo(
mkbootfs ramdisk | xz -1 -Ccrc32 > %file%.img-ramdisk.xz
set ramdisk=!ramdisk!%file%.img-ramdisk.xz
echo The ramdisk is:%yellow%      %ramdisk%%deft% | klr
goto repack
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:bz2
echo(
mkbootfs ramdisk | bzip2 > %file%.img-ramdisk.bz2
set ramdisk=!ramdisk!%file%.img-ramdisk.bz2
echo The ramdisk is:%yellow%      %ramdisk%%deft% | klr
goto repack
echo(
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:repack
echo(
echo Getting the image repacking arguments....
echo(
if not exist "%file%.img-board" goto noboard
for /f "delims=" %%a in (%file%.img-board) do @set nameb=!nameb!%%a
echo Board:%yellow%             '%nameb%'%deft% | klr
echo(
:noboard
if not exist "%file%.img-base" goto nobase
for /f "delims=" %%a in (%file%.img-base) do @set base=!base!%%a
echo Base:%yellow%              %base%%deft% | klr
echo(
:nobase
for /f "delims=" %%a in (%file%.img-pagesize) do @set pagesize=!pagesize!%%a
echo Pagesize:%yellow%          %pagesize%%deft% | klr
echo(
if not exist "%file%.img-cmdline" goto nocmdline
for /f "delims=" %%a in (%file%.img-cmdline) do @set scmdline=!scmdline!%%a
echo Command line:%yellow%      '%scmdline%'%deft% | klr
echo(
:nocmdline
if not exist "%file%.img-kernel_offset" goto nokoff
for /f "delims=" %%a in (%file%.img-kernel_offset) do @set koff=!koff!%%a
echo Kernel offset:%yellow%     %koff%%deft% | klr
echo(
:nokoff
if not exist "%file%.img-ramdisk_offset" goto noramoff
for /f "delims=" %%a in (%file%.img-ramdisk_offset) do @set ramoff=!ramoff!%%a
echo Ramdisk offset:%yellow%    %ramoff%%deft% | klr
echo(
:noramoff
if not exist "%file%.img-second_offset" goto nosecoff
for /f "delims=" %%a in (%file%.img-second_offset) do @set fsecoff=!fsecoff!%%a
echo Second offset:%yellow%     %fsecoff%%deft% | klr
set secoff=--second_offset %fsecoff%
echo(
:nosecoff
if not exist "%file%.img-second" goto nosecd
set fsecd=!fsecd!%file%.img-second
echo Second bootloader:%yellow% %fsecd%%deft% | klr
set "second=--second %fsecd%"
echo(
:nosecd
if not exist "%file%.img-tags_offset" goto notagoff
for /f "delims=" %%a in (%file%.img-tags_offset) do @set tagoff=!tagoff!%%a
echo Tags offset:%yellow%       %tagoff%%deft% | klr
echo(
:notagoff
if not exist "%file%.img-dt" goto nodt
set fdt=!fdt!%file%.img-dt
echo Device tree blob:%yellow%  %fdt%%deft% | klr
set "dtb=--dt %fdt%"
echo(
:nodt
echo(
:newimage
echo Please enter the desired name for the new repacked image without extension (img). Like this %yellow%boot%deft%-stock-2201 or carliv-%yellow%recovery%deft%-30 or %yellow%boot%deft%-new. | klr
set /P newimage=Insert the name here: || set newimage="0"
if "%newimage%"=="0" goto noimage
if not "%newimage%"=="%newimage:boot=%" goto command
if not "%newimage%"=="%newimage:recovery=%" goto command
goto wrongname
echo(
:command
echo Your new image is%yellow% %newimage%.img%deft%. | klr
echo(
echo Executing the repacking command....
echo(
mtkbootimg --kernel %kernel% --ramdisk %ramdisk% --pagesize %pagesize% --base %base% --board "%nameb%" --kernel_offset %koff% --ramdisk_offset %ramoff% --tags_offset %tagoff% %second% --cmdline "%scmdline%" %secoff% %dtb% -o ..\%newimage%.img
del "%file%.img-ramdisk.%compress%"
cd ..\
echo(
echo(
echo Done. Your new image was repacked as%yellow% %newimage%.img%deft%. | klr
goto end
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:noinput
echo(
echo(
echo %red%No folder selected. Exit script.%deft% | klr
echo(
goto end
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:wrongname
echo(
echo(
echo %red%The name have to include the type of image in it, %yellow%boot%red% or%yellow% recovery%red%.%deft% | klr
echo(
goto newimage
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:noimage
echo(
echo(
echo %red%Please enter a name for the repacked image first.%deft% | klr
echo(
goto newimage
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:error
echo(
echo(
echo %red%There is an error in your folder. The kernel or ramdisk is missing. Exit script.%deft% | klr
echo(
echo(
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:end
echo(
pause

Modded repack_MTK_img.bat
Code:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::                                                    :::
:::          Carliv Image Kitchen for Android          :::
:::   boot+recovery images copyright-2015 [email protected]   :::
:::   including support for MTK powered phones images  :::
:::                                                    :::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
cd %~dp0
IF EXIST "%~dp0\bin" SET PATH=%PATH%;"%~dp0\bin"
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal enabledelayedexpansion
set "red=\033[91m"
set "cyan=\033[96m"
set "yellow=\033[93m"
set "deft=\033[0m"    
echo(    
echo **********************************************************
echo *                                                        *
echo *         %cyan%Carliv Image Kitchen for Android %deft%v0.1          * | klr
echo *     boot+recovery images copyright-2015 %cyan%[email protected]%deft%     * | klr
echo *    including support for MTK powered phones images     *
echo *                     WINDOWS version                    *
echo *            The repacking MTK images script             *
echo *                                                        *
echo **********************************************************
echo(
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if "%~nx1" == "" goto noinput
echo You have selected the%yellow% %~nx1 %deft%folder. | klr
echo(
echo Processing the%yellow% %~nx1 folder%deft%. | klr
echo(
set "folder=%~nx1"
icacls %folder% /grant Everyone:(IO)(CI)
cd %folder%
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo(
echo Repacking the image....
echo(
for /f "delims=" %%a in ('dir /b *-kernel') do @set nfile=!nfile!%%~na
set "file=%nfile%"
if not exist "%file%.img-kernel" goto error
set kernel=!kernel!%file%.img-kernel
echo The kernel is:%yellow%         %kernel%%deft% | klr
echo(
echo Getting the ramdisk compression....
echo(
if not exist "ramdisk" goto error
for /f "delims=" %%a in (%file%.img-ramdisk-compress) do @set compress=!compress!%%a
echo Ramdisk compression:%yellow% %compress%%deft% | klr
goto %compress%
echo(
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:gz
echo(
[COLOR="Blue"]mkbootfs ramdisk > %file%.img-ramdisk
7za a -tgzip -mx=9 %file%.img-ramdisk.gz %file%.img-ramdisk
del /F /Q %file%.img-ramdisk[/COLOR]
set ramdisk=!ramdisk!%file%.img-ramdisk.gz
echo The ramdisk is:%yellow%      %ramdisk%%deft% | klr
goto repack
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:lzma
echo(
mkbootfs ramdisk | xz -Flzma > %file%.img-ramdisk.lzma
set ramdisk=!ramdisk!%file%.img-ramdisk.lzma
echo The ramdisk is:%yellow%      %ramdisk%%deft% | klr
goto repack
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:xz
echo(
mkbootfs ramdisk | xz -1 -Ccrc32 > %file%.img-ramdisk.xz
set ramdisk=!ramdisk!%file%.img-ramdisk.xz
echo The ramdisk is:%yellow%      %ramdisk%%deft% | klr
goto repack
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:bz2
echo(
mkbootfs ramdisk | bzip2 > %file%.img-ramdisk.bz2
set ramdisk=!ramdisk!%file%.img-ramdisk.bz2
echo The ramdisk is:%yellow%      %ramdisk%%deft% | klr
goto repack
echo(
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:repack
echo(
echo Getting the image repacking arguments....
echo(
if not exist "%file%.img-board" goto noboard
for /f "delims=" %%a in (%file%.img-board) do @set nameb=!nameb!%%a
echo Board:%yellow%             '%nameb%'%deft% | klr
echo(
:noboard
if not exist "%file%.img-base" goto nobase
for /f "delims=" %%a in (%file%.img-base) do @set base=!base!%%a
echo Base:%yellow%              %base%%deft% | klr
echo(
:nobase
for /f "delims=" %%a in (%file%.img-pagesize) do @set pagesize=!pagesize!%%a
echo Pagesize:%yellow%          %pagesize%%deft% | klr
echo(
if not exist "%file%.img-cmdline" goto nocmdline
for /f "delims=" %%a in (%file%.img-cmdline) do @set scmdline=!scmdline!%%a
echo Command line:%yellow%      '%scmdline%'%deft% | klr
echo(
:nocmdline
if not exist "%file%.img-kernel_offset" goto nokoff
for /f "delims=" %%a in (%file%.img-kernel_offset) do @set koff=!koff!%%a
echo Kernel offset:%yellow%     %koff%%deft% | klr
echo(
:nokoff
if not exist "%file%.img-ramdisk_offset" goto noramoff
for /f "delims=" %%a in (%file%.img-ramdisk_offset) do @set ramoff=!ramoff!%%a
echo Ramdisk offset:%yellow%    %ramoff%%deft% | klr
echo(
:noramoff
if not exist "%file%.img-second_offset" goto nosecoff
for /f "delims=" %%a in (%file%.img-second_offset) do @set fsecoff=!fsecoff!%%a
echo Second offset:%yellow%     %fsecoff%%deft% | klr
set secoff=--second_offset %fsecoff%
echo(
:nosecoff
if not exist "%file%.img-second" goto nosecd
set fsecd=!fsecd!%file%.img-second
echo Second bootloader:%yellow% %fsecd%%deft% | klr
set "second=--second %fsecd%"
echo(
:nosecd
if not exist "%file%.img-tags_offset" goto notagoff
for /f "delims=" %%a in (%file%.img-tags_offset) do @set tagoff=!tagoff!%%a
echo Tags offset:%yellow%       %tagoff%%deft% | klr
echo(
:notagoff
if not exist "%file%.img-dt" goto nodt
set fdt=!fdt!%file%.img-dt
echo Device tree blob:%yellow%  %fdt%%deft% | klr
set "dtb=--dt %fdt%"
echo(
:nodt
echo(
:newimage
echo Please enter the desired name for the new repacked image without extension (img). Like this %yellow%boot%deft%-stock-2201 or carliv-%yellow%recovery%deft%-30 or %yellow%boot%deft%-new. | klr
set /P newimage=Insert the name here: || set newimage="0"
if "%newimage%"=="0" goto noimage
if not "%newimage%"=="%newimage:boot=%" goto command
if not "%newimage%"=="%newimage:recovery=%" goto command
goto wrongname
echo(
:command
echo Your new image is%yellow% %newimage%.img%deft%. | klr
echo(
echo Executing the repacking command....
echo(
mtkbootimg --kernel %kernel% --ramdisk %ramdisk% --pagesize %pagesize% --base %base% --board "%nameb%" --kernel_offset %koff% --ramdisk_offset %ramoff% --tags_offset %tagoff% %second% --cmdline "%scmdline%" %secoff% %dtb% -o ..\%newimage%.img
del "%file%.img-ramdisk.%compress%"
cd ..\
echo(
echo(
echo Done. Your new image was repacked as%yellow% %newimage%.img%deft%. | klr
goto end
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:noinput
echo(
echo(
echo %red%No folder selected. Exit script.%deft% | klr
echo(
goto end
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:wrongname
echo(
echo(
echo %red%The name have to include the type of image in it, %yellow%boot%red% or%yellow% recovery%red%.%deft% | klr
echo(
goto newimage
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:noimage
echo(
echo(
echo %red%Please enter a name for the repacked image first.%deft% | klr
echo(
goto newimage
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:error
echo(
echo(
echo %red%There is an error in your folder. The kernel or ramdisk is missing. Exit script.%deft% | klr
echo(
echo(
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:end
echo(
pause
 
Last edited:
  • Like
Reactions: bluefirebird

bluefirebird

Senior Member
Mar 23, 2013
1,027
5,034
carliv.eu
Hello Sir, i Wanted To Share My Modding Of Your Tool For Better Compression, i Also Did This Long Time Ago With Michfood's Tool, And it Works Effectively... By Doing This, Final Output IMG Can Be More Than 100KB Smaller Compared To Previous IMG Output... Which is a Releaf For 6MB Recovery/Boot Partition Devices...

For This, We Need 7zip Command Line Tool
By Downloading And Extracting "7za" Executable into The BIN Folder Of Your Tool And Modding Your Tool's RePack Script File, We Can Achieve Better Compression For GZIP'ed RAMDISKs...
.....

I understand your point of view, but I have to tell you few things. :)
First thing I tested was 7zip because at start I didn't want to use any cygwin dll in my tool, but 7zip isn't "the same" in windows and linux (I use ubuntu and it is provided in official ubuntu packages), and I wanted my tool to be consistent across OSes. Then, 7zip changes the original file attributes (date of creation for example, permissions, etc.) and it takes longer to do the job (execution time), so I moved to gzip built by me from source for windows. Gzip keeps original data for files by default and it is faster. But windows standalone module didn't worked - I mean technically worked, repack unpack but the created image didn't worked in phone. That's how I ended up with cygwin compression modules - they do the job.
So, thank you for your suggestion, but I will stick with gzip as "official" way for both versions, since it proves to work in every situation. Maybe if I didn't provided a linux version too and I didn't care about preserving files original infos, I would use 7zip for the advantage of a slightly better compression.
It's good though that you posted here your modd, because if someone wants to try it or use it, all it needs to do is to check your post! :good:
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 188
    attachment.php


    Hi, I present you my tool for unpacking/repacking boot and recovery images for Android phones: Carliv Image Kitchen for Android.

    2016-06-30 Update to version 1.3 stable
    Changelog:
    - detect mtk header during unpacking;
    - removed grep method;

    Instructions can be found in every variant folder.

    To start it just double click on carliv.bat script (windows) or carliv script (Linux) then choose "Run in terminal" from dialog box.

    attachment.php
    attachment.php




    Credits:
    yuweng for his assistance and help on testing and troubleshooting (you should thank him too guys - it was a great help);
    michfood for initial starting ideea;
    osm0sis for bootimg-info source and some hints from his kitchen;
    Cyanogenmod for mkbootimg source folder;
    Omnirom for their clean implementation of MTK header.
    Pete Batard for bootimage tools windows fix.
    Thomas Polaert ([email protected]) for CECHO DOS coloring tool (windows version).

    If you want to share this in other websites, blogs or forums please keep the credits from script files (I wrote those from scratch), and give proper credits for me.


    Contributors
    carliv, yuweng
    44
    Drag & Drop on linux CarlivImageKitchen version! function implemented by yuweng

    Alternative linux version with Drag and Drop functionality, modded by my friend yuweng! -* carliv's edit: copied here from my friend's post.

    Yes, now you can also Drag&Drop to UnPack/ RePack Android images on linux using CarlivImageKitchen !
    brows_zpsda58f2fa.gif

    Download CarlivImageKitchen-DnD.zip & extract to your linux Desktop, copy out all the five .desktop files to your Desktop & start Dragging & Dropping . . . :laugh: You can also Drag&Drop it to same .desktop files inside CarlivImageKitchen folder & it'll to work too . . . :good:

    Tested working perfectly on BBQLinux & also Ubuntu, however, for Ubuntu you need to open the .desktop launcher shortcut with any text editor & manual edit the command as below . . .
    Code:
    [COLOR="Blue"]gnome-terminal[/COLOR] -e "bash -c \"~/Desktop/CarlivImageKitchen/image_info %f\""
    i have also tested it on numerous of linux terminal program & it works perfectly too so you gotta manual edit it if you are using those . . . :good:
    Code:
    [URL="https://launchpad.net/terminator"]terminator[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
    [URL="https://konsole.kde.org/"]konsole[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/unpack_MTK_img %f""
    [URL="http://mate-desktop.org/#mate-terminal"]mate-terminal[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
    [URL="http://en.wikipedia.org/wiki/GNOME_Terminal"]gnome-terminal[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/repack_MTK_img %f""
    [URL="http://wiki.lxde.org/en/LXTerminal"]lxterminal[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
    [URL="http://roxterm.sourceforge.net/"]roxterm[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
    [URL="https://www.enlightenment.org/p.php?p=about/terminology"]terminology[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/repack_img %f""
    [URL="https://launchpad.net/sakura"]sakura[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
    [URL="http://en.wikipedia.org/wiki/Xterm"]xterm[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/image_info %f""
    [URL="http://en.wikipedia.org/wiki/Terminal_(Xfce)"]xfce4-terminal[/URL] -e "bash -c "~/Desktop/CarlivImageKitchen/unpack_img %f""

    No more typing to unpack/ repack, just draaaagggg & drooooopppp it like you use to do that on Windows . . . :laugh:

    Full credits to Master Shifu Carliv, i just modded a few lines to support Drag&Drop, that's all . . . :eek:

    Drag&Drop in Action !


    Konsole_zpsowqyjhiv.png

    Konsole

    ROXTerm_zps1azcq0mb.png

    roxterm

    sakura_zpslu92dfuu.png

    sakura

    gnome-terminal_zpsgdofxzcw.png

    gnome-terminal

    LXTerminal_zpsfqooarci.png

    lxterminal

    mate-terminal_zpsr5so7bfo.png

    mate-terminal

    xterm_zpsvat5yezm.png

    xterm

    terminator_zpsxpivpoaj.png

    terminator

    Terminology_zpswsg30kdi.png

    terminology

    xfce4-terminal_zpsktybn2fv.png

    xfce4-terminal

    If you want to hit the THANKS button for yuweng's version, go here and do it.
    30
    Mirror Downloads

    2015-04-08 Big Update to version 1.0 stable
    Changelog:
    - corrected few issues in scripts;
    - rebuilt all modules also to correct some issues;
    - cleaned up the source;
    - added more compression support - see next;
    - now the kitchen supports ramdisks compressions as following: gz, bz2, lzma, xz, lzo, lz4;
    - converted to a Menu driven interface: now everything can be done from inside kitchen menu with few clicks;
    - updated Instructions (can be loaded in kitchen interface for reading).

    * for those of you who don't want the menu interface, there is version 0.5 in download list, with the old individual scripts structure but updated with same modules and compression support as version 1.0 (I kept this especially for windows, where it can be used with drag and drop).

    2015.02.16 Update version 0.3
    • rebuilt binaries to correct few issues.
    • some fixes in scripts.
    • generate correct sha id.
    • use minigzip for repacking ramdisk as in recovery building.
    • compiled standalone bzip2 module.

    So, what's this?
    It's a utility (tool) for unpacking and repacking boot and recovery images for many kind of android phones. I made two versions, one for windows users and one for linux users. The windows version works by dragging&dropping over the script you want to use, while the linux version will work with terminal commans (very simple commands though).
    What's inside?
    For windows version the scripts are batch files and for linux bash files, but the names are the same and they do same thing:
    1. clear_all will clear the working folder deleting any unpacked boot/recovery folder, but not the boot or recovery files (original or repacked).
    2. image_info will print on screen all informations about the image you want to check (sizes, offsets, cmdline, etc.) and all these infos will be saved in a text file (which will be deleted when you clear the folder - see point 1). This is handy if you don't want to unpack the image, but only to see its infos. This script works for all kind of images (not specific to a hardware platform).
    3. unpack_img is the script for unpacking images for all kind of phones with different platforms (qcom, exynos,...) but not MTK. It will work I think for AndroidOne project phones.
    4. unpack_MTK_img is the script for unpack any MTK image, including the ones from new platforms (mt6595, mt6752, mt6753, and whatever they are).
    5. repack_img is the repacking script for regular (non-MTK) phones.
    6. repack_MTK_img is the repacking script for all MTK boot/recovery images.
    Besides these in Utility folder there is a bin folder (hidden) with all executables needed by the scripts.
    How to use it?
    As I said, for windows just drag&drop an image (boot or recovery) you want to unpack over the corresponding script, and drag&drop the folder of the unpacked image over the repacking script when you want to repack it. Choose the scripts with MTK in name for MTK images, and the other ones for any other kind.
    For linux open a terminal window in CarlivImageKitchen folder and type (or just copy/paste from here) the commands:
    Code:
    ./unpack_img boot.img
    or
    Code:
    ./unpack_MTK_img recovery.img
    or what name has your image.
    To repack type like this:
    Code:
    ./repack_img recovery
    or
    Code:
    ./repack_MTK_img boot
    and so on.
    NOTICE here for repacking just type the name of the folder, without slashes.

    Important, my utility doesn't have any request for position on partitions or directories. In testes worked in a third sub-sub-subfolder on an external partition (both in linux and windows), and it proves to work with any kind of name (except special characters that may break the script), including spaces or dots in folders names, but I recommend you to use dashes or underscores instead of spaces, and avoid dots. In repacking procedure, the script will prompt you to introduce a name for the new image, and if it will contain dots or spaces you will see an error. Also the name must include the type of image (boot or recovery) - Eg: "boot-stock-repack" or "recovery_cwm_m7", and without the extension (.img).
    Same condition about names applies for images you want to unpack; if they have other names, like "cwm-m7.img", rename it including the type of image in name: eg "recovery-cwm-m7.img". Why this? As many of you used bgcngm's tool you noticed he asked for including an argument in script command ("-boot" or "-recovery") because this is the way his script can apply the right header for ramdisks in repacking. My tool does that from image name and you don't have to add extra arguments in command.
    A second note: This tool doesn't support Rockchip Android images.
    What's under hood?
    All modules used in my tools are compiled by me, both for windows and linux.
    Also for windows, because it requires few cygwin libraries to work with compressing/uncompressing executables, I used those libraries and executables from latest cygwin release (gzip, xz, bzip2, cpio and the corresponding dlls).
    But my utility doesn't require a cygwin installed. Well, linux version worked very well in cygwin environment, but it's not necessary since I provided a standalone windows version.
    The executable modules:
    1. imageinfo - a initial source is shared by osm0sis here, but I used that only for inspiration because I liked the ideea; I used the unpackbootimg from cyanogenmod 12, system/core/mkbootimg and modded to get a similar output as in osm0sis bootimg-info.
    2. mkbootfs - built in cygwin for windows and normal in linux. I used the "stock" source from cyanogenmod 12 /system/core/cpio.
    3. mkbootimg - based cyanogenmod 12 source, but modded, and for windows fixed to work (the standard source it builds in windows but doesn't work). I used for fixing the ideeas from Pete Batard's source. This module repack also dtb-images back to repacked image.
    4. mtkbootimg - same as mkbootimg, but with additions from omnirom code for MTK, to append the MTK header to this kind of images. This one will check first the kernel and then the ramdisk for MTK header, and if it's not there it will append it, but if it's there will skip.
    5. unpackbootimg - from same cyanogenmod 12 source, with few extra additions by me.
    6. unpackmtkimg - same as unpackbootimg but adapted for MTK images, for which will strip the header off before unpacking, to be easy to work with.
    For windows I used jeremejevs cmdcolor source to build a module which add colors in cmd console, for a pleasant experience.
    All these sources are modified, improved and fixed in some aspects.

    Why I did it?
    Well, the trigger was the apparition of the new platforms from MTK, which didn't worked with any of the old tools. First who found out what's changed was mrjavum. Starting from his findings I explored more, and then provided the update ideea and binaries for bgcngm's tool. But that is only for linux. I know it can be used in windows with cygwin, but we had a standalone tool, michfood's tool, which now doesn't work with the new platforms.
    So I started to think for a new utility for windows to solve that need. After I did it I thought I can do it for linux too even if there exists already bgcngm's tool and works great. And I made it not only for MTK phones.
    That's the reason I called it Image Kitchen. It is like a tool that combines michfood's tool with osm0sis Kitchen, and serves for different platforms (I tested MTK, Qualcomm, Exynos, with or without dtb, and all worked great). But it's first release, not fully tested (I don't have all kind of phones for that), and so it is marked beta.[/HIDE]

    Cygwin-windows version
    Removed since it was only for some specific testing, and anyway the windows version now works and it shows exactly the same with linux, producing same result.
    15
    Refer to post #2 for details . . .
    11
    Update to version 1.1

    2016-03-24 Update to version 1.1 stable
    Changelog:
    - rebuilt all executables using Cyanogenmod 13 source;
    - a new way to handle MTK images - use same menu and everything it's done by the Kitchen under the hood;