psplash and systemd

Message ID 20140521192928.GA3672@ned
State Accepted
Commit 6d49c243cf5ba8c4e48eebc6afdf75bbdd383780
Headers show

Commit Message

Eric Le Bihan May 21, 2014, 7:29 p.m.
Hi!

On Wed, May 21, 2014 at 10:36:15AM +0200, Tom Deblauwe wrote:
> Hello,
>
> I am using psplash in my initramfs and it shows up a graphical
> bootscreen, but then the regular bootprocess starts and there I would
> like to continue showing the splash screen. I am using the 6d3336a
> commit of master buildroot. So I would like to use systemd. What is the
> best solution for this?

Please find attached a patch that installs two new services for using psplash
with systemd. These are inspired by the ones from Plymouth
(http://cgit.freedesktop.org/plymouth/tree/systemd-units/):

- psplash-start.service for starting psplash.
- psplash-quit.service for killing psplash when reaching multi-user.target.

I tested them on QEMU machines:

- on QEMU/x86, the boot is very quick, so the boot screen is not displayed for
  a long time.
- on QEMU/ARM, the boot takes longer, so the screen can be seen.

Besides, no progress messages are printed when booting (I have not found how
to do it yet).

Thought these configurations do not use an initramfs followed by a
switch-root, these service files should provide you a good start.

Best regards,
ELB
From c7044ddc654695ca00ce58a38c32b4a45dffb315 Mon Sep 17 00:00:00 2001
From: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Date: Wed, 21 May 2014 19:08:41 +0200
Subject: [PATCH 1/1] psplash: install systemd services

This patch provides service files for using psplash on embedded devices
running systemd:

- psplash-start.service: start psplash.
- psplash-quit.service: kill psplash when reaching multi-user.target

The following kernel command line options should also be set:

  systemd.show_status=0 quiet splash

The option "systemd.show_status=0" is required, because, unlike Plymouth,
psplash does not have real systemd integration, i.e. it will not perform:

  kill(1, SIGRTMIN + 21);

Note that no progress messages will be printed on the splash screen.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 package/psplash/psplash-quit.service  | 11 +++++++++++
 package/psplash/psplash-start.service | 11 +++++++++++
 package/psplash/psplash.mk            | 14 ++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 100644 package/psplash/psplash-quit.service
 create mode 100644 package/psplash/psplash-start.service

Comments

Tom Deblauwe May 22, 2014, 12:01 p.m. | #1
On 21-05-14 21:29, Eric Le Bihan wrote:
> Please find attached a patch that installs two new services for using psplash
> with systemd. These are inspired by the ones from Plymouth
> (http://cgit.freedesktop.org/plymouth/tree/systemd-units/):

Hello Eric,

Thanks for this patch it helps me indeed and works. However I am looking
into starting it even earlier in the boot process so I'll let something
know if I find it.

Thanks,
Best regards,
Tom,
Email Confidentiality: e-BO Enterprises<http://www.ebo-enterprises.com/> Company Registration Number BE 0470174242. This email message and any attachments are for the sole use of the intended recipient(s) and may contain information that is proprietary to e-BO Enterprises<http://www.ebo-enterprises.com/>. If you have received this message in error, please notify the sender by reply, and delete all copies of this message and any attachments. If you are the intended recipient you may use the information contained in this message and any files attached to this message only as authorized by e-BO Enterprises<http://www.ebo-enterprises.com/>. Any unauthorized use, dissemination or disclosure of this message or its attachments is strictly prohibited. The contents of this e-mail are not to be considered binding upon e-BO Enterprises<http://www.ebo-enterprises.com/>.
Thomas Petazzoni June 9, 2014, 12:27 p.m. | #2
Dear Eric Le Bihan,

On Wed, 21 May 2014 21:29:28 +0200, Eric Le Bihan wrote:
> Hi!
> 
> On Wed, May 21, 2014 at 10:36:15AM +0200, Tom Deblauwe wrote:
> > Hello,
> >
> > I am using psplash in my initramfs and it shows up a graphical
> > bootscreen, but then the regular bootprocess starts and there I would
> > like to continue showing the splash screen. I am using the 6d3336a
> > commit of master buildroot. So I would like to use systemd. What is the
> > best solution for this?
> 
> Please find attached a patch that installs two new services for using psplash
> with systemd. These are inspired by the ones from Plymouth
> (http://cgit.freedesktop.org/plymouth/tree/systemd-units/):

Can you submit this patch properly, i.e with git send-email, so that it
can be applied?

I'll mark it as "Changes requested" in patchwork in the mean time,
awaiting for your new posting.

Thanks a lot, having psplash integration looks really useful!

Thomas
Thomas Petazzoni June 9, 2014, 4:53 p.m. | #3
Dear Tom Deblauwe,

On Mon, 09 Jun 2014 17:37:46 +0200, Tom Deblauwe wrote:

> I also have added some basic support to choose the .png image you want 
> as a bootscreen. I had to install in ubuntu "libgdk-pixbuf2.0-dev" to 
> have the "gdk-pixbuf-csource" utility which the generate header script 
> uses. Probably there is a better buildroot-specific way but I provide 
> the patch as a start.

Thanks for your patch. To get the gdk-pixbuf-csource tool in Buildroot,
you simply need to make your package depend on host-gdk-pixbuf.

It would be good to take the systemd psplash patch and your patch,
create proper commit logs, and submit them using git send-email. See
http://buildroot.org/downloads/manual/manual.html#submitting-patches
for details. Your contribution would be much appreciated!

Thanks!

Thomas
Eric Le Bihan June 11, 2014, 9:18 p.m. | #4
Hi!
On Mon, Jun 09, 2014 at 02:27:34PM +0200, Thomas Petazzoni wrote:
> Dear Eric Le Bihan,
>
> On Wed, 21 May 2014 21:29:28 +0200, Eric Le Bihan wrote:
> > Hi!
> >
> > On Wed, May 21, 2014 at 10:36:15AM +0200, Tom Deblauwe wrote:
> > > Hello,
> > >
> > > I am using psplash in my initramfs and it shows up a graphical
> > > bootscreen, but then the regular bootprocess starts and there I would
> > > like to continue showing the splash screen. I am using the 6d3336a
> > > commit of master buildroot. So I would like to use systemd. What is the
> > > best solution for this?
> >
> > Please find attached a patch that installs two new services for using psplash
> > with systemd. These are inspired by the ones from Plymouth
> > (http://cgit.freedesktop.org/plymouth/tree/systemd-units/):
>
> Can you submit this patch properly, i.e with git send-email, so that it
> can be applied?
I posted a proper patch. As for adding progress report from systemd to
psplash, this would require a patch to src/core/manager.c in systemd to write
to psplash socket.

BTW, maybe we should provide a patch to set the default image with the famous
Buildroot hard hat, to replace the "POKY" theme...

Best regards,
ELB
Thomas Petazzoni June 12, 2014, 7:10 a.m. | #5
Dear Eric Le Bihan,

On Wed, 11 Jun 2014 23:18:21 +0200, Eric Le Bihan wrote:

> > Can you submit this patch properly, i.e with git send-email, so that it
> > can be applied?
> I posted a proper patch.

Ok, found at http://patchwork.ozlabs.org/patch/358888/.

> As for adding progress report from systemd to
> psplash, this would require a patch to src/core/manager.c in systemd to write
> to psplash socket.

Ok.

> BTW, maybe we should provide a patch to set the default image with the famous
> Buildroot hard hat, to replace the "POKY" theme...

Indeed, that would be good to have.

Thanks!

Thomas

Patch

diff --git a/package/psplash/psplash-quit.service b/package/psplash/psplash-quit.service
new file mode 100644
index 0000000..14bd499
--- /dev/null
+++ b/package/psplash/psplash-quit.service
@@ -0,0 +1,11 @@ 
+[Unit]
+Description=Terminate Psplash Boot Screen
+After=psplash-start.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/psplash-write QUIT
+TimeoutSec=20
+
+[Install]
+WantedBy=multi-user.target
diff --git a/package/psplash/psplash-start.service b/package/psplash/psplash-start.service
new file mode 100644
index 0000000..2de3cfc
--- /dev/null
+++ b/package/psplash/psplash-start.service
@@ -0,0 +1,11 @@ 
+[Unit]
+Description=Starts Psplash Boot screen
+Wants=systemd-vconsole-setup.service
+After=systemd-vconsole-setup.service systemd-udev-trigger.service systemd-udevd.service
+DefaultDependencies=no
+
+[Service]
+ExecStart=/usr/bin/psplash -n
+
+[Install]
+WantedBy=sysinit.target
diff --git a/package/psplash/psplash.mk b/package/psplash/psplash.mk
index 83b6f79..b756266 100644
--- a/package/psplash/psplash.mk
+++ b/package/psplash/psplash.mk
@@ -9,4 +9,18 @@  PSPLASH_SITE = git://git.yoctoproject.org/psplash
 PSPLASH_LICENSE = GPLv2+
 PSPLASH_AUTORECONF = YES
 
+define PSPLASH_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 package/psplash/psplash-start.service \
+		$(TARGET_DIR)/etc/systemd/system/psplash-start.service
+	$(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants
+	ln -sf  ../psplash-start.service \
+		 $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants/
+
+	$(INSTALL) -D -m 644 package/psplash/psplash-quit.service \
+		$(TARGET_DIR)/etc/systemd/system/psplash-quit.service
+	$(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+	ln -sf  ../psplash-quit.service \
+		 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/
+endef
+
 $(eval $(autotools-package))