yashsingh1/xdaforums huggingface dataset:
[Miscellaneous Android Development] Dhinesh Ravi:
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..
[Miscellaneous Android Development] bgcngm:
The binary (mkbootimg) should be put somewhere in the path or in the working dir.
[Miscellaneous Android Development] Dhinesh Ravi:
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..

sudo apt-get update

For updating ur repositories..then.

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:
[Miscellaneous Android Development] seb_131:
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
[Miscellaneous Android Development] bgcngm:
The example you are referring to is shown on an old post. The first post is up to date and includes working syntax.
[Miscellaneous Android Development] Santhosh M:
[MENTION=455439]bgcngm[/MENTION]

Hi sir,

I have plenty of times used this tool to unpack and repack recoveries without any problem. But yesterday for first time tried my hand at compiling recovery from source and compiled a Philz recovery. Now when i tried to unpack the compiled recovery i got this error,

the boot image does not appear to contain a valid gzip file

The perl is very fine in my liux. My perl version is 5.20. Could you help me on what would be the mistake? ( Ur script states use Use Perl v5.14 Is it the reason ? )
[Miscellaneous Android Development] superdragonpt:
Its obvious that the error is unrelated with this scripts

They work just fine on mt6589/mt6577/ mt6582 / mt8125 with source built kernels and recovery.

The problem is on your side
[Miscellaneous Android Development] varun.chitre15:
This happens when the image contains a ramdisk which is not compressed using standard gzip format.
[Miscellaneous Android Development] Santhosh M:
Fine & thanks for the hint. Will look into that.
[Miscellaneous Android Development] flufytendo:
hi, I can unpack a boot.img but whenever i repack it there is no file

I can read this:

$ ./repack-MT65xx.pl -boot boot.img-kernel.img boot.img-ramdisk boot.pk.img

MTK-Tools by Bruno Martins

MT65xx repack script (last update: 27-01-2013)

Repacking boot image...

Ramdisk size: 4190 blocks

Repacked boot image into 'boot.pk.img'.

I have no idea about the problem
[Miscellaneous Android Development] leo.riv:
[MENTION=455439]bgcngm[/MENTION]

Successfully unpacked & Repacked but didn't find Newboot.img

____________________________________________________________________________________________________

Administrator@THE_RAIN ~

$ cd /Boot

Administrator@THE_RAIN /Boot

$ ./unpack-MT65xx.pl stock.img

MTK-Tools by Bruno Martins

MT65xx unpack script (last update: 27-01-2013)

Valid Android signature found...

Input file information:

Kernel size: 3922528 bytes / load address: 0x10008000

Ramdisk size: 833927 bytes / load address: 0x11000000

Second stage size: 0 bytes / load address: 0x10f00000

Page size: 2048 bytes

ASCIIZ product name: ''

Command line: (none)

Kernel written to 'stock.img-kernel.img'

Ramdisk size: 3183 blocks

Extracted ramdisk contents to directory 'stock.img-ramdisk'

Successfully unpacked kernel and ramdisk.

Administrator@THE_RAIN /Boot

$ ./unpack-MT65xx.pl kash.img

MTK-Tools by Bruno Martins

MT65xx unpack script (last update: 27-01-2013)

Valid Android signature found...

Input file information:

Kernel size: 2794152 bytes / load address: 0x10008000

Ramdisk size: 636622 bytes / load address: 0x11000000

Second stage size: 0 bytes / load address: 0x10f00000

Page size: 2048 bytes

ASCIIZ product name: ''

Command line: (none)

Kernel written to 'kash.img-kernel.img'

Ramdisk size: 2230 blocks

Extracted ramdisk contents to directory 'kash.img-ramdisk'

Successfully unpacked kernel and ramdisk.

Administrator@THE_RAIN /Boot

$ ./repack-MT65xx.pl -boot kash.img-kernel.img stock.img-ramdisk Newboot.img

MTK-Tools by Bruno Martins

MT65xx repack script (last update: 27-01-2013)

Repacking boot image...

Ramdisk size: 3183 blocks

Repacked boot image into 'Newboot.img'.

Administrator@THE_RAIN /Boot

$

_________________________________________________________________________________________________
[Miscellaneous Android Development] bgcngm:
Running Cygwin on a Windows x64? Read this post.
[Miscellaneous Android Development] leo.riv:
Canot repacked using ubuntu-14.04.1

____________________________________________________________________________________________________________________

Repacked boot image into 'boot.img'.

leo@leo-VirtualBox:~/Desktop/001/mtk-tools-master$ sudo ./repack-MT65xx.pl -boot kash.img-kernel.img stock.img-ramdisk boot.img

