Skip to contentSkip to conversation

PSPLASH_FIFO_DIR: refactor

PATCH In review Trevor Woerner 2 participants 11 messages Dec 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 PSPLASH_FIFO_DIR: refactor

Add an entry for the psplash fifo directory to /etc/default/rcS and have the pieces that need it, source it from there rather than duplicating the location in multiple places throughout the code.

---
 meta/recipes-core/psplash/files/psplash-init    | 4 +++-
 meta/recipes-core/sysvinit/sysvinit/rc          | 9 +++++----
 meta/recipes-core/sysvinit/sysvinit/rcS-default | 2 ++
 3 files changed, 10 insertions(+), 5 deletions(-)
meta/recipes-core/psplash/files/psplash-init +3 -1
index f58e043733..68dd708123 100755
@@ -7,6 +7,8 @@
 # Default-Stop:
 ### END INIT INFO
 
+. /etc/default/rcS
+
 if [ ! -e /dev/fb0 ]; then
     echo "Framebuffer /dev/fb0 not detected"
     echo "Boot splashscreen disabled"
@@ -23,7 +25,7 @@ for x in $CMDLINE; do
         esac
 done
 
-export PSPLASH_FIFO_DIR=/mnt/.psplash
+export PSPLASH_FIFO_DIR
 [ -d $PSPLASH_FIFO_DIR ] || mkdir -p $PSPLASH_FIFO_DIR
 if ! mountpoint -q $PSPLASH_FIFO_DIR; then
 	mount tmpfs -t tmpfs $PSPLASH_FIFO_DIR -o,size=40k
meta/recipes-core/sysvinit/sysvinit/rc +5 -4
index 6995930ee9..1c956a3a56 100755
@@ -17,6 +17,7 @@
 
 . /etc/default/rcS
 export VERBOSE
