Mi 9 Splash / Boot Image creation script.

Search This thread

Nicolas72

Member
Nov 20, 2014
28
37
Rainy Sunday so I thought i would change the dull boot splash screen of my new MI 9.

Usage is easy enough (provided you have python installed)

The MI9 Logo.img contains 4 images in BMP format.

1. The regular LOCKED boot screen
2. The Fastboot screen.
3. The UNLOCKED boot screen.
4. The screen you hope you will never see...System destroyed.

Image dimensions MUST be in 1080x1920 format BMP 24Bit. (Check to see if your file size of each individual picture is 6.2MB when you create one.)

During boot Xiaomi displays picture 1 and if unlocked, then picture 3. So if you want a consistent appearance you have to have both set to the same picture.

The python script is about as simple as it gets. The only annoying thing was to find the proper offsets for the MI9.

Replace the images with the new ones that you would like displayed..and you are ready to run the script.

Usage of the python script would be : python mi9_logo.py and thats it. (Of course this all depends on your environment)
Once the script is done you should see a file called : logo_new_mi9.img in the directory.
This one you can simply flash via fastboot.
Command is like this : fastboot flash logo logo_new_mi9.img
followed by : fastboot reboot

Hope someone will find this post helpful.

Cheers

Nicolas

Edit : New python script
 

Attachments

  • 01.png
    01.png
    10.1 KB · Views: 4,179
  • 02.jpg
    02.jpg
    67.2 KB · Views: 4,143
  • 03.png
    03.png
    13.4 KB · Views: 3,959
  • 04.png
    04.png
    19.3 KB · Views: 4,021
  • Mi9Logo.zip
    429.3 KB · Views: 1,207
  • mi9_logo-1080-2340.py.zip
    466 bytes · Views: 999
Last edited:

Yankarin

Senior Member
Aug 5, 2017
68
15
Amazing! yesterday I was just wondering how could I change this!
One question: please take a look at the Mi 9 boot: with your tool we can edit the really first static image (the one before the powered by android animation comes in), right?

So to sum it up, the android boot works like this:
Bootloader locked: static image (Mi mi.com) -> animation (Mi mi.com powered by android) -> lock screen
Bootloader unlocked: static image (Mi mi.com ? unlocked) -> animation (Mi mi.com powered by android) -> lock screen

Am I right?
Sorry if this can seem redundant but I'd like to understand how things work and this will be surely helpful for others.
 

Nicolas72

Member
Nov 20, 2014
28
37
If your bootloader is locked you will only see image 1 > boot animation from /media.
If your bootloader is unlocked you will see image 1 followed by image 3 > boot animation from /media.
As I said before, if you want a consistent image displayed with an unlocked bootloader you need to set picture 1 and 3.
That is why the images are labeled pic1.bmp , pic2.bmp , pic3.bmp and pic4.bmp.
Change pic1.bmp and pic3.bmp for unlocked bootloader...
Hope that clarifies it a little bit.
 
  • Like
Reactions: Yankarin

Yankarin

Senior Member
Aug 5, 2017
68
15
Thank you now this is very clear.
Any chance you know how to extract these 4 (pic1... pic.bmp) original files from the Mi 9?
Maybe these could be useful (from my Mi 9):
logo /dev/block/sde47
splash /dev/block/sda21
 

Nicolas72

Member
Nov 20, 2014
28
37
Logo extraction via hex editor...

Well it is easy enough using a hex editor or if you feel really bored, write a python script for it. I did not bother with writing a script since i only needed the originals from my MI9 once..so i did it manually.

Anyways... I took the logo.img from the original global rom zip file.
You can extract them from you currently running system via
su dd if=/dev/block/bootdevice/by-name/splash of=/sdcard/splash.img
(Splash dump was completely empty for me so i do not know what is supposed to be in there)
su dd if=/dev/block/bootdevice/by-name/logo of=/sdcard/logo.img

Once you have those you just open the logo.img in a hex editor and go to offset $4000
There you will find the logo identifier "LOGO!!!!" text followed by the offsets for the individual pictures.
Best seen in the snippet of the python script

offset0 = 0x4000 Logo ID
offset1 = 0x5000 First Image start offset
offset2 = 0x5f4000 Second Image start offset
offset3 = 0xBE3000 Third Image start offset
offset4 = 0x11D2000 Fourth Image start offset

outpt = open("logo_new_mi9.img", "wb") Create the new logo.img

emptyContent = [0 for i in range(0x17c1000)] Just to make sure we have all 0's