MTK-Tools by Bruno Martins

MT65xx repack script (last update: 27-01-2013)

Repacking boot image...

Ramdisk size: 3183 blocks

Can't exec "/home/leo/Desktop/001/mtk-tools-master/mkbootimg": Permission denied at ./repack-MT65xx.pl line 92.

Repacked boot image into 'boot.img'.

leo@leo-VirtualBox:~/Desktop/001/mtk-tools-master$

______________________________________________________________________________________________________________________
[Miscellaneous Android Development] bgcngm:
Read the output. It's pretty clear, set proper permissions to that binary.
[Miscellaneous Android Development] leo.riv:
How?
[Miscellaneous Android Development] Santhosh M:
chmod the whole folder or mkbootimg binary :cool:
[Miscellaneous Android Development] bgcngm:
Did you happen to come across MTK boot images containing ramdisk compressed with other methods rather than gzip?

Doing it for the whole folder is not needed. ;)
[Miscellaneous Android Development] bgcngm:
Thread converted to a DevDB thread so that I can manage 10-post rule filtering.

Quick additional note: I'm currently revising the code of the scripts to fix the verbose output part. Hope it becomes clear for the end user why the script(s) have eventually terminated unexpectedly.
[Miscellaneous Android Development] Santhosh M:
Yes sir. Recently the google android one devices which use mt6582 has used XZ compression for ramdisk and kernel. It would be nice of you if you include in script the code for other compression methods other than gzip ! :)
[Miscellaneous Android Development] bgcngm:
Thanks for the heads up. I was not aware of that and I'll see what I can do (what time allows me to, basically). :p
[Miscellaneous Android Development] varun.chitre15:
That's wrong.

There is standard gzip compression for ramdisk and xz for kernel.

Plus on the top this script cannot be used with Android One devices because it doesn't have any special header unlike other Mediatek devices.

The boot image can be build with standard mkbootimg.
[Miscellaneous Android Development] bgcngm:
Thanks for the clarification. Less trouble then. I was finding strange why Google would have decided to keep up with the non-standard image format from MediaTek.
[Miscellaneous Android Development] Santhosh M:
The script wasn't able to unpack the stock kernel citing not a gzip error. So I was of the mind that the ramdisk too must be xz like kernel !

So a normal standard boot img unpacker tool is to be used for android one ?The mkimage used to add special header to the compiled zimage isn't also needed in android one devices ?
[Miscellaneous Android Development] varun.chitre15:
yep, that's what it is.
[Miscellaneous Android Development] bgcngm:
Just wanted to inform everyone that the scripts were just updated with revised verbose output.
[Miscellaneous Android Development] bgcngm:
Also decided to rename the filenames of the scripts (repack-MT65xx.pl → repack-MTK.pl and unpack-MT65xx.pl → unpack-MTK.pl). It doesn't make sense anymore to keep references to MT65xx because the scripts work not only with images from MT65xx SoC's, but also with those from MT83xx (and most likely from future MT67xx). :cool:
[Miscellaneous Android Development] bgcngm:
Small update to the unpack script. The unpack result is now always stored on the working directory, despite of the input file path. Up until now the unpack script could only be used in the same directory where boot, recovery or logo images were.

Now you can do something like this, from any working directory:

unpack-MTK.pl ~/Desktop/MTK/recovery.img

In this example, the kernel and ramdisk contents are extracted to the working directory.
[Miscellaneous Android Development] bgcngm:
To all developers and contributors active on MTK scene: [MENTION=4309448]varun.chitre15[/MENTION], [MENTION=5439876]Dr-Shadow[/MENTION], [MENTION=5238428]superdragonpt[/MENTION], [MENTION=4478781]yuweng[/MENTION]

Following the latest update (read above post) do you think it could be useful to add an option to specify output folder for unpack result? Any improvement idea as well? Seeing it from the point of view of integration into kernel compilations.
[Miscellaneous Android Development] yuweng:
On manual unpack/ repack, your script has open up a whole new whole of ROM porting for the whole MTK community . . . :good:

As for kernel compilation, i'm still a noob . . . :o i've seen TWRP Lead Developer Dees_Troy using it here & RD chrmhoffmann which is also based on your script here . . . :good:

AFAIK on MTK kernel compilation, many manually use mkimage to build the kernel header & i've never seen anyone using your script together with mkimage to automate it (never seen one on github) & heard that newer MTK kernel source has script automating it, it builds kernel instead of zImage, idk . . . :o
[Miscellaneous Android Development] avilaverde:
how to open/edit the .rgb565 file in linux? ubuntu 14.10?
[Miscellaneous Android Development] bgcngm:
I don't know, but why would you want that? Since some time, the scripts already support rgb565 <=> png images conversion.
[Miscellaneous Android Development] :
I think he wants to mod images?

