Pi kiosk – How to boot your Pi into Chromium Browser

This guide will explain how to run your Raspberry Pi into a kiosk which boots straight into Chromium, the original article i followed can be found here, as well as being linked at the bottom of the post.

You will need Raspbian installed onto an SD card with the first initial configuration completed with raspi-config. After this you need to update/upgrade and install some extra programs :

$ sudo apt-get update

$ sudo apt-get dist-upgrade

$ sudo apt-get install matchbox chromium x11-xserver-utils ttf-mscorefonts-installer xwit sqlite3 libnss3

$ sudo reboot -h

Now we need to edit a few configuration files to tell the Pi to boot into chromium, first up add this on to the bottom of your /boot/config.txt file, changing the resolution to suit your needs :

# 768×480 at 32bit depth, DMT mode
disable_overscan=1
framebuffer_width=768
framebuffer_height=480
framebuffer_depth=32
framebuffer_ignore_alpha=1
hdmi_pixel_encoding=1
hdmi_group=2

 

Next we add this to the /etc/rc.local file :

# Wait for the TV-screen to be turned on…
while ! $( tvservice –dumpedid /tmp/edid | fgrep -qv ‘Nothing written!’ ); do
bHadToWaitForScreen=true;
printf “===> Screen is not connected, off or in an unknown mode, waiting for it to become available…\n”
sleep 10;
done;

printf “===> Screen is on, extracting preferred mode…\n”
_DEPTH=32;
eval $( edidparser /tmp/edid | fgrep ‘preferred mode’ | tail -1 | sed -Ene ‘s/^.+(DMT|CEA) \(([0-9]+)\) ([0-9]+)x([0-9]+)[pi]? @.+/_GROUP=\1;_MODE=\2;_XRES=\3;_YRES=\4;/p’ );

printf “===> Resetting screen to preferred mode: %s-%d (%dx%dx%d)…\n” $_GROUP $_MODE $_XRES $_YRES $_DEPTH
tvservice –explicit=”$_GROUP $_MODE”
sleep 1;

printf “===> Resetting frame-buffer to %dx%dx%d…\n” $_XRES $_YRES $_DEPTH
fbset –all –geometry $_XRES $_YRES $_XRES $_YRES $_DEPTH -left 0 -right 0 -upper 0 -lower 0;
sleep 1;

Then we also add this to the /etc/rc.local file :

if [ -f /boot/xinitrc ]; then
    ln -fs /boot/xinitrc /home/pi/.xinitrc;
    su – pi -c ‘startx’ &
fi

Before saving it and exiting. Next up is to create an xinitrc file in your boot partition, this can be done from the pi or you can shutdown and insert it into a linux/windows machine and create one on the partition from there with this information included :

#!/bin/sh
while true; do

# Clean up previously running apps, gracefully at first then harshly
killall -TERM chromium 2>/dev/null;
killall -TERM matchbox-window-manager 2>/dev/null;
sleep 2;
killall -9 chromium 2>/dev/null;
killall -9 matchbox-window-manager 2>/dev/null;

# Clean out existing profile information
rm -rf /home/pi/.cache;
rm -rf /home/pi/.config;
rm -rf /home/pi/.pki;

# Generate the bare minimum to keep Chromium happy!
mkdir -p /home/pi/.config/chromium/Default
sqlite3 /home/pi/.config/chromium/Default/Web\ Data “CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); INSERT INTO meta VALUES(‘version’,’46’); CREATE TABLE keywords (foo INTEGER);”;

# Disable DPMS / Screen blanking
#xset -dpms
#xset s off

# Reset the framebuffer’s colour-depth
fbset -depth $( cat /sys/module/*fb*/parameters/fbdepth );

# Hide the cursor (move it to the bottom-right, comment out if you want mouse interaction)
#xwit -root -warp $( cat /sys/module/*fb*/parameters/fbwidth ) $( cat /sys/module/*fb*/parameters/fbheight )

# Start the window manager (remove “-use_cursor no” if you actually want mouse interaction)
matchbox-window-manager -use_titlebar no &

# Start the browser (See http://peter.sh/experiments/chromium-command-line-switches/)
chromium –app=http://www.google.com

done;

Next just reboot and it should automatically launch into chromium. For more detailed instructions see the link below. Enjoy !


HOWTO: Boot your Raspberry Pi into a fullscreen browser kiosk | Wired Watershed
.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s