Making psplash work on your PiTFT display in a Raspberry Pi Yocto project

psplash is a simple splash screen that shows a static image with an animated progress bar. It is the default splash screen shown by any Poky based project, unless overridden. This post assumes you know how to override a recipe with a .bbappend file, add files to a recipe, and patch the recipe source.

The directory structure for psplash in my own layer.


I wanted to have my PiTFT 2.8 show the splash screen instead of the display plugged into the HDMI port of my Raspberry Pi 3. The HDMI display is identified in /dev/ as fb0, and the PiTFT screen is identified as fb1.

The PiTFT 2.8 has a resolution of 320 x 240 pixels, so I created two images to show on the screen to test the splash screen:

The 320 x 240 splash screen.
The very exciting progress bar splash screen which has a single pixel of white border around it.


The splash screen will not show up on /dev/fb1 (PiTFT 2.8) without some modifications to psplash and init scripts:

  1. The psplash executable needs an argument to direct output to /dev/fb1
  2. The /dev/fb1 device is not ready until udev has ran, this will cause psplash to fail if executed before the device is ready
  3. The image files need to be overwritten by your layers recipe, to show your customized graphics
  4. The source code of psplash needs patching for configuration, to accommodate to your graphics

To remedy the previous points, the following actions were taken:

Direct psplash output to /dev/fb1

To direct the output to /dev/fb1, the file psplash-init was copied to my own layer under the equivalent path for psplash. The file was then added to the SRC_URI variable in the .bbappend file. I found the file from poky-sumo/meta/recipes-core/psplash/files. Two things had to be changed:

# change this:
if [ ! -e /dev/fb0 ]; then
    echo "Framebuffer /dev/fb0 not detected"
    echo "Boot splashscreen disabled"
    exit 0;
# to this:
if [ ! -e /dev/fb1 ]; then
    echo "Framebuffer /dev/fb1 not detected"
    echo "Boot splashscreen disabled"
    exit 0;

# and this:
/usr/bin/psplash --angle $rotation &
# to this:
/usr/bin/psplash --angle $rotation --fbdev 1 &

Run psplash-init after udev

psplash-init script is installed into the init.d directories. Specify the following variable to control the runlevels and behavior of the script:

INITSCRIPT_PARAMS = "start 5 S . stop 20 0 1 6 ."

This will run the psplash-init only after the /dev/fb1 is available (after udev). Adjust the runlevel values as necessary for your system. Refer to update-rc.d.bbclass chapter in Yocto documentation.

Replace the images

Replacing the images is as simple as adding the new images to the files directory of the psplash directory of your layer.

Configuring psplash is as easy as loading the recipe up in the Yocto devtool and making the configuration changes to the source header files. The variables are well named and behave as expected:

-#define POKY_IMG_WIDTH (427)
-#define POKY_IMG_HEIGHT (214)
+#define POKY_IMG_WIDTH (320)
+#define POKY_IMG_HEIGHT (240)

(Optional) Remove text above progress bar

To remove the text bar altogether (and eliminating the black background box behind it, undefine the following environment variable. Setting the variable to empty string still produces the black background box above the progress bar, because the source code checks for any definition of the variable.

+/* #define PSPLASH_STARTUP_MSG */
This entry was posted in embeddedlinux, raspberrypi, yocto. Bookmark the permalink.