If so first you would do this

ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 320x240 -i image.raw -f image2 -vcodec png image.png

change 320x240 to whatever

http://www.madox.net/blog/2011/06/06/converting-tofrom-rgb565-in-ubuntu-using-ffmpeg/

Once you have png by either bgcngm or link method.........you can use mtpaint to graphically modify png

then use link to convert back but change image.raw to image.rgb565

good luck and I have not tried it.
[Miscellaneous Android Development] Traace:
Repack worked now. Anyway, had to use another tool
[Miscellaneous Android Development] kylechina:
Many thanks for your works！

The scripts for unpack&repack MTK have not supported for MT6595 and MT6595m , I tested only unpack and repack the stock boot.img or recovery.img with out any changes ,the image flashed into phone can not work.

wish you can help me .

I am a flashman for playing recovery images and sources.

sorry for my pour English...
[Miscellaneous Android Development] tempdroid:
Does this support the new MTK chip 8392 from Cube Talk 9x as well?
[Miscellaneous Android Development] bgcngm:
Windows 8 x64? Search the thread for that.

Why not?

Share the files here. I'm curious and want to have a look.
[Miscellaneous Android Development] kylechina:
boot&recovery from lenovo vibe x2 stock firmware.

https://mega.co.nz/#!C49mXTZZ!AXrX1_r847T6dF2TEM1Vb0sIVVqKgPKnGXtuwNUU9k4
[Miscellaneous Android Development] DeviRSilva:
New boot.img not working

Hello. thanks to this sripts I was able to unpack the stock kernel. I did not make changes inside the boot.img-ramdisk folder and then I repacked it again. I flashed the new boot.img file and now the phone does not boot...

to unpack i did:

./unpack-MTK.pl boot.img

Getting this:

MTK-Tools by Bruno Martins
MTK unpack script (last update: 17-10-2014)

Valid Android signature found...

Input file information:

Kernel size: 3397872 bytes / load address: 0x10008000
Ramdisk size: 834130 bytes / load address: 0x11000000
Second stage size: 0 bytes / load address: 0x10f00000
Page size: 2048 bytes
ASCIIZ product name: '20140702.163123'
Command line: (none)

Kernel written to 'boot.img-kernel.img'
Ramdisk size: 3201 blocos
Extracted ramdisk contents to directory 'boot.img-ramdisk'

then to repack i used this:

./repack-MTK.pl -boot boot.img boot.img-ramdisk newboot.img

getting this:

MTK-Tools by Bruno Martins
MTK repack script (last update: 16-10-2014)

Repacking boot image...
Ramdisk size: 3201 blocos
Successfully repacked boot image into 'newboot.img'.

My device is a ZTE Blade L2 and it has a MT6582M.

thank you :D
[Miscellaneous Android Development] Santhosh M:
The command here should be ./repack-MTK.pl -boot boot.img-kernel.img boot.img-ramdisk newboot.img
[Miscellaneous Android Development] DeviRSilva:
OMG

Sorry to wirte like this, but THANK YOU VERY MUCH. You don't know how much you contributed for a happier ZTE Blade L2 family :D
[Miscellaneous Android Development] pcprice76:
Hi, i need a little help :)

I use CYGWIN on Windows 7 64bit

Unpacked the boot.img without any problem, then tried to repack. Everything seems to be fine

$ ./repack-MTK.pl -boot boot.img-kernel.img boot.img-ramdisk newboot.img
MTK-Tools by Bruno Martins
MTK repack script (last update: 16-10-2014)

Repacking boot image...
Ramdisk size: 3210 blocks

But at the end no newboot.img in the directory :(

What did i miss?? Thanks in advance for your help! :)
[Miscellaneous Android Development] bgcngm:
That is a known problem for some users while running Win7/8 x64. Unfortunately, I can't replicate the issue, despite the fact that I'm also using Win8.1 x64. You must use Ubuntu on a virtual machine instead.
[Miscellaneous Android Development] superdragonpt:
Problem related with CYGWIN...

Be sure your executing from c:/ and not from desktop, re-installing may solve that problem...

On Linux (or VM) it's fully working, every time ;)

Love this tools, they are my daily driver for making kernels...

Awesome scripts Bruno

Regards
[Miscellaneous Android Development] Droid_beginner_student:
sir,i need help,desperately....

i'm trying to unsecure my boot.img,done for unpack,editing default.prop

