2

Don't remove this question please, it was previously removed from a programming board and I don't know where else to ask.

What is a logo partition and what is the format of it?

The header of the 8Mb partition:

00000000   88 16 88 58  C2 8A 0A 00  ...X....
00000008   4C 4F 47 4F  00 00 00 00  LOGO....

I guess it is a bootscreen picture, right ? What is the format of this image ?

2 Answers 2

2

1. What is “logo” partition on a lenovo phone?

The logo partition (based on my experience with Mediatek devices) contains :

  • The very first boot logo (not the Boot Animation)
  • Battery Charging Sequences (many png images).
  • Second boot logo (boot_logo file).
  • Battery charging digits and percentage sign (each digit or sign has its own image).
  • (For devices supporting Fast Charge) Fast charging sequences (many png images)

2. I guess it is a bootscreen picture, right ?

Not the boot logo only, It contains many images.

3. What is the format of this image ?

Not one image only, all of them are PNG files.

4. Additional details

88 16 88 58 is the partition offset.

C2 8A 0A 00 is the partition size, this is little endian byte order.

4C 4F 47 4F is the partition name.

I can't confirm if this is Mediatek specific or not.

Mediatek MT65xx/MT67xx Logo Editor

If you wish to change the very first boot logo (not the boot animation) of your device based on MT65xx/MT67xx platforms. Try LogoBuilder.

LogoBuilder can unpack and repack your logo.bin file which contains :

  • Boot logo
  • Battery Charging Sequences.
  • Second boot logo (boot_logo file).

LogoBuilder is simple to use:

  • Unpack your logo.bin file.
  • Edit what you want.
  • Re-pack it.

The LogoBuilder can make an update.zip to flash your new logo.bin file with a custom recovery.

Edit:

6
  • Nice! Is there a specification or source code of the such "logobuilder" ? Where is the first byte address and "png" metadata located ? Because I don't see there any recognizable png headers inside...
    – L.Integra
    Feb 26, 2018 at 12:44
  • You don't see them because the file is packed/encrypted, how to unpack it ask the developer.
    – M. A.
    Feb 26, 2018 at 13:20
  • But "ask the developer" does not answer the question what the format of the partition is :)
    – L.Integra
    Feb 26, 2018 at 13:22
  • You could edit your question or start another thread with the title "How logo.bin is packed / encrypted in MTK phones"
    – M. A.
    Feb 26, 2018 at 13:24
  • why another ? all that you said - just commented on the very obvious data in the header . I have to copy paste my question again .. can you please remove your answer ?
    – L.Integra
    Feb 26, 2018 at 13:29
1

The images in the logo partition are raw 32-bit pixel data, possibly bgra or rgba, compressed with zlib but with no compression header.

Skip the 512-byte header, and this is what you see (yours will be different, this is from a BLU Dash X2 phone).

00000200: 2700 0000 f929 1300 a400 0000 012e 0000  '....)..........
00000210: 3b36 0d00 05bb 0d00 4e07 0e00 4a09 0e00  ;6......N...J...
00000220: d709 0e00 b20b 0e00 060e 0e00 8f0f 0e00  ................
00000230: ac11 0e00 0814 0e00 3c15 0e00 d517 0e00  ........<.......
00000240: 451a 0e00 2b1d 0e00 d82b 0e00 763b 0e00  E...+....+..v;..
00000250: f84a 0e00 a959 0e00 4d67 0e00 3874 0e00  .J...Y..Mg..8t..
00000260: 1382 0e00 4f91 0e00 f6a0 0e00 6bb0 0e00  ....O.......k...
00000270: f90b 0f00 0068 0f00 bcc3 0f00 9b1c 1000  .....h..........
00000280: d573 1000 9cca 1000 6223 1100 647e 1100  .s......b#..d~..
00000290: c8da 1100 f536 1200 ae89 1200 658b 1200  .....6......e...
000002a0: 9cfc 1200 78da ecdd 3daf e458 42c7 e1fe  ....x...=..XB...

The numbers are 32-bit integers, and the first one at offset 0x200 is 0x27, or 39, pictures in the logo partition. 0x1329f9 is the total length of the data; the rest of the partition will probably be padded with zeroes. The next 39 integers are the offsets of each image, for example the first is at offset 0xa4, plus 0x200 to account for the header, and you have 0x2a4. So you can see the first 12 bytes of data in the xxd output above, 0x78 0xda 0xec 0xdd...

The size of the image will be the following offset minus "this" offset: in this case, 0x2d01 - 0xa4 = 0x2d5d, or 11613 decimal.

So now you have what you need to extract the first image: dd if=/tmp/logo.bin of=/tmp/img1.z bs=1 skip=$((0x2a4)) count=11613

To uncompress it, since it has no header, you have to add one: printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - /tmp/img1.z | gzip -dc >/tmp/img1.dat.

You can then display it using ImageMagick: display -size 360x$(($(stat -c %s /tmp/img1.dat)/$((360*4)))) rgba:/tmp/img1.dat

Information is from rigacci.org. Niccolo includes a Python script that extracts all the images for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .