[Miscellaneous Android Development] bgcngm:
If you are looking for a way to easily unpack / repack boot.img, recovery.img or logo.bin from your MediaTek device (all except Android One devices), don't look any further. Here you can find my own Perl scripts.

Scripts were first based on the ones available on Android-DLS WiKi, but are now highly modified in order to work with specific MTK boot and recovery images. The scripts fully work with every image from all known MediaTek SoC:

MT6516

MT65x3 (MT6513 and MT6573)

MT65x5 (MT6515 and MT6575)

MT6577

MT65x2 (MT6572, MT6582 and MT6592)

MT6589

MT83xx (MT8377 and MT8389)

MT6595

The most up to date version of the scripts is always available at my public github repository: bgcngm/mtk-tools. Scripts require Perl v5.14+ to be installed and were fully tested under Ubuntu 12.04 as well as Windows 7 x64 (using Cygwin).

Please don't just leech the files and go away. You can easily say thanks just by pressing "Thanks" button.

Unpack script usage:

Usage: unpack-MTK.pl <infile> [COMMAND ...]
Unpacks MediaTek boot, recovery or logo images

Optional COMMANDs for boot or recovery images are:

-info_only
Display file information only
(useful to check image information without unpacking)

-kernel_only [--debug]
Extract kernel only

-ramdisk_only [--debug]
Extract ramdisk only

(optional argument '--debug' can additionally be used to provide useful
information for debugging purposes, even while unpacking both kernel
and ramdisk)

Optional COMMANDs for logo images are:

-force_logo_res <width> <height>
Forces file to be unpacked by specifying image resolution (in pixels)
(only useful when no zlib compressed images are found)

-invert_logo_res
Invert image resolution (width <-> height)
(may be useful when extracted images appear to be broken)

Repack script usage:

Usage: repack-MTK.pl <COMMAND ...> <outfile>
Repacks MediaTek boot, recovery or logo images

COMMANDs for boot or recovery images are:

-boot [--debug] <kernel> <ramdisk-directory>
Repacks boot image

-recovery [--debug] <kernel> <ramdisk-directory>
Repacks recovery image

(optional argument '--debug' can additionally be used to provide useful
information for debugging purposes, while repacking)

COMMANDs for logo images are:

-logo [--no_compression] <logo-directory>
Repacks logo image

(optional argument '--no_compression' can be used to repack logo images
without compression)

Version history:

modified to work with MT6516 boot and recovery images (17-03-2011)

included support for MT65x3 and eliminated the need of header files (16-10-2011)

added cygwin mkbootimg binary and propper fix (17-05-2012)

included support for MT65xx logo images (31-07-2012)

fixed problem unpacking logo images containing more than nine packed rgb565 raw files (29-11-2012)

re-written logo images file verification (29-12-2012)

image resolution is now calculated and shown when unpacking logo images (02-01-2013)

added colored screen output (04-01-2013)

included support for logo images containing uncompressed raw files (06-01-2013)

more verbose output when unpacking boot and recovery images (13-01-2013)

kernel or ramdisk extraction only is now supported (13-01-2013)

re-written check of needed binaries (13-01-2013)

ramdisk.cpio.gz deleted after successful extraction (15-01-2013)

added rgb565 <=> png images conversion (27-01-2013)

code cleanup and revised verbose output (16-10-2014)

boot or recovery is now extracted to the working directory (16-10-2014)

unpack result is stored on the working directory, despite of the input file path (17-10-2014)

added support for new platforms - MT6595 (thanks [MENTION=5186178]carliv[/MENTION]) (29-12-2014)

minor code cleanup and revised information output for boot and recovery images (29-12-2014)

make scripts more future-proof by supporting even more args (30-12-2014)

continue repacking even if there's no extra args file (01-01-2015)

more verbose output when repacking boot and recovery images (02-01-2015)

added new cmdline option for debugging purposes when unpacking / repacking boot and recovery images (06-01-2015)

Credits:

Android-DLS for the initial scripts

starix (from forum.china-iphone.ru) for the decryption of logo.bin files structure

carliv (from xdaforums.com) for new platform support and new binaries

XDA:DevDB Information

MTK-Tools, Tool/Utility for the Android General

Contributors

bgcngm

Version Information

Status: Stable

Created 2014-10-15

Last Updated 2014-10-17