when i'm trying ro repack,it shows some kind of line error (i believe it's line 112 and line 204),so i just edit that script,delete those 2 line and no more line error.

now,trouble comes again.

when i execute the command,it shows error "couldn't execute mkbootimg.exe binary! make sure......."

is that because i deleted those 2 line before or something else?
[Miscellaneous Android Development] bgcngm:
If you don't know what you're doing, why would you edit the scripts? If the scripts throw an error is because something is wrong. Please make sure that you are using the latest version of the scripts and post here the actual errors so that I can help.
[Miscellaneous Android Development] kenkitt:
I use kithen on Ubuntu 10 ,it works easily, the only problem is my compiled kernel alcatel 918D won‘t boot even after fixing the header :( .
[Miscellaneous Android Development] superdragonpt:
IF you built the kernel with the source ./build.sh script, the header is auto-patched.

You need to check at the end of the script if this code is present:

mkimg="${MTK_ROOT_BUILD}/tools/mkimage"
if [ "${KBUILD_OUTPUT_SUPPORT}" == "yes" ]; then
kernel_img="${outdir}/arch/arm/boot/Image"
kernel_zimg="${outdir}/arch/arm/boot/zImage"
else
kernel_img="${curdir}/arch/arm/boot/Image"
kernel_zimg="${curdir}/arch/arm/boot/zImage"

etc...

Regarding the scripts, i can ensure you they work just fine ...

Regards
[Miscellaneous Android Development] kenkitt:
Thanks very much, I need tjis info earlier but i used another method that works flawlessly.

First I had to download the environment, then build the kernel normally using build.sh, copy the generated kernel.bin file into the alps kernel directory then run target_build bootimage after setting up the env variables , finally you get your bootimage from the out dir, am on mobile i'll fix this later. :)

---------- Post added at 07:45 PM ---------- Previous post was at 07:35 PM ----------

#

# Automatically generated make config: don't edit

# Linux kernel version: 2.6.35.7

# Tue Dec 16 15:53:27 2014

Well, I had to download the entire ALPS build environment.

Then download your devices kernel and build it using build.sh , after configuring the environment in the kernel dir.

Afterwards copy the generated kernel...bin file into the baoxue_mytqe-master/kernel/ dir and rename it to kernel_baoxue.bin

then run

./target_build bootimage

you will get your boot.img in /baoxue_mytqe-master/out/target/product/baoxue/boot.image

that's all, I did , but i'll have to look into it deeply to understand what is going on.

But I guess the best way of learning is the hardway ,after compiling it a hundred times only to figure out that arm-android-eabi doesn't work I found this after trying the original arm-eabi-

Thanks
[Miscellaneous Android Development] cappa72:
I can confirm that the scripts work with MT8127-based tablets.

Brilliant tool :good:
[Miscellaneous Android Development] biobio76:
Hi to All

someone can please explain me/tell me how Perl v5.14 ( or higher since there is 5.20 now ) can be installed on window/Cygwin ??

would like to unpack-MTK.pl boot.img on Cygwin but Perl is only v5.10 on my installed Cygwin....

appreciate any help, thanks
[Miscellaneous Android Development] bgcngm:
During Cygwin installation, on the selection of packages you can search for Perl. Then you'll get a list of packages, being that Perl is on that list and you can select it to be installed (v5.14). Keep in mind that a virtual machine running Ubuntu is a cleaner solution.
[Miscellaneous Android Development] bgcngm:
I'm happy to report that the scripts now fully support the new platforms - MT6595. Credits goes to [MENTION=5186178]carliv[/MENTION] for making the changes and compiling new binaries.
[Miscellaneous Android Development] superdragonpt:
​

Awesome ;)

I'm going to test that very soon ( on mt6595 ) .

Regards
[Miscellaneous Android Development] kenkitt:
Actually kitchen works fine, i‘ve been using kitchen and it has always worked.:)
[Miscellaneous Android Development] split52:
Error: couldn't execute 'mkbootimg' binary!

./repack-MTK.pl -recovery recovery.img-kernel.img recovery.img-ramdisk recover.img

Check if file exists or its permissions.

the permission is ok, unpack perfect, but not pack, some help, thanks

ubuntu 14.04
[Miscellaneous Android Development] bgcngm:
Are you really sure that file permissions are okay? Execute mkbootimg manually and check if it works:

./mkbootimg
[Miscellaneous Android Development] split52:
:

bash: ./mkbootimg:

fixed, thanks
[Miscellaneous Android Development] bgcngm:
So, what was the problem after all?

