In general the Raspberry Pi is great learning tool. One reason is the great default verbose boot and console messages you see when booting or shuting down your raspberry pi. But for some more polished projects, its quite handy to hide all of that and have a nice boot loading animation instead.

In this instance we also add a ZRAM swap partition in your rapsberrys RAM that heavily increases you I/O and also saves a lot of read/writes on your sdcard. Lets get started: ssh into your pi or grab a keyboard and open up the terminal directly on your Pi:

Disable graphical outputs on boot

First we disable the rainbow screen the Pi boots with by editing the config.txt:

sudo nano /boot/config.txt

go to the very end and add as the last line:

disable_splash=1

Save and exit with STRG+X and confirm overwriting the file with Y. Next we edit cmdline.txt to change the output of the pis console.

WARNING: Editing cmdline.txt wrong will break your Raspberrys boot up. Always ensure that you have everything in line 1. nothing should be split up into two lines and all parameters split by just 1 space!

sudo nano /boot/cmdline.txt

In this file you will finde a string of parameters all in line 1. Its important that you add the following exactly at the end of the existing line 1, starting with a space between the exisitng and new. So lets add:

consoleblank=1 logo.nologo quiet loglevel=0 plymouth.enable=0 vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fastboot noatime nodiratime noram

Save and exit with STRG+X and confirm overwriting the file with Y.

Boot with a video or image as a splashscreen

We use omxplayer for that. So first we need to install it by:

sudo apt-get update
sudo apt-get install omxplayer

Next we tell the pi in the rc.local to play our video on boot:

sudo nano /etc/rc.local

Now find the path of the video you want to use. In my case a I created a series of different long boot videos that just play as long as my application need to be fully loaded. If you want to try them out just find them on my github and place the videofile you want in your /home/pi/ directory. For me the path to my file is: /home/pi/bootvideo_36sec.mov

So in rc.local add before the end where it says exit 0 these two lines. Don‘t forget to replace my path to the video with yours. You can use all kind of formats, avi, mp4 and more should all work fine as well.

dmesg --console-off
omxplayer /home/pi/bootvideo_36sec.mov &

Save and exit with STRG+X and confirm overwriting the file with Y. Now reboot and you should have a blank black screen for shutdown as well as for the bootup until your video starts to play. When done your Pi should be fully loaded and booted up 🙂

sudo reboot

Create the ZRAM swap

Last step we enable and create the ZRAM on the pi. We use this script for creating the install and swap partition:

git clone https://github.com/foundObjects/zram-swap.git
cd zram-swap && sudo ./install.sh

When the script is successfully done, add Kernel parameters to make better use of ZRAM, so rather than leaving swapping till the last minute, where it often brings the Raspberry Pi to a crippling halt. We add the following lines to /etc/sysctl.conf and reboot.

These lines will 1) delay the inevitable, running out of memory. This is done by way of increasing the kernel’s cache pressure and 2) start preparing for being out of memory sooner by increasing the tendency of your Raspberry Pi to swap. However, swap will now be stored via much faster ZRAM.

Here are the lines you’ll want to add at the end of your /etc/sysctl.conf file:

vm.vfs_cache_pressure=500
vm.swappiness=100
vm.dirty_background_ratio=1
vm.dirty_ratio=50

Save and exit with STRG+X and confirm overwriting the file with Y. Now reboot and your ZRAM is all set successfully!

sudo reboot

Thats all, your Pi should be now running in a much more cleaner way and be more presentable as a daily used product 🙂