[WIP][MOD][SPLASH][OP6] Splash Screen Image Injector

makers_mark

Senior Member
Sep 21, 2013
192
475
0
Kings Mountain
Hey folks, thanks to @iElvis sharing his or her logo 'data' from the OP6. I have adapted my previous OnePlus programs that let you change the splash screen to work with the OP6. This means that the encoding of the data structure and the encoding of the image data are done. I do not have a OP6 and can not test certain things like where to put the modified file. In the past, flashing was always easy (and always has been especially with the OnePlus models).

My holdup and why I need the XDA/OP6 community support is to find out where to exactly put this modified file. In the past I haphazardly made a super fast in-memory program for altering the splash screen for the Nexus 6p that was (and is currently) at a roadblock for one reason. That reason was Google used ELFs to populate partitions (not short people with pointy ears and green clothing), and at that time utilized separate partitions that the ELFs populate. Not all were ELF generated, but that is outside of the scope of what I do because to a certain point the ones that I wanted to change were generated that way.

This concept of splitting partitions, back then, was just trying to grab a footing on seamless upgrades initially from what I have read up until this newer style. I have put some research into some things involving this, but Google is kind of bland in it's description of what this all means. This is different than the Nexus 6P that I mentioned previously, and if you read that last link, it may be just as easy as flashing it to both partitions logo_a & logo_b. One partition is always active and has two different statuses, which make the device 'ideally' always bootable after an OS update.

Most of my research was done through reading a lot of the open source code put out by the AOSP for "fastboot". You can learn more than you can ever derive from documentation in this realm. I hope to hear some feedback of attempts so that I can delete all of this up above:cowboy:


Please read below so you can better understand this type of encoding being used:
What Is A Raw Image?

A raw image, whether it be a file or an image in memory, is simply pixel data. There is no extra information like width, height, name, end of line... Absolutely nothing, just pixel data. If you have an image that is raw and the resolution is 1080x1920 and you are using a typical RGB24 or BGR24 (like the ones used here), then your exact filesize or size in memory will be 1080x1920x3! We use 3 here because there is one byte for the R or red component, one for the G (green), and one for the B(blue).

What Is A Run Length Encoded Image?

A run length image encoding uses a count ;usually a single byte (char), 2 bytes (short int), or 4 bytes (long int); and then the pixel components. So instead of writing out 300 bytes of '0's to make a line of 100 black pixels. Black is RGB(0,0,0). You could encode this as 100, 0, 0, 0. And only use 4 bytes of data to get the exact same image as the 300 byte raw image. All the run length encoding I've found, except the Motorola style which is a little different, use a run length encoding that is pixel-oriented like this.

Now I've found this new one and it is a byte-oriented run length encoding. This is for runs of bytes, not pixels. You may think, well whats the big deal? When you add a little area of color, you increase the run length encoded image in you logo.bin immensely! You use 6 bytes per pixel if there aren't any runs of color data. If you had an image that was a 1080x1920 black image with a 25 pixel horizontal line in the middle. The encoder would be doing runs of black data efficiently until it reached the red area.
.....0 255 0 255 0 255 0 255 0 255 0 133 /// we've reached the top left corner of the red line /// 13 1 30 1 255 1 // << that was just one red pixel!! in bgr color order (13, 30, 255) <<// And it keeps going through the rest of the red pixels on that line using 6 bytes per pixel, which is the opposite of compression. Before reaching the red line the encoding was decoding to 255 zeros over and over, until finally 133 zeros. 255 zeros is 85 black pixels stored in just 2 bytes!

This type of encoding is ONLY good for grey scale images. It is not good with color, but it still will handle color of course. In grey scale, the Red, Blue, and Green data components are always the same values. All the way from black (0,0,0) to white (255, 255, 255); including every shade of grey in between>>>(1,1,1) (2,2,2) (3,3,3)....(243, 243, 243) (254, 254, 254)<<<

One other difference in this method of run length encoding is that the color byte is before the count, which is backwards from all of the other methods.​

The attachment contains the executable that was compiled using mingw32 on a 64 bit Windows 10 PC. The awesome PNG library that I used for generating the pngs is LodePng, the source can be found here.

To use the OnePlus 6 Logo Injector:

Decode your logo.bin:
Code:
OP6Logo -i logo.bin -d
All the PNG 's will be extracted from logo.bin. Edit the PNG(s) that you want to change...

Note:
Your original "logo.bin" file is never changed, it is just read. If the file you try to load isn't a logo file, or a different style, then the program will tell you and exit.​

Inject the image(s) back in to the logo.bin:
Code:
OP6Logo -i logo.bin -j fhd_oppo fhd_at
To list whats in your logo file:
Code:
OP6Logo -i logo.bin -l
For a more detailed list:
Code:
OP6Logo -i logo.bin -L
If the colors are messed up use the "-s" switch while decoding.
Code:
OP6tLogo -i logo.bin -d -s
If you had to use the "-s" switch to decode properly, you'll have to use it to inject also:
Code:
OP6Logo -i logo.bin -j image_name -s
Note:
You can put as many names after "-j" as you want, and it's not case sensitive. You also don't have to put the whole name. If you just put "-j fhd" every image in the logo.bin that starts with "fhd" will be injected. There has to be a PNG with the name in the directory though​

The size of your modified.logo.bin will displayed along with the original size, if everything went good. The 'splash' partition is 16 MB on the OP6. If you use too much color on too many of the images you will easily go over 16 MB. The program will tell you and delete the "modified.logo.bin" that was created. If for some strange reason you would like to keep it, use the "-B" flag on the command.

The last step is to flash the modified logo file via fastboot with the command
Code:
fastboot flash LOGO modified.logo.bin

Use this at your own risk.
Always make backups.
Always.
 

Attachments

Last edited:

iElvis

Senior Member
May 24, 2012
5,013
2,826
253
Modville
I haven't had a chance to work up a custom splash and flash it just yet, in part because I realized that on this phone, the splash screen only shows up for a split second before it's replaced by the "Your phone is unlocked and insecure, don't put sensitive files on it blah blah" warning. So I'm not sure this is going to do a whole lot for us. I'm going to try later tonight or this weekend and report back. Pretty sure "flash logo" should work fine, but it will flash only to the active partition. We may need to "flash logo_a" and "flash logo_b" to get it on both partitions.

Also, thanks for posting the source. I'm going to see if I can get this to compile in Xcode so we have an OSX version.

Edit 6/10: I can't get it to compile in Xcode, but I'm sure it's something I'm doing wrong.
 
Last edited:

iElvis

Senior Member
May 24, 2012
5,013
2,826
253
Modville
Okay, welp, I'm throwing in the towel on this one. The bootloader warning is not in text like it was on the HTC phones I've modded to remove it. On those phones, the text showed up in the bootloader file in a hex editor, and could be replaced with empty spaces to remove it.

I pulled the boot file from /dev/block/bootdevice/by-name/ and searched through it. None of the text in the warning can be found with a simple search. As I suspected, that warning screen looks like it's a function coded into the boot process, which means removing it is probably impossible.
 

gao0309

New member
Oct 24, 2018
1
0
0
work Fine !

file :
lodepng.h
lodepng.c
OP6Logo.c

# gcc lodepng.c -c
# gcc OP6Logo.c -c

# gcc *.o -o OP6_prog OR # gcc lodepng.o OP6Logo.o -o OP6_prog


# ./adb shell
# su
# cd /dev/block/bootdevice/by-name

# ls --color --all
lrwxrwxrwx 1 root root 16 1970-01-06 04:29:20.549999999 +0100 LOGO_a -> /dev/block/sde20

# dd if=LOGO_a of=/sdcard/LOGO_a
exit

# ./adb pull /sdcar/LOGO_a ./

# OP6_prog -i LOGO_a -d

MODIFY YOUR PICTURE .....

# ./OP6logo -i LOGO_a -j fhd_

you have modified.logo.bin
Just dd if of and work fine !

And for the Real Splash :

./adb pull /system/media/bootanimation.zip ../


God bless
 
Last edited:

NateDev

Senior Member
Aug 18, 2016
705
150
43
Mississauga
file :
lodepng.h
lodepng.c
OP6Logo.c

# gcc lodepng.c -c
# gcc OP6Logo.c -c

# gcc *.o -o OP6_prog OR # gcc lodepng.o OP6Logo.o -o OP6_prog


# ./adb shell
# su
# cd /dev/block/bootdevice/by-name

# ls --color --all
lrwxrwxrwx 1 root root 16 1970-01-06 04:29:20.549999999 +0100 LOGO_a -> /dev/block/sde20

# dd if=LOGO_a of=/sdcard/LOGO_a
exit

# ./adb pull /sdcar/LOGO_a ./

# OP6_prog -i LOGO_a -d

