rom1nux / mtkimg

Unpack/Repack boot.img, recovery.img and logo.bin for Mediatek CPU based devices
GNU General Public License v3.0
63 stars 27 forks source link

Error unpacking logo.bin: unsupported header signature and RGB format #6

Open RigacciOrg opened 5 years ago

RigacciOrg commented 5 years ago

I tried to unpack a logo.bin from a Gretel A7 (based on the MT6580), but mtkimg fails with:

ERROR : Logo header type is not valid !

The problem is the case of the string "LOGO" at offset 0x08, the program expects an uppercase string, where I have a lowercase one. After fixing that, there is another problem with the decoding of the raw data. It seems that mtkimg expects an RGB565 formats (16 bit), but in my case I have images in bgra format (32 bit).

I successfully decoded the binary files (after z-decompressing) with:

ffmpeg -y -vcodec rawvideo -f rawvideo -pix_fmt bgra -s 720x1280 -i file.bin -f image2 -vcodec png file.png

MayCXC commented 3 years ago

For anyone who finds this, @RigacciOrg has a script and instructions in this post that worked on my android 10 BLU G90 pro with TWRP fastboot. Obtaining boot.img is another process, I copied it with dd if=/dev/block/by-name/logo of=/sdcard/logo.bin count=1 bs=$(blockdev --getsize64 /dev/block/by-name/logo) and adb pull /sdcard/logo.bin. It seems like a fully featured tool to perform this would have to figure out how the dimensions of the logos are computed, but in my case I just wanted to change the full screen ones, so in logo.d I ran wc -c * | sort -n and only converted the largest bins to pngs. (Don't forget to delete their .z counterparts before repacking.) Finally, for me it was easiest to flash the repacked image with adb reboot fastboot and fastboot flash logo logo.repack.bin.