yashsingh1/xdaforums huggingface dataset:
[Miscellaneous Android Development] Nihal @A-JAX:
Not able to unpack recovery.img

Hi,

I was not able to unpack TWRP recovery image of a MT6582 device (Thunder q45) using your latest scripts.Here what it says:

MTK-Tools by Bruno Martins
MTK unpack script (last update: 06-01-2015)

Valid Android signature found...

Input file information:

Header:

Boot magic:	ANDROID!
Kernel size (bytes):	3491160	(0x00354558)
Kernel load address:	0x10008000

Ramdisk size (bytes):	2308199	(0x00233867)
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:	e485e5f64579d7bdab87fdb1c23351772f914944

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 'twrp.img-args.txt'
Kernel written to 'twrp.img-kernel.img'

Error: the specified boot image does not appear to contain a valid gzip
file!

I'm able to get only kernel and no ramdisk found!

Link for recovery: TWRP

Can you check and fix that ?
[Miscellaneous Android Development] Ab20000:
How can i port android one rom to another media tek device? any help will be appreciated.
[Miscellaneous Android Development] Dvalin21:
Wrong thread sir
[Miscellaneous Android Development] Ab20000:
boot.img

i heard boot.img for android one devices is different from other mediatek devices as they have unlockable bootloader.
[Miscellaneous Android Development] Dvalin21:
Android One devices?
[Miscellaneous Android Development] HypoTurtle:
I just ran these through my basic script (for 65** etc.) and they unpack fine, ifvyou have a rooted device with busybox installed I can post the script.
[Miscellaneous Android Development] Dvalin21:
Yes please and thank you :D
[Miscellaneous Android Development] HypoTurtle:
Attached is the script; remove the .txt, add it to a folder with the boot or recovery and in adb run sh split.sh boot to open the boot.img ramdisk [sh split.sh recovery will open recovery.img]

[MENTION=455439]bgcngm[/MENTION] not meaning to steal focus with this - it's a very basic script, feel free to take an alter as you see fit, if you think it could be useful.
[Miscellaneous Android Development] arielugose:
bootimg port failed

Hi superdragonpt,

Please help me. i need help porting this boot.img from 4.1.1 to be able to boot 4.2.2 roms.

my phone is Alcatel OT-5035E or Sapphire 2 with it has custpack partition i followed your steps in porting bootimg but always i always fail and i only got bootloop hope you can help me with this.

here is the complete backup of my stock rom

http s://mega.nz/#F!IkcVnDbZ!CGy7RAMRFLpFqDgoKoDy3Q

hope you can help me.
[Miscellaneous Android Development] rictec:
thank you for this

i m now trying your scripts since i m having a problem booting from a created boot.img with a pre-build kernel

i bet is as something to do with that Mtk Header on both kernel and ramdisk

thanks keep up this great work
[Miscellaneous Android Development] niabi:
I havce a device that has am MTK 8638 (but it identifes as NXP B.V. - MT85XX SoC with ARM1176JZF-S) , and I can't unpack the boot.img :( any idea of what to do ?
[Miscellaneous Android Development] bone101:
)

Error Messasage during repack

[url="https://www.dropbox.com/s/i1skmgoiu4j3ut0/boot.img?dl=0" ] boot.img [/url] of Caterpiller B15Q (MTK6582M)

/home/admi/Schreibtisch/mtk-tools-master/mkbootimg: 1: /home/admi/Schreibtisch/mtk-tools-master/mkbootimg: ELF: not found

