No matter how much you optimize embedded Linux boot time, it always remains too long. If your device has a screen, a typical workaround is to display something on it until the user application starts. There are several ways to do that with various unexpected gotchas.
There are several ways to display an image on screen in various boot stages:
- Bootloader – often supports drawing images on screen
- Kernel – by default shows penguin(s) but can be repurposed
- Splashscreen application – for example PSplash offers an easy way to display images
- Graphical shell – if you use Weston, you have several options
Bootloader
Check if your bootloader has an appropriate driver for your screen. If you use U-Boot, the support is generally not as good as in Linux.
Kernel
By default Linux kernel displays penguins that symbolize number of CPU cores. Using custom patches and config options you can customize this behaviour to display a basic splash image. This image has to be converted to a very specific format. Just look up “pnmnoraw” and “ppmquant”, there are plenty of examples out there.
There are several problems with this approach. Surprisingly, until recently the only official option to display an image was to embed it directly into kernel binary using custom patch. This seems to be finally getting addressed in upstream.
Splashscreen application
There are several applications specifically designed to display images during system boot. One example is PSplash. These application can display nicer images in a more flexible way. However using an extra application adds some boot time and does not always play nicely with other parts of the system. For example when used together, Weston and PSplash might compete for display access and flicker the display unnecessarily.
Shell
If you use Wayland with Weston as your graphical shell, it’s easy to customize weston.ini and use background image as a splash image. It’s possible to change it at runtime (offers extra maneuvering space for OEM modifications).
Conveniently for embedded use cases, Weston has a kiosk shell that allows displaying a single application full screen while handling stuff like input devices and screen rotation.
However, there is a catch: while other shells like Desktop support displaying background-image, Kiosk does not. It only supports background-color. This means that during device boot there can be significant delay between graphical shell (Weston) initialization and user application start. During this time interval the Kiosk shell can only display single colour screen.
Solution?
What can you do about it? That is the question. In the subsequent posts that will appear on this blog with usual delays I’ll explore some solutions. For now it seems that it might be possible to:
- Use another shell like Desktop or IVI. Using more complex shells than necessary will have downsides. For example Desktop shell draws borders around windows. Not to mention added overhead.
- Start the user application in advance and display on screen as soon as Weston initializes. I usually build Qt application and this might not be supported.
- Put together some patch that adds missing background-image support. This might not be easy because displaying colour buffer works in a very different way than displaying image buffer.
- Create a userspace application that starts as fast as possible and just displays an image on screen until the user application is ready. This option seems worth investigating. The Kiosk shell does support drawing one application over another as can be easily tested by launching for example weston-terminal.