DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

[HOW TO] Early Boot Splash

Mon Jun 08, 2020 4:27 pm

Introduction
I've seen a want over my time using the pi for projects to have fancy boot splash screens. Most users I've interacted with over the years have been looking for something simple, and easy to maintain. It uses a simple initramfs contains no kernel modules and as such doesn't need to update.

Initramfs-Splash
I've been working my way to this for some time as I gathered knowledge now I give to you Initramfs-splash. This is what I think can solve the wants of most user looking for a simple way to boot splash. The goal was to keep it simple and not introduce upkeep.

What is it
To put it simply this a program that loads very early in the boot sequence. It's meant for users of the lite flavour or Raspberry Pi OS who don't want to mess about with Plymouth or just want to show a static image during boot. However it should work on other OS platforms as long as they don't require an initramfs to boot.

Quick Start
To get up and running is very simple!!

Code: Select all

git clone --depth=1 https://gitlab.com/DarkElvenAngel/initramfs-splash.git
you need to add this line to the /boot/config.txt

Code: Select all

initramfs initramfs.img
Next you need to add the following to you /boot/cmdline.txt

Code: Select all

logo.nologo loglevel=0 splash silent quiet
IMPORTANT This must be all on one line
Next you need the image you want to display this can be a PNG, JPEG, or BMP copy it to the /boot and edit /boot/splash.txt

Code: Select all

## Initramfs-Splash
image=splash.png
IMPORTANT replace splash.png with your image
If your image is smaller than the current display size and you want it to be full screen add this line to the /boot/splash.txt

Code: Select all

fullscreen=1
If your image doesn't fit the current display size and you want it to be full screen and not maintain aspect ratios add this line to the /boot/splash.txt

Code: Select all

stretch=1
you only need to define one or the other. if you define both stretching has priority

Next run this command from initramfs-splash folder you cloned

Code: Select all

sudo cp  boot/initramfs.img /boot
And finally reboot

Issues
Currently there are some issues I don't support MSD or NetBooting at this time.
This doesn't work with PINN, NOOBS, or any software like it.

Out of the box this project is incompatible with the overlayfs option offered with the raspi-config. There is a workaround found here

PI 4B and the vc-fkms-v3d
This combination has an issue that can not be overcome. The driver needs to reset the framebuffer as it does this the contents are erased there is currently no way to stop this other than disabling the driver. The workaround is to create a service that will reload the image to the display after this reset has happened. This has the effect of having the image on screen for a moment then the screen goes black and the image comes back.

Updates
As I have new information I will add it here

AUG 24 2020 : Added the option to display image full screen by setting the option in the splash.txt
AUG 25 2020 : Added the option to stretch image full screen by setting the option in the splash.txt
DEC 04 2020 : Due to a bug in fbsplash exposed by recent kernel change it necessary to update your initramfs.img
All comments, question or issues welcome.
Thank you.
Last edited by DarkElvenAngel on Sat Dec 05, 2020 2:55 am, edited 5 times in total.

bluehash
Posts: 2
Joined: Wed Jun 27, 2012 1:08 pm

Re: [HOW TO] Early Boot Splash

Wed Jul 29, 2020 6:06 am

Hi Thanks for the instructions.
However I'm not able to see any images on my pi4b-2gb.
I also resized the image. BTW, this is for a 480x320 screen.

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Wed Jul 29, 2020 2:21 pm

bluehash wrote:
Wed Jul 29, 2020 6:06 am
Hi Thanks for the instructions.
However I'm not able to see any images on my pi4b-2gb.
I also resized the image. BTW, this is for a 480x320 screen.
Your display will probably need a kernel module loaded and or a different program to write the image to the display.

The initramfs that I use is very minimal it doesn't have any kernel modules.

If you have an SPI interface on your display it might be possible to write the image to the display but you need a compiled binary to do it.

tiagomaricate
Posts: 20
Joined: Wed Aug 19, 2020 11:51 pm

Re: [HOW TO] Early Boot Splash

Wed Aug 19, 2020 11:52 pm

Code: Select all

Cloning into 'initramfs-splash'...
git@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Thu Aug 20, 2020 8:48 pm

The correct command is

Code: Select all

git clone https://gitlab.com/DarkElvenAngel/initramfs-splash.git
Sorry I fixed the mistake above

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Mon Aug 24, 2020 2:42 pm

UPDATE:

I've added an option to splash.txt so you can force the image to be full screen.

It's as easy as adding fullscreen=1 to your /boot/splash.txt

All you have to do is grab the new initramfs.img and copy it to your /boot folder and the new feature is available.

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Tue Aug 25, 2020 3:14 pm

UPDATE:

I've added an option to splash.txt so you can force the image to be full screen and ignore aspect ratios.

It's as easy as adding stretch=1 to your /boot/splash.txt

All you have to do is grab the new initramfs.img and copy it to your /boot folder and the new feature is available.

These new setting were inspired by @tiagomaricate and I want to thank you for bringing these missing features to my attention, and for testing them.

alfarie
Posts: 1
Joined: Fri Aug 28, 2020 6:43 am

Re: [HOW TO] Early Boot Splash

Fri Aug 28, 2020 6:59 am

Thank you for the instructions.

I successfully make a splash screen running early on the boot time and It works very well. Thank you!!
Is it possible to hold the splash screen until the web app starts?

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Fri Aug 28, 2020 2:31 pm

alfarie wrote:
Fri Aug 28, 2020 6:59 am
Thank you for the instructions.

I successfully make a splash screen running early on the boot time and It works very well. Thank you!!
Is it possible to hold the splash screen until the web app starts?
There was some discussion about keeping the splash longer on this thread it seems dependent on how you have your setup.

sam256
Posts: 4
Joined: Sun Nov 15, 2020 11:02 am

Re: [HOW TO] Early Boot Splash

Sun Nov 15, 2020 11:07 am

The workaround is to create a service that will reload the image to the display after this reset has happened.
Could anyone offer any pointers on how to create this service? I have a Pi4 and am using DarkElvenAngel's initramfs to load a splash screen but it only display's for a fraction of.a second because of the vc-fkms-v3d limitation.

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Sun Nov 15, 2020 6:23 pm

sam256 wrote:
Sun Nov 15, 2020 11:07 am
The workaround is to create a service that will reload the image to the display after this reset has happened.
Could anyone offer any pointers on how to create this service? I have a Pi4 and am using DarkElvenAngel's initramfs to load a splash screen but it only display's for a fraction of.a second because of the vc-fkms-v3d limitation.
The easiest way is to create the service /etc/systemd/system/bootsplash.service

Code: Select all

[Unit]
Description=boot splash
[Service]
ExecStart=/usr/bin/bootsplash
[Install]
WantedBy=local-fs.target
Now for the /usr/bin/bootsplash

Code: Select all

#!/bin/sh
cat /proc/cmdline | grep splash || exit 0;
clear
# < INSERT PROGRAM TO DISPLAY SPLASH HERE >
The idea is that the program can be anything really you can use fbi This is avalible with apt-get install fbi, fbv This you have to clone from github and compile yourself, or you can extract the program from the initramfs and use it. I've listed these from what I feel is easiest to find tutorials on. I use my fbsplash from the initramfs you can extract it with the tools I've provided in the project you used.

sam256
Posts: 4
Joined: Sun Nov 15, 2020 11:02 am

Re: [HOW TO] Early Boot Splash

Sun Nov 15, 2020 7:26 pm

Really appreciate the help. Wondering if you could give me a few more pointers. I've followed these instructions and then, for the actual program, I unpacked fbsplash from your initramfs, copied it to /usr/local/bin, and am running this /usr/bin/bootsplash:

Code: Select all

