Software Setup For Touchscreen Display

I’ve mostly automated the setup of the software for the Life display frame software. You can find the scripts here on GitHub . Running this requires a Linux system with ansible and git installed.

I am running this on a Raspberry Pi ZeroW , but it should work on just about anything running Debian Linux .

This uses the lite version of Raspberry Pi OS without a GUI. You should download the correct one for your hardware, expand the image, and write it to an SD Card:

unxz 2023-05-03-raspios-bullseye-armhf-lite.img.xz
sudo dd if=/home/bcl/Downloads/2023-05-03-raspios-bullseye-armhf-lite.img of=/dev/sdX bs=1M

Make sure you have the right device as the of=/dev/sdX argument. You can easily destroy your running system if you are in a hurry and use the wrong one. blkid can be helpful in showing the attached devices, or look at the last few lines of sudo dmesg output after plugging in the card for the device name.

Mount the partitions so that you can set things up before first boot:

sudo mkdir -p /mnt/d1/boot /mnt/d1/root
sudo mount /dev/sdX1 /mnt/d1/boot
sudo mount /dev/sdX2 /mnt/d1/root

Partition 1 will be the /boot partition and 2 will be the root filesystem.

Now run the setup.sh script and then edit /mnt/d1/boot/wpa_supplicant.conf to setup access to your local WiFi access point using the SSID and shared passphrase.

sudo ./setup.sh /mnt/d1/
sudo vim /mnt/d1//boot/wpa_supplicant.conf

If you forget this step it will boot but you won’t be able to log in. If you forget, just shut it off, mount the /boot partition again, copy over ./configs/wpa_supplicant.conf manually, edit it, and reboot with the new file.

Change the default password for the `life’ user by running:

openssl passwd -6

And copying the output into /mnt/d1/boot/userconf, replacing the part after the :.

sudo vim /mnt/d1/boot/userconf

Now unmount /mnt/d1/boot and /mnt/d1/root, put the SD card into the Pi and boot it. It is best to do this with a display and keyboard so you can see what IP address is assigned, or deal with any unexpected errors. The Pi OS will resize the partition, expand the root filesystem and setup the WiFi AP credentials on first boot, you will see some dialogs on screen as it does this.

The IP should be printed at the login prompt, depending on how fast the WiFi setup is. You may have to login to check the output of ip a if it shows 127.0.0.1 (localhost).

You should now be able to ssh to the Pi as the life user.

The next step is to run the ansible playbook, edit the hosts file and replace the IP address with the IP address of the Pi. And run:

ansible-playbook -v -k ./setup.yml

Enter the life user’s password when prompted for the SSH password: and wait for the playbook to finish.

Now the system is ready to build the sdl2-life program. Cross-compiling to armhf is a pain when using the sdl2 library so the playbook installs everything you need to build it on the Pi. Just log in as the life user again and run:

cd /opt/sdl2-life
go build -x

Go mow the lawn, do the dishes, fold the laundry, watch Bladerunner and it should be done building before you know it.

To test it out before rebooting you can run /home/life/run-life-server and it should take over the display and run! The only thing left to do is to reboot and make sure it starts automatically.

If everything is running you can disable the boot messages by editing the /boot/cmdline.txt file and adding logo.nologo console=null quiet to it. But this does make it difficult to debug things if something goes wrong.