You know, the goal of these forums is to share, that is to say you take, you give. Please tell us what was the problem as it could help others users in the future.
[Miscellaneous Android Development] xtribas:
i have an error unpacking this boot, its from a mt6582 (meo tablet 2)

im no developer, but i really need to edit the default.prop to make it unsecure so i can install cwm... am i making any sense?
[Miscellaneous Android Development] :
The script works without errors. Here is your boot unsecured. Cheers!
[Miscellaneous Android Development] xtribas:
i must have done something wrong, thanx a lot

is it normal that the sizes is smaller now?
[Miscellaneous Android Development] bgcngm:
Yes, it is normal. Your boot.img was probably readback from the device, so its size was the total partition size, but filled with trailing zeros.
[Miscellaneous Android Development] xtribas:
so i can just flash this with mtk droid tools?
[Miscellaneous Android Development] verdazil:
Hi, bgcngm

I want to try repack the boot.img , I use the command in Cygwin as the below:

Everything seen good, but the output folder is empty ?? Why ?? not output ???

ps: no error message during repack !

$ ./unpack-MTK.pl boot.img
MTK-Tools by Bruno Martins
MTK unpack script (last update: 30-12-2014)

Valid Android signature found...

Input file information:

Header:

Boot magic: ANDROID!
Kernel size (bytes): 4483280 (0x004468d0)
Kernel load address: 0x10008000

Ramdisk size (bytes): 639429 (0x0009c1c5)
Ramdisk load address: 0x11000000
Second stage size (bytes): 0 (0x00000000)
Second stage load address: 0x10f00000

Tags address: 0x10000100
Page size (bytes): 2048 (0x00000800)
ASCIIZ product name: ''
Command line: ''
ID: da56d35b286e27897f73e4ad0e88f0e06ef71367

Other:

Boot magic offset: 0x00000000
Base address: 0x10000000

Kernel offset: 0x00008000
Ramdisk offset: 0x01000000
Second stage offset: 0x00f00000
Tags offset: 0x00000100

Extra arguments written to 'boot.img-args.txt'
Kernel written to 'boot.img-kernel.img'
Ramdisk size: 2254 блоков
Extracted ramdisk contents to directory 'boot.img-ramdisk'

Successfully unpacked kernel and ramdisk.

Victor@Victor-PC ~/scripts
$ ./repack-MTK.pl -boot boot.img-kernel.img boot.img-ramdisk new-boot.img
MTK-Tools by Bruno Martins
MTK repack script (last update: 30-12-2014)

Repacking boot image...
Ramdisk size: 2254 blocks

Victor@Victor-PC ~/scripts
[Miscellaneous Android Development] superdragonpt:
Yeap !

What's your perl version ?
[Miscellaneous Android Development] verdazil:
Sorry, I found my mistake. Unpack and repack scripts were non-compliant versions.
[Miscellaneous Android Development] bgcngm:
What do you mean with non-compliant versions?
[Miscellaneous Android Development] Skulltastrophe:
MTK6572 boot.img unpack error

I have an error "Error: 'cpio' binary not found! Double check your environment setup" trying to unpack 6572 boot.img. Question, does the boot.img file have to be a file pulled from the phone or does a USB firmware upgrade file work too? or does it have to be a full firmware or just an upgrade? to my knowledge this should be a full firmware tho it says upgrade. I flashed this firmware upgrade (where I got the boot.img) when my phone went to a bootloop (Huawei Y330-U01) ´

:confused:
[Miscellaneous Android Development] bgcngm:
First of all, the error you're getting has nothing to do with your other questions. The error points to a problem with your environment setup, in this case "cpio" binary is not present. If you are running the scripts on Cygwin, make sure that "cpio" is installed.

As for your other questions, I don't really know what you mean with an "USB firmware upgrade file". The scripts work with boot / recovery images, so only boot.img / recovery.img are required, respectively. Doesn't matter if you have the full firmware or not.
[Miscellaneous Android Development] Santhosh M:
Whatever boot.img ! If you mean the official SP Tool flashable stock firmware of ur device which contains the boot.img or any other form this tool should unpack it.
[Miscellaneous Android Development] bgcngm:
Did some of the RD's / RC's out there from MTK scene ([MENTION=4309448]varun.chitre15[/MENTION], [MENTION=5439876]Dr-Shadow[/MENTION], [MENTION=5238428]superdragonpt[/MENTION], [MENTION=5186178]carliv[/MENTION]), ever tried other ramdisk compression methods, besides gzip? I'm working on the scripts lately and wanted to know if it's worth or not to add support for other methods. Most likely the stock kernels only support gzip, but as some of you are now experts compiling kernel, we could test.