#!/bin/sh
cat /proc/cmdline | grep splash || exit 0;
clear
/usr/local/bin/fbsplash --device=/dev/fb0 /boot/splash.png
The issue is I still barely get the splash screen. What I get is black screen for a few seconds, an initial flash of splash.png (flicker would be more accurate, it's that fast), more black screen, then a brief flicker of it again (the service running), and then black screen until X loads. These first two flashes are so quick you can barely make out what the screen is.

Is that the best I can do on a Pi4 short of compiling my own kernel? Much appreciated!

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Mon Nov 16, 2020 1:25 am

What I can tell you is that is about as good as it gets if you comment out

Code: Select all

dtoverlay=vc4-fkms-v3d
in your config.txt that will stop the flashing. But then you have no acceleration for graphics. This is how I run my pi I use for development.

As for compiling your own kernel you can build a splash image in but it will do exactly the same thing as your seeing with the fkms driver loaded.

All the flashing you see is all do to the framebuffer reinitializing when the fkms driver loads.

Hopefully that helps you.

sam256
Posts: 4
Joined: Sun Nov 15, 2020 11:02 am

Re: [HOW TO] Early Boot Splash

Mon Nov 16, 2020 9:34 am

Interesting. I commented out dtoverlay=vc4-fkms-v3d. That eliminated the double flicker, i.e., now the service's splash doesn't show (as expected), but the initramfs's splash screen still only shows for a split second. In other words my boot is now: long black screen; split second flash of splash.png, long black screen.

Here's my cmdline fwiw:

Code: Select all

console=serial0,115200 console=tty1 root=PARTUUID=ced25eb2-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait logo.nologo loglevel=0 splash silent quiet
As always, many thanks for the time.

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Mon Nov 16, 2020 4:27 pm

sam256 wrote:
Mon Nov 16, 2020 9:34 am
Interesting. I commented out dtoverlay=vc4-fkms-v3d. That eliminated the double flicker, i.e., now the service's splash doesn't show (as expected), but the initramfs's splash screen still only shows for a split second. In other words my boot is now: long black screen; split second flash of splash.png, long black screen.

Here's my cmdline fwiw:

Code: Select all

console=serial0,115200 console=tty1 root=PARTUUID=ced25eb2-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait logo.nologo loglevel=0 splash silent quiet
As always, many thanks for the time.
Did you enable the splash screen service with

Code: Select all

sudo systemctl enable bootsplash
and did you set the bootsplash script executable with

Code: Select all

sudo chmod +x /usr/bin/bootsplash

Just to compare I'll post my config.txt and cmdline.txt

Code: Select all

# disable_splash rainbow
disable_splash=1

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
# dtoverlay=vc4-fkms-v3d

max_framebuffers=2

[all]
gpu_mem=128
enable_uart=1
initramfs initramfs.img

Code: Select all

console=serial0,115200 console=tty1 root=PARTUUID=d9b3f436-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait logo.nologo loglevel=0 splash silent quiet
Just to verify run this command sudo apt policy plymouth you should get something like this

Code: Select all

plymouth:
  Installed: (none)
  Candidate: 0.9.4-1.1+rpt2
  Version table:
     0.9.4-1.1+rpt2 500
        500 http://archive.raspberrypi.org/debian buster/main armhf Packages
     0.9.4-1.1 500
        500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
If this doesn't state (none) you need to run sudo apt purge plymouth

Now I don't reboot often but my splash isn't up long there are many factors that come to play besides these. The SD card if it's very fast then the Pi can boot faster. If you have wireless or wired networking and you have the boot set to wait for network or not will make a big difference in how long the boot takes. Those are a few examples, the take away is faster boot isn't good for a boot splash.

if you want to try to delay things try running sudo raspi-config then select 3 Boot Options then B2 Wait for Network at Boot and set YES. that might make things run slower to boot but your splash will last a little longer.

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Sat Dec 05, 2020 3:18 am

IMPORTANT UPDATE

A bug has been found in the fbsplash tool that will clear the image from the screen right after it exits. This bug was exposed by a recent kernel change. To fix the issue I've update fbsplash.

If your splash images are flashing or not displaying you need to update your initramfs.img file. If you extracted the fbsplash tool from the initramfs.img you will need to re-extract it once you have the update.

HOW TO UPDATE

Step 1a.
If you have deleted the cloned repo you need to clone it again,

Code: Select all

git clone --depth=1 https://gitlab.com/DarkElvenAngel/initramfs-splash.git
Step 1b.
Change to initramfs-splash directory
Step 2.

Code: Select all

git pull
Now you have the latest version
Step 3.

Code: Select all

sudo cp boot/initramfs.img /boot/initramfs.img
Step 4.
If you wish to test reboot and the boot splash will work as before.

Details of the bug
fbsplash on exit would reset the screen resolution to the same value as it found when it started, on previous kernel version this change did nothing as the resolution was unchanged. Now however this was causing the display to reset.

fbsplash is updated to version 0.7 - This fixes the display reset bug. You can verify you have the latest version with the command

Code: Select all

fbsplash -V
the output should read

Code: Select all

fbSplash v0.7

sam256
Posts: 4
Joined: Sun Nov 15, 2020 11:02 am

Re: [HOW TO] Early Boot Splash

Sat Dec 05, 2020 3:34 pm

This patch was a big improvement for me. Thanks!

kretep
Posts: 5
Joined: Sun Oct 18, 2020 9:33 am

Re: [HOW TO] Early Boot Splash

Fri Dec 18, 2020 10:42 am

Thanks for this great guide and software! On my rpi 4 it now shows the splash screen after 10 seconds and I was wondering if there are any ways to reduce this time even more.

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Fri Dec 18, 2020 1:34 pm

kretep wrote:
Fri Dec 18, 2020 10:42 am
Thanks for this great guide and software! On my rpi 4 it now shows the splash screen after 10 seconds and I was wondering if there are any ways to reduce this time even more.
Your welcome, the delay is unavoidable unfortunately I have made the process as fast as possible. Something that does effect the speed is the SD card the faster the card the shorter the delay this might be a second or two only though.

If you want something that might be faster you're looking at building a custom kernel and that has it's own list of problems.

inphu5E0n
Posts: 3
Joined: Wed Dec 23, 2020 3:02 am

Re: [HOW TO] Early Boot Splash

Wed Dec 23, 2020 3:05 am

First of all, THANK YOU for doing this work.
I'm an absolute noob and this is a huge help.

I'm having an issue with the logo displaying on an SPI Waveshare LCD screen. Your code and method work great when using HDMI but I have a "need" for the splash image to appear ASAP on the SPI LCD.
Is that even possible?

Thanks!

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Wed Dec 23, 2020 1:23 pm

inphu5E0n wrote:
Wed Dec 23, 2020 3:05 am
First of all, THANK YOU for doing this work.
I'm an absolute noob and this is a huge help.

I'm having an issue with the logo displaying on an SPI Waveshare LCD screen. Your code and method work great when using HDMI but I have a "need" for the splash image to appear ASAP on the SPI LCD.
Is that even possible?

Thanks!
Thank you, and this is a big question there are a lot of factors. Let's just see how and what your using.

What display are you using and how are you accessing the display besides using SPI?

This will help sort out what method your going to need.

inphu5E0n
Posts: 3
Joined: Wed Dec 23, 2020 3:02 am

Re: [HOW TO] Early Boot Splash

Wed Dec 23, 2020 7:29 pm

Specifically I'm using the Waveshare 3.5(B) v2.
I don't have the touchscreen pins connected because it's unnecessary for my use case.
Currently I'm using IO2, IO14, IO18, IO19, IO22, IO23, IO24 to connect to the LCD. That's all I'm using for the LCD. I'm using IO5 and IO6 for start/shutdown.
In order to see the splash screen right now, I have to use a monitor hooked up to the HDMI port and have to use the Waveshare command "./LCD-hdmi". As soon as use the command "./LCD35B-show-V2 270" (I need portrait rotation) the pi reboots and the HDMI connected monitor shows the same thing the LCD does except the LCD is blank until it gets to console login. I believe this is because of the cmdline.txt params "loglevel=0 splash silent quiet" but I haven't pulled those out to test that theory yet.

I have attempted to disable and purge Plymouth.

If I have to I'll just buy an LCD with an HDMI connection instead of SPI. I just had this LCD laying around with a broken touchscreen cable and decided to use it for a gift I'm making.
Though, I assume if you can help me here it'll help others with the same or similar setup.

Thanks so much for creating this!

DarkElvenAngel
Posts: 2558
Joined: Tue Mar 20, 2018 9:53 pm

Re: [HOW TO] Early Boot Splash

Thu Dec 24, 2020 12:04 am

inphu5E0n wrote:
Wed Dec 23, 2020 7:29 pm
Specifically I'm using the Waveshare 3.5(B) v2.
I don't have the touchscreen pins connected because it's unnecessary for my use case.
Currently I'm using IO2, IO14, IO18, IO19, IO22, IO23, IO24 to connect to the LCD. That's all I'm using for the LCD. I'm using IO5 and IO6 for start/shutdown.
In order to see the splash screen right now, I have to use a monitor hooked up to the HDMI port and have to use the Waveshare command "./LCD-hdmi". As soon as use the command "./LCD35B-show-V2 270" (I need portrait rotation) the pi reboots and the HDMI connected monitor shows the same thing the LCD does except the LCD is blank until it gets to console login. I believe this is because of the cmdline.txt params "loglevel=0 splash silent quiet" but I haven't pulled those out to test that theory yet.

I have attempted to disable and purge Plymouth.

If I have to I'll just buy an LCD with an HDMI connection instead of SPI. I just had this LCD laying around with a broken touchscreen cable and decided to use it for a gift I'm making.
Though, I assume if you can help me here it'll help others with the same or similar setup.

Thanks so much for creating this!
Okay if I have this right you have a command run in the /etc/rc.local and that makes the screen come to life?

It will be slower but you could do a script that runs very early in the boot process and have the splash display then. In order to get faster you need to write custom software just for this display and the image you want to load. It depends on your programing abilities if this is something you can do? You can use image libraries to load images from file ect. This just adds to the complexity.

I can help you with some of this lets see what you way you want to go.

inphu5E0n
Posts: 3
Joined: Wed Dec 23, 2020 3:02 am

Re: [HOW TO] Early Boot Splash

Sat Dec 26, 2020 9:41 am

DarkElvenAngel wrote:
Thu Dec 24, 2020 12:04 am
inphu5E0n wrote:
Wed Dec 23, 2020 7:29 pm
Specifically I'm using the Waveshare 3.5(B) v2.
I don't have the touchscreen pins connected because it's unnecessary for my use case.
Currently I'm using IO2, IO14, IO18, IO19, IO22, IO23, IO24 to connect to the LCD. That's all I'm using for the LCD. I'm using IO5 and IO6 for start/shutdown.
In order to see the splash screen right now, I have to use a monitor hooked up to the HDMI port and have to use the Waveshare command "./LCD-hdmi". As soon as use the command "./LCD35B-show-V2 270" (I need portrait rotation) the pi reboots and the HDMI connected monitor shows the same thing the LCD does except the LCD is blank until it gets to console login. I believe this is because of the cmdline.txt params "loglevel=0 splash silent quiet" but I haven't pulled those out to test that theory yet.

I have attempted to disable and purge Plymouth.

If I have to I'll just buy an LCD with an HDMI connection instead of SPI. I just had this LCD laying around with a broken touchscreen cable and decided to use it for a gift I'm making.
Though, I assume if you can help me here it'll help others with the same or similar setup.

Thanks so much for creating this!
Okay if I have this right you have a command run in the /etc/rc.local and that makes the screen come to life?

It will be slower but you could do a script that runs very early in the boot process and have the splash display then. In order to get faster you need to write custom software just for this display and the image you want to load. It depends on your programing abilities if this is something you can do? You can use image libraries to load images from file ect. This just adds to the complexity.

I can help you with some of this lets see what you way you want to go.
Yikes. While technically inclined I haven't got the programming knowledge or Linux experience to possibly attempt much of anything.
I've ordered the HDMI version of the 3.5" screen and that should be here early next week. That *should* work.
I also have a weird issue with my config.txt getting overwritten with the default but nothing else. :roll:
I'll be doing a fresh install of everyone on a new card.

jerrymxfb
Posts: 124
Joined: Sat Dec 26, 2020 12:31 pm

Re: [HOW TO] Early Boot Splash

Mon Feb 15, 2021 8:13 pm

Hey, this is very cool. I have it showing for the MX-FLuxbox RPi respin going to FInal this week, lasts about 2-3 seconds, but that's vastly better than zero.

;)

Thanks for the good work here!
MX-Linux 21 Fluxbox (mxlinux.org) on a Lenovo ThinkPad X1 Carbon 5th.

Return to “Raspberry Pi OS”