8

Lots of websites explain how to do a splash screen on the Pi with SysV init, but I couldn't find any info on how to do it with systemd on Jessie. I tried just "converting" the init-script to a systemd-service, but it doesn't do anything.

Has anyone managed to do this or any helpful advice?

3
  • have you tried searching without specifying the Pi? – Steve Robillard Nov 1 '15 at 19:49
  • doing a search without specifying Pi, would be the plymouth? wiki.debian.org/plymouth . I'm still using Wheezy, so can't be sure... – eri0o Nov 1 '15 at 20:39
  • I too am looking for a solution on Jessie/RPi... did you have any luck? The plymouth solutions seem to require plymouth-drm which fails to install – jpw Jan 26 '16 at 20:29
2

Oh I've done it, but it was a complete and utter PITA.

First, the usual plymouth files, mytheme.plymouth:

[Plymouth Theme]
Name=My theme
Description=Raspberry Pi theme
ModuleName=script

[script]
ImageDir=/usr/share/plymouth/themes/mytheme
ScriptFile=/usr/share/plymouth/themes/mytheme/mytheme.script

And then mytheme.script

screen_width = Window.GetWidth();
screen_height = Window.GetHeight();

theme_image = Image("mytheme.png");
resized_wallpaper_image = theme_image.Scale(screen_width, screen_height);
sprite = Sprite(resized_wallpaper_image);
sprite.SetZ(-100);

message_sprite = Sprite();
message_sprite.SetPosition(screen_width * 0.1, screen_height * 0.8, 10000);

fun message_callback (text) {
    my_image = Image.Text(text, 1, 1, 1);
    message_sprite.SetImage(my_image);
}

Plymouth.SetUpdateStatusFunction(message_callback);

These then go in the relevant places in /usr/share/plymouth/themes/mytheme along with mytheme.png.

Then you enable mytheme with the plymouth-set-default-theme command.

Now some trickery. plymouth can only read the first 1024 bytes of the kernel cmdline... but, the Rpi loader PREPENDS things to /proc/cmdline, so you may THINK you did it right, but if you cat /proc/cmdline later, you may find that your settings in fact fall off the 1024 byte limit. So you have to add the quiet splash and plymouth ignore settings very early in cmdline.txt.

I have my cmdline.txt set to this (but we use the adafruit touch screen, so ymmv):

dwc_otg.lpm_enable=0 console=tty3 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles fbcon=map:10 fbcon=font:VGA8x8

Now, you also must use an initramfs, because the splash screen is enabled from the early startup scripts. This is usually as easy as running update-initramfs and specifying initramfs initrd.img-4.1.9-v7 (or similar) in /boot/config.txt.

In my case, I also had to update plymouth because the version that ships with Jessie would segfault in the framebuffer driver and as a result I could not get it working on the adafruit touch screen.

After that, it started working for me. But I also wanted a "safe to turn off" screen at the end, as the Rpi doesn't have hardware to turn itself off. So I added a systemd script for that:

[Unit]
Description=Tell Plymouth to show a safe-to-power-off message
DefaultDependencies=no
After=umount.target
Before=shutdown.target

[Service]
ExecStart=-/bin/plymouth update --status "      SAFE TO POWER DOWN"
Type=oneshot

[Install]
WantedBy=shutdown.target

Now it has been at least 6 months since I did this, but I hope this is useful.

Edit: Add some more hints.

You can debug plymouth themes like so. Start plymouthd in debug mode, eg:

plymouthd --debug --debug-file=/tmp/plymouth-debug-out

And then you can test your theme using:

plymouth --show-splash
plymouth --quit

It was during this stage that I found out that I had a segfault.

You can also halt your boot process and drop into a shell to test this in a boot-time environment. Edit /boot/cmdline.txt and add break=top, or see here for more info on that.

These are all tricks I used and I finally got there. But as I said, it was a PITA.

5
  • Can't get it to work. Maybe I need to put the put the commands earlier in the cmdline? EDIT: cat /proc/cmdline|wc -c says it's only 508 bytes, though. – Kirby Mar 21 '16 at 14:52
  • I added some more details about a debug shell at boot, and testing the theme separately. – izak Mar 22 '16 at 7:38
  • Cool, thanks. I'll take a look tomorrow or next week. – Kirby Mar 23 '16 at 14:46
  • How did you manage to update plymouth? – user44082 Mar 30 '16 at 13:20
  • I compiled from source. I'm an old hand at making debian packages, so I downloaded source from packages.debian.org and used dpkg-buildpackage to build it. This can be done on the pi, if you want, but I think I built it in a chroot environment. I cannot remember exactly, you see :-) – izak Apr 1 '16 at 13:58
1

You can use asplashscreen. Custom boot up screen

3
  • This is the way of doing it on old versions of Debian that used SysV Init. Jessie uses systemd, so that won't work with it. – Kirby Feb 26 '16 at 10:46
  • This way works perfectly with systemd. Now I do it in Debian Stretch and works perfectly following the steps of howto. – Alfredo Pons Menargues Feb 27 '16 at 9:34
  • This works in Jessie. I found that the splash screen would show for inconsistent times - fixed by adding "sleep 5" before exit in the do_start() method. – Greg T Dec 30 '16 at 0:07
0

The answer by @izak works, but you will probably still run into the issue of Plymouth segfaulting when using the default Jessie package. To fix the segfault, your will need to install Plymouth from the testing repository.

Follow the instruction from the AptPreferences documentation and run the following to update your Plymouth package:

apt install plymouth/testing

This fixed everything for me!

(I couldn't post this as a comment on @izak his post)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.