MODIFY YOUR PICTURE .....

# ./OP6logo -i LOGO_a -j fhd_

you have modified.logo.bin
Just dd if of and work fine !

And for the Real Splash :

./adb pull /system/media/bootanimation.zip ../


God bless
Way to remove bootloader unlocked warning?
 
  • Like
Reactions: mitas35

foobar66

Senior Member
Jan 8, 2011
1,755
1,751
133
Brussels
I'm trying this on linux on a 6T boot splash screen but I get a segmentation fault:

Code:
__________________________________________________________-_-
OP6 Logo Injector v1

Written By Makers_Mark @ XDA-DEVELOPERS.COM
_____________________________________________________________

FILE: logo.bin
_____________________________________________________________

RGB is the color order. Use "-s" switch to change it to BGR.

#01: Offset:0 
Header=SPLASH!!
Width=1080
Height=1920
Data Length=81798
Special=1
Name=
Metadata=
Segmentation fault
Any idea why?
 

4396316

Member
Oct 6, 2016
18
1
3
I tried to report that the error memory could not be read under Windows 10 and wimdows7. Then I executed the following instructions under Linux and still reported the error. What can I do, oneplus 6, Android 9.0?

gcc lodepng.c -c
gcc OP6Logo.c -c
gcc *.o -o a.out
./a.out -i logo.bin -d


The following are the results of implementation:

__________________________________________________________-_-
OP6 Logo Injector v1
Written By Makers_Mark @ XDA-DEVELOPERS.COM _____________________________________________________________
FILE: logo.bin _____________________________________________________________
BGR is the color order. Use "-s" switch to change it to RGB.
#01: Offset:0
Header=SPLASH!!
Width=1080
Height=1920
Data Length=77716
Special=1
Name=
Metadata=
Segmentation fault
 

Diazz72

Senior Member
Mar 11, 2012
485
629
133
Pula ( Croatia )
Code:
C:\Users\denie\Documents\logo>OP6Logo -i logo.bin -d
__________________________________________________________-_-
OP6 Logo Injector v1

Written By Makers_Mark @ XDA-DEVELOPERS.COM
_____________________________________________________________

FILE: logo.bin
_____________________________________________________________

BGR is the color order. Use "-s" switch to change it to RGB.

#01: Offset:0
Header=SPLASH!!
Width=1080
Height=1920
Data Length=81798
Special=1
Name=
Metadata=

C:\Users\denie\Documents\logo>
Any ideas?
 

flash713

Senior Member
May 7, 2015
879
435
93
Houston, Texas
There's no way to hide the Google warning about unlocked bootloaders, if that's what you mean.
Really... This is what I've been searching all over for for my 6t... Get rid of the stupid bootloader unlock warning. On all my other devices we always used a custom made boot-logo.bin and installed it on slot a and slot b using fastboot.. I guess if it could be covered up it definitely would have by now. ?

Edit added: I just read the thread. From what I've gathered basically this device (6&6t) is designed different and that's why we can't tamper with/cover up the bootloader warning message.
 
Last edited:

iElvis

Senior Member
May 24, 2012
5,013
2,826
253
Modville
Really... This is what I've been searching all over for for my 6t... Get rid of the stupid bootloader unlock warning. On all my other devices we always used a custom made boot-logo.bin and installed it on slot a and slot b using fastboot.. I guess if it could be covered up it definitely would have by now. ?

Edit added: I just read the thread. From what I've gathered basically this device (6&6t) is designed different and that's why we can't tamper with/cover up the bootloader warning message.
I gave up after a lot of experimenting. I'm not aware of anyone managing it.
 
  • Like
Reactions: flash713

flash713

Senior Member
May 7, 2015
879
435
93
Houston, Texas
I gave up after a lot of experimenting. I'm not aware of anyone managing it.
You should get an award for your XDA signature. ?? It's funny because it's real and oh so true! The way some people comment on things never ceases to blow me away. I see some posts and I think to myself, "what the hell?" "Who raised this person!?" There are definitely many different types of humans out there in the world that's a fact. I try and stay out of it as much as possible. ? lol.

It sucks we can't just make a ton of boot logos and cover that up. Oh well the 6 & 6t are awesome devices!! Usually whenever I end up on down the road selling my phone and purchasing another one from eBay or swappa things similar to this begin to be solved and then 15 custom roms all drop outa nowhere all at once. ? Happens every...single...time...haha!! Thanks for giving it a shot! :good: