[SCRIPTS] Unpack / repack MT65xx/MT83xx boot.img, recovery.img or logo.bin

Search This thread

joeyhuab

Recognized Developer
Help

Could someone help me make my boot.img insecure? It's an MT6589 device and I've tried your script and all and it keeps on saying Ramdisk Size: FIND: Parameter format not correct upon repacking.

Here's my boot.img. I just want an insecure boot.img. That's all. Thanks in advanced! :fingers-crossed:
 

Attachments

  • boot.img
    6 MB · Views: 53

polfrank

Senior Member
Jul 5, 2012
718
335
Hello, I managed to unpack successfully, BUT when I try to repack I get this:

root@macerator:/home/pol/Desktop/mtk-tools-master# ./repack-MT65xx.pl boot.img-kernel.img boot.img-ramdisk new-boot.img

MTK-Tools by Bruno Martins
MT65xx repack script (last update: 27-01-2013)

Usage: repack-MT65xx.pl COMMAND [...]

COMMANDs are:

-boot <kernel> <ramdisk-directory> <outfile>
Repacks boot image

-recovery <kernel> <ramdisk-directory> <outfile>
Repacks recovery image

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

root@macerator:/home/pol/Desktop/mtk-tools-master#

I have tried many times, and I made sure that I put the correct name of kernel.img and ramdisk directory in my command... Any help? :(
 

bgcngm

Recognized Developer
Apr 2, 2007
7,091
21,556
Lisbon
HTC One (M8)
Xiaomi Mi 5
Could someone help me make my boot.img insecure? It's an MT6589 device and I've tried your script and all and it keeps on saying Ramdisk Size: FIND: Parameter format not correct upon repacking.
I'm sorry sir, I know you're busy and all, but can you help me make my boot.img insecure? It's posted in the last post of the previous page. :( Will really appreciate it since I've tried your wonderful scripts and couldn't get them to repack well.
First of all, the error message you're getting points out to an incomplete Cygwin installation (double check your setup). I assume it is Cygwin because 'find' is part of every Linux distro. It has been said over and over that using Ubuntu is the best option to run the scripts.

On other hand, the changes you want to apply are not the topic of the thread, but I can say that creating an insecure boot.img requires a patched adbd binary. You have to find it yourself. Alternatively you can skip modification of boot.img and simply use adbd Insecure.
 
  • Like
Reactions: joeyhuab

joeyhuab

Recognized Developer
First of all, the error message you're getting points out to an incomplete Cygwin installation (double check your setup). I assume it is Cygwin because 'find' is part of every Linux distro. It has been said over and over that using Ubuntu is the best option to run the scripts.

On other hand, the changes you want to apply are not the topic of the thread, but I can say that creating an insecure boot.img requires a patched adbd binary. You have to find it yourself. Alternatively you can skip modification of boot.img and simply use adbd Insecure.
Found the problem. The cygwin path wasn't the first one in the environment variables causing it to use the Windows comnand find instead of Linux's FIND. Got it repacked now! Thanks for your scripts!
 

Dhinesh Ravi

Member
Oct 6, 2013
33
7
BatCave
Hi....I actually used ur latest script.. In ubuntu 13.04 the repack was working fine...

But in my ubuntu 14.04 LTS the repack script is not working...it showas the error

Cant execute mkbootimg..no such file at /path to/mkbootimg at repack-MT65xx.pl at line 96...

i even gave permissions to mkbootimg and copied it to /bin...
But no luck..it shows the same error...

Can anybody help me with this???

Thanks in advance..
 

Dhinesh Ravi

Member
Oct 6, 2013
33
7
BatCave
The binary (mkbootimg) should be put somewhere in the path or in the working dir.

Solved it dude...the problem was tat trusty tahr (14.04) dropped ia32-libs package support...and ur script needs it... so instead as a replacement i had to install lib32ncurses5 package and lib32stdc++ package... :D

So for the users who are using trusty tahr(14.04 LTS) and facing this repack issue do this..

Code:
 sudo apt-get update

For updating ur repositories..then.

Code:
 sudo apt-get install lib32bz1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6

Anyways thanks for the response...ur script is awesome btw...i tried many tools and utils...none of them worked...but urs works likes a charm... :highfive:
 

seb_131

Senior Member
Jul 18, 2008
61
29
Thanks a lot for this tool ! It worked perfectly on my Cube Talk 9X tablet which is equipped with a mtk8392.
I used it to swap the internal SD and the external SD, because on Kitkat the mounting configuration is set in fstab files which are hidden in the boot.img

For re-packing, I had to set permition 777 to mkbootimg file. The right command line is : ./repack-MT65xx.pl -boot boot.img-kernel.img boot.img-ramdisk new-boot.img
(-boot argument is misssing in the 1st page example).

Knd regards
 

Top Liked Posts

  • There are no posts matching your filters.
  • 379
    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:
    Code:
    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:
    Code:
    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 @carliv) (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
    32
    Editing .rgb565 raw files

    There may be other ways for doing this, but here's a short info that will help you to edit .rgb656 raw files found inside MTK logo images.

    • Download and install Paint.NET
    • Download the attached plugin and copy the RGB565.dll file to the folder: "C:\Program Files\Paint.Net\FileTypes"
    • Open the .rgb565 file and enter image height and width

    Information:

    The plugin will allow read and write support to the RGB565 or RAW565 format. This format is used by the Android platform for the initial boot screen of the device. It will also allow you to open a BMP, PNG, JPG or other image and save it as a RGB565 file.

    RGB565 is simply the raw pixel data of a bitmap file. It does not contain any header information and does not contain the dimensions of the image. The only thing that is known is the total number of pixels. When opening a .rgb565 file, the user must specify the height and width of the image, which is the resolution of your device's screen.

    Just as an example, for a device with a 540 x 960 screen, the .rgb565 file for that device will have 518400 pixels. The size of the file in bytes will be twice the number of pixels, i.e. 1036800 bytes.
    18
    Simple... let's say you unpack a boot.img:
    Code:
    unpack-MT65xx.pl boot.img

    This extracts the kernel (it will be named boot.img-kernel.img) and the ramdisk folder (it will be named boot.img-ramdisk).

    In order to repack, you should run:
    Code:
    repack-MT65xx.pl boot.img-kernel.img boot.img-ramdisk new-boot.img

    If you are repacking a recovery.img, then it should be:
    Code:
    repack-MT65xx.pl -recovery recovery.img-kernel.img recovery.img-ramdisk new-recovery.img
    9
    I have created a public github repository (bgcngm/mtk-tools) to host the scripts. The most up to date version is always available at the repo.

    I'm currently finishing the re-write of the scripts in order to add the unpack/repack feature of MediaTek logo.bin images.

    Please don't just leech the files and go away. You can easily say thanks just by pressing "Thanks" button.
    3
    Works in windows with cygwin too with some minor tweaking...

    change the repack script line 66, mkbootimg to ./mkbootimg.exe & replace mkbootimg with this windows version...:p i think it should work with any mkbootimg.exe windows version too...

    ignore the unpack scripts error though, it works fine actually in cygwin...:)