/home/admi/Schreibtisch/mtk-tools-master/mkbootimg: 2: /home/admi/Schreibtisch/mtk-tools-master/mkbootimg: Syntax error: "(" unexpected
[Miscellaneous Android Development] DarkHeart Z:
same problem here . Dev is not replying either . I am stuck also :(
[Miscellaneous Android Development] bgcngm:
It's failing executing mkbootimg. Did you check file permissions? What happens if you try to execute mkbootimg directly without using the script?
[Miscellaneous Android Development] DarkHeart Z:
little help please

can't repack either boot.img or recovery.img . getting error like this :

/home/darkheart/mtk-tools-master/mkbootimg: 1: /home/darkheart/mtk-tools-master/mkbootimg: ELF: not found

/home/darkheart/mtk-tools-master/mkbootimg: 2: /home/darkheart/mtk-tools-master/mkbootimg: Syntax error: "(" unexpected

I have both zlib and perl installed . please help I am stuck here please :(

---------- Post added at 09:23 PM ---------- Previous post was at 09:06 PM ----------

somebody please help I am running ubuntu 14.04.3 LTS 32 bit . Is it a compatibility issue ?
[Miscellaneous Android Development] bgcngm:
Did you read this?
[Miscellaneous Android Development] DarkHeart Z:
Thanks for pointing that out . As for your solution I tried that too and same result as before . I gave all permissions to the mkbootimg . executing permissions too . It gave me a file named '� (invalid encoding)' . That's all . i migrated to ubuntu just for working on my roms project easily but I am upset now . My laptop is 32bit supported only :(

P.S: Strange thing is I ran this latest versions under cygwin and ported a lot of kernel using this tool and it worked without any problem . I can't count how much long time I have been using your script for my projects . I am working on a big one now and It didn't work on my x86 ubuntu installation .
[Miscellaneous Android Development] DarkHeart Z:
dev help needed

[MENTION=455439]bgcngm[/MENTION] I unpacked the boot.img without any error . But when tried to repack . It always ends up in : elf : not found . please tell me how do I fix this :(
[Miscellaneous Android Development] bgcngm:
The Linux binary only works on 64 bit. I don't know about the Windows binary, so try using Cygwin.
[Miscellaneous Android Development] DarkHeart Z:
Understood

Migrating to windows 7 today . All my projects became halted just because of this error . Thanks for the suggestions :)

P.s : windows binary works without any errors in cygwin . I never ever felt this much upset with this tool . Just downloaded set it and used it without any problems . This is the 1st time .
[Miscellaneous Android Development] bgcngm:
I think that nowadays no one uses 32 bits Linux. The 64 bits version is a must to compile Android anyway.
[Miscellaneous Android Development] DarkHeart Z:
got your point

Even I want too . but my pc is limited to 32 bit . And I don't have that much money to buy a 64 bit pc . And that is why I am stuck with these 32 bit machine . And have no better option than this yet . That is why I don't have a choice . i hope there will be work arounds for the binary . And google also kept 32 bit support till now . So there is still a lot for 32 bit . 64 bit has still a long way to be complete . It's a performance platform you know . Not an optimizer platform like 32 bit . I even want to migrate to 64 bit . but stuck because of 32 bit instruction set of my laptop .
[Miscellaneous Android Development] bgcngm:
Just use cygwin then or ask [MENTION=5186178]carliv[/MENTION] to compile for 32 bit Linux.
[Miscellaneous Android Development] DarkHeart Z:
did that

I talked with him . he said he lost his source because of his hard drive problem and he is going through a lot of stress from his work of real world and he can't change his linux os to 32 bit just to compile these executables . That is why I came to you because I have no other options now rather than you . And I sent you something in inbox . Will you please take a look at that ? Heartiest request .

Edit : i use superr's kitchen which made my work lot easier to do . And I don't want to revert back to windows just for my rom projects . cygwin has a lot of limitation which pains me a lot . So I would rather stick to linux .

---------- Post added at 07:41 PM ---------- Previous post was at 07:34 PM ----------

@bgcngm Will you share the source of your mkbootimg with me ? It will be private . I will follow your term's and conditions just the way you want it to be .

---------- Post added at 07:42 PM ---------- Previous post was at 07:41 PM ----------

Will you share the source of your mkbootimg with me ? It will be private . I will follow your term's and conditions just the way you want it to be .
[Miscellaneous Android Development] bgcngm:
Try using pre-compiled binaries from [MENTION=4544860]osm0sis[/MENTION] (download latest AIK-Linux package from here) and let me know if it works.
[Miscellaneous Android Development] DarkHeart Z:
just to be sure

AIK-linux is only for windows . Do I need to have an alternative toolchain for building the mkbootimg in linux environment ?
[Miscellaneous Android Development] bgcngm:
AIK-Linux for Windows?!? As I said, get the Linux package and try the pre-built binaries first. You don't need to compile anything.
[Miscellaneous Android Development] DarkHeart Z:
bad news tried the precompiled binary (i686) . phone stuck at boot-logo . tried with stock boot.img 2 times . same result .
[Miscellaneous Android Development] osm0sis:
MTK has always done their own thing, ie. not following the standard, as I mention in the unsupported devices section of my AIK thread OPs, and I guess you'd well know since it's the reason for this thread. :(

My Cygwin-To-Linux cross-compiler should be able to handle building the MTK tool itself for Linux x86 if you have the sources and want to do things on Windows for some reason. Check out my Odds and Ends thread Knowledge Base post. Of course you could just compile things yourself on Linux natively too. :good:
[Miscellaneous Android Development] bgcngm:
I see you have compiled the binaries from source. Are you able to provide the 32-bit binaries, so that I can add to the repo?
[Miscellaneous Android Development] DarkHeart Z:
Bro extremely sorry last time . It's a false alarm . [MENTION=1143630]osmosis[/MENTION] 's binary actually worked but phone got repaired once so the motherboard got changed and so do complete phone's system rom . I mistakenly used bootimg of an old backup . I think that had some issues with the new system rom my oem gave in my phone so that is why phone stuck at boot logo . Otherwise osmosis's binary worked . But I will recheck it . Just wanna know if you changed or made adaption in mkbootimg source for mtk devices or you simply compiled them directly ?

---------- Post added at 10:13 PM ---------- Previous post was at 10:09 PM ----------

I have checked your cross compiler they all are only for cygwin . I wish there was a linux version of them also . But all of them are windows executable which will not work in the linux platform . But I don't know if latest gcc 4.9.1 will create issues compiling mkbootimg from sources :confused:
[Miscellaneous Android Development] DarkHeart Z:
well I have compiled and tested mkbootimg . It works on 32 bit linux . Here it is . I have attached it . I hope next time no 32 bit users will be disappointed . just remove the .img extension and it's good to go . tested and working . If anyone faces problem let me know :)
[Miscellaneous Android Development] bgcngm:
Have you compiled using source code from [MENTION=4544860]osm0sis[/MENTION] repo? The prebuilt binaries from AIK-Linux package would have worked anyway.
[Miscellaneous Android Development] osm0sis:
Linux has native compiling support out of the box pretty much, no need for a toolchain, and yeah the x86 ones from mine sounded like they work also? Either way, glad you got it working.
[Miscellaneous Android Development] DarkHeart Z:
It's actually the magic of perl script created by bgcngm . And I also compiled a binary from source you provided . It worked also . but i think mkbootimg source doesn't need to have an output request for unpackmkbootimg . There was an error when I finished compiling mkbootimg . And that said about some error in unpackmkbootimg .

---------- Post added at 11:12 PM ---------- Previous post was at 11:07 PM ----------

yes i did . i just wanted to be oversure and now i am for sure you can add it to your repo . It is tested :)
[Miscellaneous Android Development] Preet_:
Getting these errors while unpack-MTK.pl:

Extra arguments written to 'recovery.img-args.txt'

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

Error: the specified boot image does not appear to contain a valid gzip

file! no ramdisk written. how to fix this? [MENTION=455439]bgcngm[/MENTION]
[Miscellaneous Android Development] bgcngm:
Most likely you are trying to unpack a broken or non-MTK image file.
[Miscellaneous Android Development] Preet_:
I just got this 'ramdisk.img' 'boot.img' 'recovery.img' files from compiling a 5.1 ROM for MT6589. I copy-pasted the recovery.img, boot.img, ramdisk.img files in the root of the folder
[Miscellaneous Android Development] bgcngm:
Which MT6589 device? Be aware that Android One devices are not supported by this script.

And by the way, ramdisk.img is the ramdisk only, so it is obvious that script won't find any kernel.
[Miscellaneous Android Development] Preet_:
Negative, I do not have android one. I have Micromax A116. So what are the possible things which may work according to you?
[Miscellaneous Android Development] bgcngm:
As per the topic: MTK boot.img and recovery.img (and logo.bin).
[Miscellaneous Android Development] Preet_:
I do not have logo.bin. So when I pick that file from my devices' scatter files then too the problem persists.

Conclusion:

I got boot.img and recovery.img from compilation of 5.1 LP and

logo.bin from stock 4.2 JB.
[Miscellaneous Android Development] bgcngm:
From compilation, without boot and recovery images being repacked as MTK compliant images? Then maybe you need to unpack with a tool for standard Android images (AIK, for example) and then repack with this script in order to attach MTK headers to the ramdisk. Or better, take uncompressed ramdisk and zImage from the compilation output and repack using the repack script.
[Miscellaneous Android Development] Preet_:
I can get the ramdisk offset and some other ramdisk related information.

I didn't got the zImage after the compilation so I used the zImage which I obtained from cygwin's kitchen. But the results are same. uncompressed means? I got only one ramdisk.img; not mentioned that it is uncompressed
[Miscellaneous Android Development] bgcngm:
I don't know what you're doing, so can't help. If you are compiling a kernel you should know more about what is the ramdisk and kernel.
[Miscellaneous Android Development] Santhosh M:
U didn't add a custom mkbootimg.mk meant to add mtk header while the rom builds and hence all output images will be packed in standard android format. U will have to either unpack this with std tool nd then repack with mtk-tools or make ur build crct :)
[Miscellaneous Android Development] bgcngm:
Yeap, exactly what I said before.
[Miscellaneous Android Development] Preet_:
Yeah, I did the unpacking with cygwin and repacking with mtk-tools and it was successful. I got the new-recovery.img :)

Thanks!
[Miscellaneous Android Development] Nonta72:
Any chance to get support for the brand new MTK 64bit CPUs like MT6732, MT6735, MT6752, MT6753, MT6795 and MT6797 ?

Even if it unpack a boot.img for one of those CPUs :(
[Miscellaneous Android Development] bgcngm:
Why, isn't it working for those new SoC's?
[Miscellaneous Android Development] DerTeufel1980:
I think some of those newer soc use mtk header, while some don't. Don't know if there's some kind of logic in your script, to automatically handle this.

On mt6752 with mtk header, it is working fine

Gesendet von meinem JY-S3 mit Tapatalk
[Miscellaneous Android Development] bgcngm:
Actually, my scripts only handle boot/recovery images that contain the MTK header. If the header is not there it fails because scripts are not prepared for that. And in this case, the image is considered as a standard Android image, so the traditional tools should be used.

Anyway, I will think if is it worth to start supporting standard Android images.
[Miscellaneous Android Development] Santhosh M:
Hi bruno,

The issue is with 6752/6753 devices. While most manufacturers follow the new mtk method of using standard android headers, some don't and hence people try to use this tool and hence failing in ramdisk unpack failure :)

So u could add a point about it

Regards

Santhosh
[Miscellaneous Android Development] superdragonpt:
It depends on OEM now

On 6752 /6753/6735, etc

Some added MTK header(uboot), others didnt

So it'll still work for some, and fail for others

Its a (not so ) funny fact

Cheers
[Miscellaneous Android Development] JVitor:
I am using Ubuntu 15.10. Unpacked boot.img from MT8127 with no error messages. When trying to repack though, I get the folowing:
[Miscellaneous Android Development] bgcngm:
Check mkbootimg permissions.
[Miscellaneous Android Development] superdragonpt:
Hi

Own a tablet with the same SoC

I have no issues packing / re-packing kernels ( stock and custom )

Edit : PS: I'm using an older version

Cheers
[Miscellaneous Android Development] bgcngm:
Using Ubuntu 15.10 is fine, as I'm using it as well. The problem is the permissions or non-existing binary.
[Miscellaneous Android Development] vampirefo:
Any ideal why your script can't get ramdisk from this recovery? I have used your scripts for a log time, this is the first time they failed me. I can get kernel but not a useable ramdisk.

https://mega.nz/#!Z0Y1yJIQ!P3nRC4_9_TQQcuGuintRNdEYLCu7-0J36zwl78BIOT4

I am using Ubuntu 14.04 64bit if that makes a difference.

Update, carliv explained it to me, these mtk images don't include mtk headers, so your script doesn't work correctly on them.
[Miscellaneous Android Development] uttarayan21:
Could you give the mkbootimg source ???

The binary is not supported on my 32 bit kali linux
[Miscellaneous Android Development] vampirefo:
The source is in any cm source.

Most likely you will need 64bit to compile it, 32 bit Linux has little to no use in an android world.
[Miscellaneous Android Development] uttarayan21:
Never mind i already compiled it !!! It works like charm !!!
[Miscellaneous Android Development] uttarayan21:
Cygwin uses Perl 5.10 these scripts require Perl 5.14 so maybe that's the issue !!!

It was the issue with me in cygwin !!! So I used Kali Linux !!!
[Miscellaneous Android Development] meres5:
MT8752 device - Jlinksz K107 issue

Hi there!

I have to dig down into the rabbit hole on this,

since there is no kitchen ready stuff yet for it:

Model: Jlinksz K107 - 10 inch tablet

Arch: ARMv7 Processor rev 3, MT8752

Ver.: Android 5.1 Lollipop

MODEM: MOLY.WR8.W1449.MD.WG.V6.P13,2016/01/27 09:53

Kernel: 3.10.72+ buildserver@buildserver3 #1

Build: K107_vKB003I_20160507

What I've done already:

- at the adb shell prompt - su - and dump the images

Major ones ( there are many other of them) can be downloaded from here:

( sorry, I have no 10 posts yet) www yeuy net slash dump.

- Just for a kickstart, I have decided to customize the logo first -

thought to be not too harmless :)

Here is the first issue:

I was able to unpack the raw images from the logo by using your tool, but the png's were not created .

I've had a look in raw images and found that they are

RGBA, and not RGB, moreover their metrics are not listed in your logo_res.txt.

I can display and convert them like this:

display -depth 8 -size 1280x800 RGBA:mmcblk0p10_logo.img-img\[00\].rgb565

convert -depth 8 -size 1280x800 RGBA:mmcblk0p10_logo.img-img\[00\].rgb565 mainlogo0.png

I propose to include this in your logo_res.txt:

# Chinese Tab Jlinksz K107 - MT8752
[1280,800,]
[163,29,]
[114,32,]
[90,32,]
[163,1,]

I won't go further, until you validate that my stuff might be OK or not.

I can loop mount the etx4 system image - but I am not sure on this stuff...

I hope you can find the solution not for that logo stuff only - but for the boot/system

images for this little cheap - but yet powerful noname chinese tablet.

Regards,

meres5
[Miscellaneous Android Development] meres5:
Update:

It is BGRA, not RGBA.

Regards,

m5
[Miscellaneous Android Development] rmms:
Hi, I have a MT6582 from jlinksz, and after flashing the Rom, I'm getting "boot error" in some forum people mention that the problem is from UBoot ... I have replace the one that I have with other versions but nothing works ... any ideas?

Tks
[Miscellaneous Android Development] bgcngm:
Is that related to the scripts? It doesn't seems, so use device's own development forums to get support.
[Miscellaneous Android Development] rmms:
Ok, tks for the tip

Enviado do meu D6503 através de Tapatalk
[Miscellaneous Android Development] fays91:
Hey problem Xiaomi RedmiPro

./unpack-MTK.pl boot.img

MTK-Tools by Bruno Martins

MTK unpack script (last update: 06-01-2015)

Valid Android signature found...

Input file information:

Header:

Boot magic:	ANDROID!

Kernel size (bytes):	8272465	(0x007e3a51)

Kernel load address:	0x40080000

Ramdisk size (bytes):	2530767	(0x00269dcf)

Ramdisk load address:	0x45000000

Second stage size (bytes):	0	(0x00000000)

Second stage load address:	0x40f00000

Tags address:	0x44000000

Page size (bytes):	2048	(0x00000800)

ASCIIZ product name:	'6.11.17'

Command line:	'bootopt=64S3,32N2,64N2'

ID:	b6c6b03713f35838fbf280bf780f31f0a156996e

Other:

Boot magic offset:	0x00000000

Base address:	0x40078000

Kernel offset:	0x00008000

Ramdisk offset:	0x04f88000

Second stage offset:	0x00e88000

Tags offset:	0x03f88000

Extra arguments written to 'boot.img-args.txt'

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

Error: the specified boot image does not appear to contain a valid gzip

file!

Boot.img MTK-6797 ( Helio x25 )
[Miscellaneous Android Development] ranchu-panchu:
Hi,

I also tried to unpack logo, using 320x320 resolution, but I get several images:

It extart about ~40 images , some of the images are size of 409600, others 5760.

D6 is 320x320 reolution, so

1. what does 5760 refers to ?

2. 320x320x2 (rgb 565) = 204800, so why is it 409600 instead?

I succeeded opening the file in gimp, but only if using RGBA 320x320, while I expected it to be RGB565 ?

This is the latest NO.1 D6 firmware which I downloaded:

https://goo.gl/sIwUyO

from NO1 web site:

http://en.001phone.cn/download-50.html

Thanks for any idea,

Ranchu
[Miscellaneous Android Development] ranchu-panchu:
Hi,

The scrpts works very well, but in logo, I managed to edit files only if they are opened as RGBA (RGB8888 = 32 bits), 320x320 .

But aren't they expected to be 5GB565 ( = 16 bits) ?

logo.bin from stock:

https://drive.google.com/file/d/0B22GsWueReZTTnppZWUyM0FWdjQ/view?usp=sharing
[Miscellaneous Android Development] alex9099:
I'm trying to create a boot.img from a precompiled boot.img,

your tool extracts the precompiled correctly, but when i repack everything using the precompiled ramdisk and zImage (from a kernel i compiled) it wont boot, from the output it seems like the offsets became messed up,

here is the unpack log : http:/ /pastebin. com/RkwTVLar

and repack log: http: //pastebin. com/DkxGiEhR

It seems like you are portuguese, if you want to help me in portuguese via PM your welcome :)
[Miscellaneous Android Development] ranchu-panchu:
zImage

Hi,

Is the extarcted kernel is actually zImage ?

Can I build kernel and pack it again using this tool ?

Thanks,

Ranchu
[Miscellaneous Android Development] sameer_gangar:
help please!!!

i want to just add swap support to my kernel.

but i cant get a new kernel because i am using a ported rom and cant find kernels for it

can you please tell me that if it is possible that i cant edit my kernel and swap support to it .

thanks in advance:good::good::good:
[Miscellaneous Android Development] bgcngm:
No, you can't "edit" the kernel. What you are trying to do requires kernel sources.
[Miscellaneous Android Development] sameer_gangar:
I want to make it swap supported

Is there anything i can do????
[Miscellaneous Android Development] bgcngm:
If you need the kernel sources and you don't have it then no, there's nothing you can do.
[Miscellaneous Android Development] sameer_gangar:
but if i have them can i change it to make it support swap??