cancel
Showing results for 
Search instead for 
Did you mean: 

Modify Kernel splash screen image (psplash-drm)

SScar.2
Senior

Hi there,

I've got an STM32MP157F-DK2 devkit, I managed to set up all the packages, including Yocto distribution (Distribution Package) and all seems to be working fine for me.

Now I'm starting to modify ST distribution, just to get used to the environment. ... I'm working on the splash screens right now.

I easily changed the Uboot splash screen: I only needed to modify .bb recipe for uboot splash and copy the correct images to the right folder. Now I'm trying to modify also the Kernel splash screen, and things started to get really confusing... I did some research and I discovered that the ST meta-layer seems to use a modified version of psplash script from Poky. I found that in the layer meta-st/meta-st-openstlinux/recipes-core/psplash/psplash-drm there's what I'm looking for. However, I can't figure out how to make things work properly. What do I have to change? What kind of images should I use? (I tried png 480x272 8bits depth but they seem not working)

Thanks so much

Simone

1 ACCEPTED SOLUTION

Accepted Solutions
Erwan SZYMANSKI
ST Employee

Hello @SScar.2​,

Regarding the layer, it seems that the psplash-drm recipe is waiting for 2 images of the same format as PNG already present in the layer, and the same format that you tried (1 for landscape and 1 for portrait orientation). 

PNG image data, 480 x 272, 8-bit colormap, non-interlaced

However, the program that will display the splash screen cannot work with a PNG directly, and needs to generate the image_header.h that describes the picture. It is used by basic_splash_drm.c program (you can observe this file in the layer).

To generate the header file, you can see that the Makefile has a special rule generate_header that will target to 2 files mentioned at the top of it.

Take together a look at the Makefile of the layer in OSTL-4.0:

SPLASH_IMG ?= ST13028_Linux_picto_11_480x272_8bits.png
SPLASH_IMG_ROT ?= ST13028_Linux_picto_11_480x272_8bits_rotation.png
 
all: modeset
 
generate_header: $(SPLASH_IMG) $(SPLASH_IMG_ROT)
	@gdk-pixbuf-csource --macros $(SPLASH_IMG) > image_header.tmp
	@(sed -e "s/MY_PIXBUF/SPLASH_IMG/g" -e "s/guint8/uint8_t/g" image_header.tmp > image_header.h && rm image_header.tmp)
	@gdk-pixbuf-csource --macros $(SPLASH_IMG_ROT) > image_header.tmp
	@(sed -e "s/MY_PIXBUF/SPLASH_IMG_ROT/g" -e "s/guint8/uint8_t/g" image_header.tmp >> image_header.h && rm image_header.tmp)
 
psplash:
	$(CC) $(CFLAGS) $(LDFLAGS) -o psplash-drm basic_splash_drm.c -I. `pkg-config --cflags --libs libdrm` -Wall -Os
 
clean:
	rm -rf psplash-drm

You can see that SPLASH_IMG and SPLASH_IMG_ROT are describing which PNG the Makefile has to target. Replace them with your own files. You can also see that the Makefile contains 4 different rules: all, generate_header, psplash and clean. We will keep this in mind for later.

Now, let's take together a look at the psplash-drm.bb file, and more particularly at the do_compile() function:

do_compile() {
    bbnote "EXTRA_OEMAKE=${EXTRA_OEMAKE}"
    oe_runmake clean
    oe_runmake psplash
}

You can see that we are making a make clean, then a make psplash but no make generate_header.

It means that you have to use the Makefile yourself to compile the header of your images, then this header will be used by the program to display the good picture.

I hope that this information will help you.

Do not hesitate to come back to me if you have any trouble.

(I did not test to change the format of the image myself, but I think that it can be possible to change the size. I am not sure for the 8bits format, let me know 🙂 )

Kind regards,

Erwan.

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
Erwan SZYMANSKI
ST Employee

Hello @SScar.2​,

Regarding the layer, it seems that the psplash-drm recipe is waiting for 2 images of the same format as PNG already present in the layer, and the same format that you tried (1 for landscape and 1 for portrait orientation). 