mi9offset = [0x4C, 0x4F, 0x47, 0x4F, 0x21, 0x21, 0x21, 0x21, 0x05, 0x00, 0x00, 0x00,
0xEf, 0x05, 0x00, 0x00, 0xF4, 0x05, 0x00, 0x00, 0xEF, 0x05, 0x00, 0x00,
0xE3, 0x0B, 0x00, 0x00, 0xEF, 0x05, 0x00, 0x00, 0xD2, 0x11, 0x00, 0x00,
0xEf, 0x05]
mi9 offset is the interesting part
this contains the text LOGO!!!! in hex 0x4C, 0x4F, 0x47, 0x4F, 0x21, 0x21, 0x21, 0x21
followed by the offset for the first picture and its length.. 2 words length in little endian
meaning 0x05,0x00,0x00,0x00 becomes $5000 aka...first picture start
0xF4,0x05,0x00,0x00 becomes $05f4000 = size of picture in bytes
0xF4,0x05,0x00,0x00 becomes $005f4000 = offset start of picture 2
This process repeats until we reach picture 4.
Since we are dealing with BMP images you could just search the file for occurrences of "BM" which indicated the BMP header.
Simple copy and paste from beginning of one BM header to the next will give you the original BMP.

As I said..I only wanted the original logos once...so i was way to lazy to write the python for it, even tho it is quick.

Nicolas
 

gryffynmp

Member
Nov 1, 2017
17
9
I've made a custom splash logo showing the specs of the phone in an 8-bit style.

Here's the img file
 

Attachments

  • pic1.png
    pic1.png
    10.3 KB · Views: 1,692
  • pic3.png
    pic3.png
    17.8 KB · Views: 1,702
Last edited:
  • Like
Reactions: imna357 and ren7o

Yankarin

Senior Member
Aug 5, 2017
68
15
Extracted from a Pixel 3 XL, here are the original Google bootscreen ported for our Xiaomi Mi 9!
I adapted them to 1080x1920 and, as a bonus, there is also the Android Q version with a black background. The horizontal ratio (splashx:screenx) is the same as the Pixel 3 XL.
Hope you have fun!

If you run Pixel Experience on the Mi 9, please please make a video of the Mi 9 booting with this bootscreen and the Pixel Experience bootanimation!
 

Attachments

  • cepheus-bootscreen-stock.7z
    334.1 KB · Views: 82
  • cepheus-pixel-bootscreen-2.0.0-final.7z
    345.6 KB · Views: 83
  • cepheus-pixel-bootscreen-dark-2.0.0.7z
    345.9 KB · Views: 152
Last edited:
  • Like
Reactions: gianton

zipsu

Senior Member
Jan 26, 2018
186
54
Works great! Had this on my old Mi6 and now on Mi9 as well :)) Also I think it's possible to flash the logo in TWRP (the chinese one that lists all partitions)? So I could keep flashing the img after every update without having to connect to a PC.
 

gianton

Inactive Recognized Contributor
Feb 5, 2009
12,021
9,953
Thessaloniki
Xiaomi Mi Mix 2S
Xiaomi Mi 9
Extracted from a Pixel 3 XL, here are the original Google bootscreen ported for our Xiaomi Mi 9!
I adapted them to 1080x1920 and, as a bonus, there is also the Android Q version with a black background. The horizontal ratio (splashx:screenx) is the same as the Pixel 3 XL.
Hope you have fun!

If you run Pixel Experience on the Mi 9, please please make a video of the Mi 9 booting with this bootscreen and the Pixel Experience bootanimation!

Here is the logo with your images... on PE latest build. Black is great!

White

Black
 

Nicolas72

Member
Nov 20, 2014
28
37
@Nicolas72 Is it also possible to create a 1080*2340 boot-logo? Thank you very much for your great work!

Not quite sure, could be that the boot process only supports 1080x1920..since this is the size of the original one.
Creating it should not be a problem but the offsets need to be recalculated.
I will upload a new script for that size probably tomorrow. So you can try at your own risk hehehe.
(It will not explode or anything thats for sure)

Nicolas
 
  • Like
Reactions: lukigoes

lukigoes

Senior Member
Apr 22, 2013
162
36
Not quite sure, could be that the boot process only supports 1080x1920..since this is the size of the original one.
Creating it should not be a problem but the offsets need to be recalculated.
I will upload a new script for that size probably tomorrow. So you can try at your own risk hehehe.
(It will not explode or anything thats for sure)