+export PSPLASH_FIFO_DIR
 
 startup_progress() {
     step=$(($step + $step_change))
@@ -27,8 +28,8 @@ startup_progress() {
     fi
     #echo "PROGRESS is $progress $runlevel $first_step + ($step of $num_steps) $step_change $progress_size"
     if type psplash-write >/dev/null 2>&1; then
-        PSPLASH_FIFO_DIR=/mnt/.psplash psplash-write "MSG $(basename $1 .sh | cut -c 4-)" || true
-        PSPLASH_FIFO_DIR=/mnt/.psplash psplash-write "PROGRESS $progress" || true
+        psplash-write "MSG $(basename $1 .sh | cut -c 4-)" || true
+        psplash-write "PROGRESS $progress" || true
     fi
 }
 
@@ -174,7 +175,7 @@ startup() {
 #Uncomment to cause psplash to exit manually, otherwise it exits when it sees a VC switch
 if [ "x$runlevel" != "xS" ] && [ ! -x /etc/rc${runlevel}.d/S??xserver-nodm ]; then
     if type psplash-write >/dev/null 2>&1; then
-        PSPLASH_FIFO_DIR=/mnt/.psplash psplash-write "QUIT" || true
-    	umount -l /mnt/.psplash
+        psplash-write "QUIT" || true
+        umount -l $PSPLASH_FIFO_DIR
     fi
 fi
meta/recipes-core/sysvinit/sysvinit/rcS-default +2 -0
index e608a77c75..70ab25710e 100644
@@ -30,3 +30,5 @@ ROOTFS_READ_ONLY=no
 # rcS is also used when using busybox init and shares initscripts, some initscripts
 # need to have specific behavior depending on init system
 INIT_SYSTEM=sysvinit
+# set psplash fifo directory
+PSPLASH_FIFO_DIR=/mnt/.psplash
Signature · 1 line
2.30.0.rc0
#1 lore raw

PATCH 2/3 psplash: work on first boot (sysvinit)

The psplash program has a mechanism for showing progress/updates. This is done via a pipe. On images that are R/O or images that are assembled via wic, the pipe is being setup in a location that is R/O on first boot, therefore the pipe can not be created. If the psplash program is not able to create the pipe, the app will not run. This situation is "fixed" on non-R/O images when the first bootup is complete. Therefore the psplash program is able to run for the first shutdown, and all subsequent bootups and shutdowns as well, but not on the very first boot.

If the directory in which the psplash pipe is to be created already exists in the filesystem and that location is not R/O on first boot, then the psplash program can run on first boot (and subsequent boots and shutdowns).

NOTE: this is only an issue with sysvinit and most non-qemu machines. A systemd image, and images run on qemu machines, are able to run psplash on the first and subsequent boots.

---
 meta/recipes-core/psplash/psplash_git.bb        | 3 +++
 meta/recipes-core/sysvinit/sysvinit/rc          | 1 +
 meta/recipes-core/sysvinit/sysvinit/rcS-default | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/psplash/psplash_git.bb +3 -0
index 44f0007daf..d70a8aa34e 100644
@@ -102,6 +102,7 @@ do_install_append() {
 	if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
 		install -d ${D}${sysconfdir}/init.d/
 		install -m 0755 ${WORKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh
+		install -d ${D}/.psplash
 	fi
 
 	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
@@ -122,3 +123,5 @@ SYSTEMD_SERVICE_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'pspl
 
 INITSCRIPT_NAME = "psplash.sh"
 INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ."
+
+FILES_${PN} += "/.psplash"
meta/recipes-core/sysvinit/sysvinit/rc +1 -0
index 1c956a3a56..61946e56eb 100755
@@ -177,5 +177,6 @@ if [ "x$runlevel" != "xS" ] && [ ! -x /etc/rc${runlevel}.d/S??xserver-nodm ]; th
     if type psplash-write >/dev/null 2>&1; then
         psplash-write "QUIT" || true
         umount -l $PSPLASH_FIFO_DIR
+        rmdir $PSPLASH_FIFO_DIR
     fi
 fi
meta/recipes-core/sysvinit/sysvinit/rcS-default +1 -1
index 70ab25710e..4330cb853e 100644
@@ -31,4 +31,4 @@ ROOTFS_READ_ONLY=no
 # need to have specific behavior depending on init system
 INIT_SYSTEM=sysvinit
 # set psplash fifo directory
-PSPLASH_FIFO_DIR=/mnt/.psplash
+PSPLASH_FIFO_DIR=/.psplash
Signature · 1 line
2.30.0.rc0
#10 lore raw

PATCH 3/3 sysvinit/rc: improved progress messages

In reply to Trevor Woerner

I noticed that the progress text messages were always a system behind; i.e. if the current boot script was "networking" the message would indicate the previous script and would say "networking" next.

---
 meta/recipes-core/sysvinit/sysvinit/rc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/sysvinit/sysvinit/rc +2 -2
index 61946e56eb..15ff660965 100755
@@ -28,7 +28,6 @@ startup_progress() {
     fi
     #echo "PROGRESS is $progress $runlevel $first_step + ($step of $num_steps) $step_change $progress_size"
     if type psplash-write >/dev/null 2>&1; then
-        psplash-write "MSG $(basename $1 .sh | cut -c 4-)" || true
         psplash-write "PROGRESS $progress" || true
     fi
 }
@@ -55,7 +54,7 @@ startup() {
 		"$@"
 		;;
   esac
-  startup_progress "$1"
+  startup_progress
 }
 
   # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
@@ -161,6 +160,7 @@ startup() {
 			#
 			[ -f $previous_start ] && [ ! -f $stop ] && continue
 		fi
+		psplash-write "MSG $(basename $i .sh | cut -c 4-)"
 		case "$runlevel" in
 			0|6)
 				startup $i stop
Signature · 1 line
2.30.0.rc0
#2 lore raw

Re: [OE-core] [master-next][PATCH 2/3] psplash: work on first boot (sysvinit)

In reply to Trevor Woerner

On Wed, 2020-12-23 at 12:06 -0500, Trevor Woerner wrote:
The psplash program has a mechanism for showing progress/updates. This is done via a pipe. On images that are R/O or images that are assembled via wic, the pipe is being setup in a location that is R/O on first boot,
therefore the pipe can not be created. If the psplash program is not able
to create the pipe, the app will not run. This situation is "fixed" on non-R/O images when the first bootup is complete. Therefore the psplash program is able to run for the first shutdown, and all subsequent bootups
and shutdowns as well, but not on the very first boot.

If the directory in which the psplash pipe is to be created already exists in
the filesystem and that location is not R/O on first boot, then the psplash
program can run on first boot (and subsequent boots and shutdowns).

NOTE: this is only an issue with sysvinit and most non-qemu machines. A systemd image, and images run on qemu machines, are able to run psplash on
the first and subsequent boots.

Personally, I don't really like the idea of having a top level directory called .psplash, is there a reason it doesn't work in /mnt?

Cheers,

Richard

#3 lore raw

Re: [OE-core] [master-next][PATCH 2/3] psplash: work on first boot (sysvinit)

Quoted 2 lines · Richard Purdie

Personally, I don't really like the idea of having a top level directory called .psplash,

Neither do I, which is why I also added the code to remove the directory once the psplash program is done running. Whenever psplash is run the directory is created just before it starts and removed when psplash is done.

Quoted 1 line

is there a reason it doesn't work in /mnt?

This all works fine (without any changes) on the qemuX machines, but on a real device (e.g. rpi) when the image is booted for the first time everything is mounted, initially, RO, when using sysvinit. At the end of the first boot, and for every subsequent boot, the filesystem is R/W, so everything works on subsequent boots.

On first boot, the error message I get is:
mkfifo: read-only filesystem
When the first boot is done, the last message is something along the lines of not being able to umount.

If the directory exists in the filesystem already (as part of the image) then psplash can create the fifo in it.

#4 lore raw

Re: [OE-core] [master-next][PATCH 2/3] psplash: work on first boot (sysvinit)

Quoted 10 lines · Trevor Woerner
Quoted 2 lines · Richard Purdie

Personally, I don't really like the idea of having a top level directory called .psplash,

Neither do I, which is why I also added the code to remove the directory once
the psplash program is done running. Whenever psplash is run the directory is
created just before it starts and removed when psplash is done.

Quoted 8 lines
Quoted 1 line

is there a reason it doesn't work in /mnt?

This all works fine (without any changes) on the qemuX machines, but on a real device (e.g. rpi) when the image is booted for the first time everything is mounted, initially, RO, when using sysvinit. At the end of the first boot, and for every subsequent boot, the filesystem is R/W, so everything works on
subsequent boots.

Right, but why can't psplash create /mnt/.psplash? Why do we need / and not /mnt ?

Cheers,

Richard

#5 lore raw

Re: [OE-core] [master-next][PATCH 2/3] psplash: work on first boot (sysvinit)

Quoted 20 lines · Richard Purdie
Quoted 10 lines · Trevor Woerner
Quoted 2 lines · Richard Purdie

Personally, I don't really like the idea of having a top level directory called .psplash,

Neither do I, which is why I also added the code to remove the directory once
the psplash program is done running. Whenever psplash is run the directory is
created just before it starts and removed when psplash is done.

Quoted 8 lines
Quoted 1 line

is there a reason it doesn't work in /mnt?

This all works fine (without any changes) on the qemuX machines, but on a real device (e.g. rpi) when the image is booted for the first time everything is mounted, initially, RO, when using sysvinit. At the end of the first boot, and for every subsequent boot, the filesystem is R/W, so everything works on
subsequent boots.

Quoted 2 lines

Right, but why can't psplash create /mnt/.psplash? Why do we need / and not /mnt ?

Ah okay.

Let me play with it some more. The only point of /mnt/.psplash (or /.psplash) is to have a directory in which a tmpfs can be mounted in which the fifo is created. [this is the current behaviour]

It all sounds rather convoluted. I'll look for something better.

#6 lore raw

Re: [OE-core] [master-next][PATCH 2/3] psplash: work on first boot (sysvinit)

Quoted 30 lines · Trevor Woerner
Quoted 23 lines · Richard Purdie
Quoted 12 lines · Trevor Woerner
Quoted 2 lines · Richard Purdie

Personally, I don't really like the idea of having a top level directory called .psplash,

Neither do I, which is why I also added the code to remove the directory once
the psplash program is done running. Whenever psplash is run the directory is
created just before it starts and removed when psplash is done.

Quoted 1 line

is there a reason it doesn't work in /mnt?

Quoted 9 lines

This all works fine (without any changes) on the qemuX machines, but
on a real device (e.g. rpi) when the image is booted for the first
time everything is mounted, initially, RO, when using sysvinit. At
the end of the first boot, and for every subsequent boot, the filesystem is R/W, so everything works on
subsequent boots.

Quoted 3 lines

Right, but why can't psplash create /mnt/.psplash? Why do we need / and
not /mnt ?

Ah okay.

Quoted 7 lines

Let me play with it some more. The only point of /mnt/.psplash (or /.psplash)
is to have a directory in which a tmpfs can be mounted in which the fifo is
created. [this is the current behaviour]

It all sounds rather convoluted. I'll look for something better.

I remember being involved in trying to make this work.

With sysvinit, /tmp and /var aren't available before populate-volatiles which is at init ordering "23" which was deemed too late for the splash screen. The only other option for a rw directory was either to mount one ourselves (the solution implemented) or maybe use something in devtmpfs but devtmpfs wasn't really the way people did things back then and wouldn't work universally.

The world has moved on, could we assume devtmpfs now?

Cheers,

Richard

#7 lore raw

Re: [OE-core] [master-next][PATCH 2/3] psplash: work on first boot (sysvinit)

In reply to Trevor Woerner
Quoted 9 lines · Trevor Woerner
Quoted 2 lines · Richard Purdie

Personally, I don't really like the idea of having a top level directory called .psplash,

Neither do I, which is why I also added the code to remove the directory once the psplash program is done running. Whenever psplash is run the directory is created just before it starts and removed when psplash is done.

Quoted 1 line

is there a reason it doesn't work in /mnt?

specifically…

mkdir: can't create directory '/mnt/.psplash': Read-only file system
mount: mounting tmpfs on /mnt/.psplash failed: No such file or directory
mkfifo: Read-only file system

then
umount: can't unmount /mnt/.psplash: No such file or directory

#8 lore raw

Re: [OE-core] [master-next][PATCH 2/3] psplash: work on first boot (sysvinit)

Quoted 21 lines · Trevor Woerner
Quoted 11 lines · Trevor Woerner
Quoted 2 lines · Richard Purdie

Personally, I don't really like the idea of having a top level directory called .psplash,

Neither do I, which is why I also added the code to remove the directory once
the psplash program is done running. Whenever psplash is run the directory is
created just before it starts and removed when psplash is done.

Quoted 1 line

is there a reason it doesn't work in /mnt?

specifically…

        mkdir: can't create directory '/mnt/.psplash': Read-only file system
        mount: mounting tmpfs on /mnt/.psplash failed: No such file or directory
        mkfifo: Read-only file system

Quoted 3 lines

then
        umount: can't unmount /mnt/.psplash: No such file or directory

You're misunderstanding my question. In your patch you create "/.psplash" in the splash recipe.

Is there a reason the psplash recipe can't create "/mnt/.psplash", i.e. match the original path ?

Cheers,

Richard

#9 lore raw

Re: [OE-core] [master-next][PATCH 2/3] psplash: work on first boot (sysvinit)

Quoted 5 lines · Richard Purdie

You're misunderstanding my question. In your patch you create "/.psplash" in the splash recipe.

Is there a reason the psplash recipe can't create "/mnt/.psplash", i.e. match the original path ?

Understood. I just wanted to update the email thread with the actual error messages (instead of going from memory) for posterity.