8

I'm creating a simple device with a Raspberry Pi and a touchscreen display connected to it.

On boot, I want to show a loading image (a simple gif or jpg) while X is starting. Then a chromium-browser instance will be started in kiosk mode showing my web-app.

What I have done

  1. I created a simple script which shows the splashscreen using fbi (as suggested in this answer):

    #! /bin/sh
    ### BEGIN INIT INFO
    # Provides:         splashscreen.sh
    # Required-Start:
    # Required-Stop:
    # Should-Start: 
    # Default-Start:     S
    # Default-Stop: 5
    # Short-Description: Show custom splashscreen
    # Description:       Show custom splashscreen
    ### END INIT INFO
    
    do_start () {
    
        fbi -T 1 -noverbose -a /home/splash.jpg
        exit 0
    }
    
    case "$1" in
      start|"")
        do_start
        ;;
      restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
      stop)
        # No-op
        ;;
      status)
        exit 0
        ;;
      *)
        echo "Usage: asplashscreen [start|stop]" >&2
        exit 3
        ;;
    esac
    
  2. I added a simple script which starts X and chromium:

    #!/bin/bash
    ### BEGIN INIT INFO
    # Provides:          myapp.sh
    # Required-Start:
    # Required-Stop:
    # Should-Start:
    # Should-Stop:
    # Default-Start:     5
    # Default-Stop:
    # Short-Description: Avvia l'applicazione
    # Description:       Avvia l'applicazione
    ### END INIT INFO
    
    if [ $1 == "start" ] 
        then
    
        echo "Starting X server - $(date)"
        sudo X -nocursor >/dev/null 2>&1 &
    
        echo "Waiting X server start - $(date)"
        while [ ! -x /tmp/.X11-unix/X0 ]; do
            sleep 0.001
        done
    
        echo "Starting chromium-browser - $(date)"
        sudo DISPLAY=:0 chromium-browser --noerrdialogs --disable-pinch --kiosk --start-full-screen --incognito http://localhost >/dev/null 2>&1 &
    
        exit 0
    fi
    

Everything works fine, except that the splash screen disappears as soon as the sudo X -nocursor >/dev/null 2>&1 & command is run, which makes the screen black until X ends loading (and chromium appears).

I also created a simple python script which starts again fbi, but it is hidden almost immediately.

So, how can I show the loading image while X loads in the "background"?

Any advice is accepted. My goal is to give the best experience to the user (in fact, I've hidden all of the console messages).

Consider that I'm using jessie-lite on Raspberry Pi 3 Model B.

Thank you!

tlhIngan
  • 3,342
  • 5
  • 18
  • 33
  • I'm attempting to do the exact same thing for the exact same reason, but havn't made any major progress. I'll have a play around with your script, and see if I can make some more headway with it, but I'd be interested in hearing about any further progress you make as well :) – Gareth Jones Nov 15 '17 at 23:01
  • [This question](https://raspberrypi.stackexchange.com/questions/50197) may give some insight - It bascially echos (and expands on) one of my suspicions; That part of the problem is the Pi's processing power and speed. – Gareth Jones Nov 16 '17 at 18:49

2 Answers2

1

See if adding xsetroot -solid "#ffffff" to .xinitrc (or whatever Xorg startup script you've configured) has an effect (it should change the background color to white). If that works, you may be able to display your splashscreen with xsetroot -bitmap.

Dmitry Grigoryev
  • 26,688
  • 4
  • 44
  • 133
1

There is no way to do like you ask the reason is also the tty login (I think you have it enable) To perform a clean boot to X without make the splashscreen disappear you can follow these steps:

  1. Add quiet in kernel parameter (cmdline.txt)
  2. Install plymouth to manage the splash image while kernel booting
  3. Configure autologin (and startx during the autologin)
  4. Set the X background to the same used in splash image (so if you have to start Chrome for example, you dont see the X black background while loading it)
MadPapo
  • 221
  • 1
  • 8
  • Thank you for some useful info in this answer. I'd like to point out, however, that "There is no way to do [this]" is... over-stating it. We're talking about [Free Software](https://www.gnu.org/philosophy/free-sw.html) here... there's a way, it's just a question of where the trade-off is between effort required to implement it, on the one hand, and what level of interruption in the splash screen is tolerable, on the other -- and finding a solution that fits the happy-medium (as determined by the asker -- likely to be different for different folks) between those competing demands. – lindes Feb 24 '21 at 03:43