Nicolas

That would be really great, thank you very much in advance. If it works I surely will share my design. :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 20
    Rainy Sunday so I thought i would change the dull boot splash screen of my new MI 9.

    Usage is easy enough (provided you have python installed)

    The MI9 Logo.img contains 4 images in BMP format.

    1. The regular LOCKED boot screen
    2. The Fastboot screen.
    3. The UNLOCKED boot screen.
    4. The screen you hope you will never see...System destroyed.

    Image dimensions MUST be in 1080x1920 format BMP 24Bit. (Check to see if your file size of each individual picture is 6.2MB when you create one.)

    During boot Xiaomi displays picture 1 and if unlocked, then picture 3. So if you want a consistent appearance you have to have both set to the same picture.

    The python script is about as simple as it gets. The only annoying thing was to find the proper offsets for the MI9.

    Replace the images with the new ones that you would like displayed..and you are ready to run the script.

    Usage of the python script would be : python mi9_logo.py and thats it. (Of course this all depends on your environment)
    Once the script is done you should see a file called : logo_new_mi9.img in the directory.
    This one you can simply flash via fastboot.
    Command is like this : fastboot flash logo logo_new_mi9.img
    followed by : fastboot reboot

    Hope someone will find this post helpful.

    Cheers

    Nicolas

    Edit : New python script
    4
    For those who are to lazy to get behind a laptop each time.

    You can use the Lanthanum app from this thread.
    https://r.tapatalk.com/shareLink?ur...share_tid=3942063&share_fid=3793&share_type=t

    Choose "Logo" to flash
    4
    That would be really great, thank you very much in advance. If it works I surely will share my design. :)

    Changed the offsets. Works for me. 1080x2340 display.

    enjoy

    Nicolas
    3
    Logo extraction via hex editor...

    Well it is easy enough using a hex editor or if you feel really bored, write a python script for it. I did not bother with writing a script since i only needed the originals from my MI9 once..so i did it manually.

    Anyways... I took the logo.img from the original global rom zip file.
    You can extract them from you currently running system via
    su dd if=/dev/block/bootdevice/by-name/splash of=/sdcard/splash.img
    (Splash dump was completely empty for me so i do not know what is supposed to be in there)
    su dd if=/dev/block/bootdevice/by-name/logo of=/sdcard/logo.img

    Once you have those you just open the logo.img in a hex editor and go to offset $4000
    There you will find the logo identifier "LOGO!!!!" text followed by the offsets for the individual pictures.
    Best seen in the snippet of the python script

    offset0 = 0x4000 Logo ID
    offset1 = 0x5000 First Image start offset
    offset2 = 0x5f4000 Second Image start offset
    offset3 = 0xBE3000 Third Image start offset
    offset4 = 0x11D2000 Fourth Image start offset

    outpt = open("logo_new_mi9.img", "wb") Create the new logo.img

    emptyContent = [0 for i in range(0x17c1000)] Just to make sure we have all 0's

    mi9offset = [0x4C, 0x4F, 0x47, 0x4F, 0x21, 0x21, 0x21, 0x21, 0x05, 0x00, 0x00, 0x00,
    0xEf, 0x05, 0x00, 0x00, 0xF4, 0x05, 0x00, 0x00, 0xEF, 0x05, 0x00, 0x00,
    0xE3, 0x0B, 0x00, 0x00, 0xEF, 0x05, 0x00, 0x00, 0xD2, 0x11, 0x00, 0x00,
    0xEf, 0x05]
    mi9 offset is the interesting part
    this contains the text LOGO!!!! in hex 0x4C, 0x4F, 0x47, 0x4F, 0x21, 0x21, 0x21, 0x21
    followed by the offset for the first picture and its length.. 2 words length in little endian
    meaning 0x05,0x00,0x00,0x00 becomes $5000 aka...first picture start
    0xF4,0x05,0x00,0x00 becomes $05f4000 = size of picture in bytes
    0xF4,0x05,0x00,0x00 becomes $005f4000 = offset start of picture 2
    This process repeats until we reach picture 4.
    Since we are dealing with BMP images you could just search the file for occurrences of "BM" which indicated the BMP header.
    Simple copy and paste from beginning of one BM header to the next will give you the original BMP.

    As I said..I only wanted the original logos once...so i was way to lazy to write the python for it, even tho it is quick.

    Nicolas
    2
    I've made a custom splash logo showing the specs of the phone in an 8-bit style.

    Here's the img file