PNG image data, 480 x 272, 8-bit colormap, non-interlaced

However, the program that will display the splash screen cannot work with a PNG directly, and needs to generate the image_header.h that describes the picture. It is used by basic_splash_drm.c program (you can observe this file in the layer).

To generate the header file, you can see that the Makefile has a special rule generate_header that will target to 2 files mentioned at the top of it.

Take together a look at the Makefile of the layer in OSTL-4.0:

SPLASH_IMG ?= ST13028_Linux_picto_11_480x272_8bits.png
SPLASH_IMG_ROT ?= ST13028_Linux_picto_11_480x272_8bits_rotation.png
 
all: modeset
 
generate_header: $(SPLASH_IMG) $(SPLASH_IMG_ROT)
	@gdk-pixbuf-csource --macros $(SPLASH_IMG) > image_header.tmp
	@(sed -e "s/MY_PIXBUF/SPLASH_IMG/g" -e "s/guint8/uint8_t/g" image_header.tmp > image_header.h && rm image_header.tmp)
	@gdk-pixbuf-csource --macros $(SPLASH_IMG_ROT) > image_header.tmp
	@(sed -e "s/MY_PIXBUF/SPLASH_IMG_ROT/g" -e "s/guint8/uint8_t/g" image_header.tmp >> image_header.h && rm image_header.tmp)
 
psplash:
	$(CC) $(CFLAGS) $(LDFLAGS) -o psplash-drm basic_splash_drm.c -I. `pkg-config --cflags --libs libdrm` -Wall -Os
 
clean:
	rm -rf psplash-drm

You can see that SPLASH_IMG and SPLASH_IMG_ROT are describing which PNG the Makefile has to target. Replace them with your own files. You can also see that the Makefile contains 4 different rules: all, generate_header, psplash and clean. We will keep this in mind for later.

Now, let's take together a look at the psplash-drm.bb file, and more particularly at the do_compile() function:

do_compile() {
    bbnote "EXTRA_OEMAKE=${EXTRA_OEMAKE}"
    oe_runmake clean
    oe_runmake psplash
}

You can see that we are making a make clean, then a make psplash but no make generate_header.

It means that you have to use the Makefile yourself to compile the header of your images, then this header will be used by the program to display the good picture.

I hope that this information will help you.

Do not hesitate to come back to me if you have any trouble.

(I did not test to change the format of the image myself, but I think that it can be possible to change the size. I am not sure for the 8bits format, let me know 🙂 )

Kind regards,

Erwan.

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Erwan SZYMANSKI​ ,

thanks for the complete and exhaustive answer, and I think you are completely right. Your solution is surely the best (and I mark it as such), thank you.

But, just for information, first of all: do you have a favorite tool for the conversion of the image? because I used different converters online but they are not really clear about the bit format conversion.

Also, while I was waiting for your answer, I tried different ways to achieve the result. And I wrote a personal script mixing the Makefile and the original Yocto script, and It actually works! (I reversed-engineered the original image header and the resulting file was the same). Besides, I don't know why, but by using the tool Photopea to crop the images, without specifying the bit depth (but using the correct sizes), and running my script that overwrites the image_header.h, it actually worked! Yes, I also think like you that basic_splash_drm.c file is a bit complex and it has a little bit of dynamic adaptation, so I will try to use bigger images as see if it works (also because as is, the format is not full screen, so you're obliged to use images with white backgrounds ... without changing anything of the file)

Thanks again

Simone

Hello @SScar.2​,

I am glad to see that you could have found a workaround with your personal script !

I admit that I did not have this use case myself, so I would answer that I do not have a preferred tool to do this..

Thank you for your feedback !

Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Erwan SZYMANSKI​ ,

little side note, Photopea exports already in 8bit, so it all makes sense.

By the way, is there a way to run oe_runmake generate_header in .bb file? I tried to just add the command before the oe_runmake clean but bitbake fails. Sorry, I'm kinda new to Makefiles.

Thanks again,

Simone

EDIT: I confirm that works great also with bigger image sizes!