6

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!

  • 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 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
0

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)

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.