Writing a decent Gemlog requires time, I started writing this article using a ten years old Crapbook but I eventually bought a used 2021 Crapbook, which works way more better thant the old one but also changed some procedures formerly described here, I tried to keep everything as much as closer as the original intention.
Actually PICO-8 development sounds too much ambitious, however I crossed again a path where Linux is "in" while (Open)BSD is "out".
In the difficult task to create interest around Computer Science for my eldest child, I thought that making video games might be enough interesting to stimulate its attention. While this has revealed — once again — wrong, I found that running PICO-8 from OpenBSD was something unfeasable, for the same usual reasons.
The idea that in the opensource world there are operative systems that have more and others that have less really hurts my romantic idealism; even though PICO-8 is closed software, it runs only on Win, Mac and Linux… And the BSDs? Nope!
The reason why I selected PICO-8 is because is well crafted and it reached a decent growth; therefore has a lot of documentation. And what I need the most is documentation: being without any coding skill the documentation is essential.
As I wrote before PICO-8 runs only on Win, Mac and Linux. Do I have any machine available with this Operative Systems?
Let me check what I have:
My child is fine but I won't use the i7 Linux partition. The i7 is enough powerful to run heavy virtual machines but this won't be the case as well. The newer Crapbook isn't very suited to emulate anything and even if it could "vmm", the OpenBSD Hypervisor, does not support X so it is excluded. Therefore I thought: «at least I could use TIC-80» which is an opensource alternative available on OpenBSD, but unfortunately I discovered it froze the older Crapbook badly and I haven't tested it yet on the newer one.
As for now I haven't tested yet TIC-80, but I am pretty sure with the AMD64 version and newer driver, and hardware, it should work just fine.
The Ryzen 3 compact PC is too much for just running PICO-8…
I remember many years ago at the beginning of the SBC phenomenon a bunch of geeks were able to crowdfund a small computer called C.H.I.P.
This cool project powered by Linux did come with a PICO-8 already installed; what is important here is that CHIP was barely better than the first RPI; and which computer did I have that is energy saver and enough powerful to run PICO-8?
YOU GOT IT!
Correct! The RPI2 has been my NAS soldier for a long time, handling the worst setup possible for a file server and luckily it was replaced by another SBC; but without a scope was it was threw inside a box collecting dust! Time to make it shining again!
Raspian, now RaspberryPI OS, is the best OS available for the RPIs, having others SBCs I knew the OS support for RPIs is way more better than the others vendors, however Raspbian has a HUGE problem: systemd!
My bias against systemd is purely a principle matter, and since I am not a developer, nor a sysad and not even a devops for me principles matter; therefore I decided to install Devuan which is, by the way, built off Raspian!
I downloaded "devuan-arm-5.10.110" to get a newer kernel; after the initial installation everything was already good, here a small recap:
At least for me, since I've never used any VNC services before! Why do I need a VNC connection? I guess this is pretty easy to answer: I want connect the RPI2 to the Crapbook in headless mode, I guess I could use a SSH + X11 forwarding but I think the VNC might bring also audio which I am pretty sure the SSH + X11 Forwarding does not…
Fortunately in the RPIs world this topic is pretty common, here is the guide I followed:
=> https://learn.adafruit.com/adafruit-raspberry-pi-lesson-7-remote-control-with-vnc/installing-vnc
The following packages will install the VNC server and other utilities that are needed later or are required by PICO-8, like 'wget'.
sudo apt install tightvncserver mesa-utils xorg wget rungetty
Here for laziness I decided to fully install Xorg, which brought a lot of useless stuff, but I could risk to miss some relevant packages.
The recent version of Raspian comes with an annoying behavior that I already faced on OSMC (a Debian derivatives with Kodi on top), when I upgraded it to a major version a couple of months ago, before to dismiss the RPI2 definitely! Weirdly, for a device that is supposed to be used mainly headless, the operative system won't boot if it doesn't find a screen device connected, the fixing for Devuan was easy but on OSMC I had to hardcode manually the EDID configuration which required to jump through quite hoops.
This means the very first boot must be done connected to any screen which supports HDMI.
The first boot is always slow since the filesystem need to be expanded, once this is completed the changes must be done in '/boot' with 'sudo'.
Open the '/boot/config.txt' which is the boot configuration file and change the line below from 0 to 1;
hdmi_force_hotplug=1
Not sure if this is still in use, but once you had to create this empty file in order to activate the "headless" mode.
sudo touch /boot/ssh
Those solutions were found inside these links:
=> https://linuxconfig.org/how-to-run-x-applications-without-a-desktop-or-adevuan | https://superuser.com/questions/407914/automatic-root-login-in-debian-6-0-without-gui-xserver | https://forums.raspberrypi.com/viewtopic.php?f=63&t=250288&p=1528000&hilit=boot+Pi4+headless#p1528000
If you haven't read the tutorial yet, the setup is pretty easy: it is required to run this simple command:
vncserver :1
You will be prompted to enter and confirm a password which is limited to 8 characters only. I used « picopico » which is pretty easy to remember.
You will also be asked if you want to create a separate “read-only” password – say no. (from the aforementioned Adafruit link)
At this stage before to move forward I would like to check both the connections:
By default DevuanPI uses "devuan" for both default password and user; to test it out we need to know the ip addres; modern linux uses 'ip' instead of 'ifconfig', I have hard time to remember 'ip' options, anyway to learn the ip address below some useful command:
ip link show eth0 ip link # show all the connections available
Once the ip address is known the connection can be established this way:
ssh devuan@YOUR-LAN-IP
Hoping this is going to work.
IT WORKED! 😁👍
Since I ssh into the RPI2 now I can change the network interface to allow cross cable connection between the RPI2 and the Crapbook.
The RPI2 is shipped with only a crap USB Ethernet 10/100, once you change the interface for the cross connection the only — and easy — way to update the packages is through a WiFi Dongle.
I setup the RPI exactly this way:
sudo micro /etc/network/interfaces
and I changed the inside content to:
auto lo iface lo inet loopback auto wlan0 iface wlan0 inet dhcp wpa-ssid #YOUR PREFFERED WIFI wpa-psk #ITS PASSWORD # Auto setup #allow-hotplug eth0 #iface eth0 inet dhcp # Cross Cable setup allow-hotplug eth0 iface eth0 inet static address 10.0.10.2/24 netmask 255.255.255.0
I suggest to finish the setup and testing the changes later rather than restart the network with:
sudo services networking restart
Modifying the interface on OpenBSD is extremely easier and lesser convoluted than on Devuan. This documentation is meant for people that already know OpenBSD, but for the ones that don't know anything about it, on OpenBSD each network interface is a file in /etc called:
so for instance I have:
Whatever is the Ethernet interface, the old Crapbook was alc0, the setup must always match this:
#autoconf # Cross Cable Connection inet 10.0.10.1/24 255.255.255.0
Imagining all the changes were made and the RPI2 restarted (actually rebooting the PI2 doesn't work on Devuan) and the Crapbook Network services restarted with:
doas sh /etc/netstart
And imagining the RPI2 and the Crapbook are connected with the Ethernet Red Cable, it is possible testing the connection with:
ssh devuan@10.0.10.2 (devuan@10.0.10.2) Password:
Red is the reference color for the cross cables.
Since I got the second line then it means the connection is working; now typing the password let me ssh into DevuanPi.
The whole scope of this guide is:
therefore I decided to autologin into the TTY session without typing anything and to run PICO-8 automatically.
Nowadays tunings a distro based on Devuan is become complicated since information belonging "ante" the systemd-era are buried into internet and difficult to find!
For instance I had to search for solutions related with Debian Squeeze, and eventually I got one that is way more practical (and easier) than to create a clunky systemd-unit! You need only to install 'rungetty' which is still available on the Debian repo and to modify the corresponding line of '/etc/inittab' file:
1:2345:respawn:/sbin/rungetty --autologin devuan --noclear tty1
rungetty was already suggested as package to install
This section describes the way I use ti launch automatically the VNC Server and PICO-8.
To begin there is a simple script Script to run these services sequentially:
micro ~/.local/bin/p8.sh
The script runs before the VNC Server — remember this must be the user created during VNC setup — at the resolution I found useful for my screen size, then it runs PIC0-8:
#!bin/sh # VNC Server USER="YOUR-USER" vncserver -geometry 600x500 :1 && #PICO-8 sleep 3 && ~/./p8
'p8' is symbolic link: p8 -> ~/pico-8/pico8
As usual the script must be executable:
chmod +x ~/.local/bin/p8.sh
I create a symbolic link for simplicity in case I need to launch manually PICO-8:
ln -s ~/pico-8/pico8 ~/p8
To start service anytime at boot I used crontab with @reboot function:
crontab -e @reboot sleep 5 && sh $HOME/.local/bin/p8.sh
TightVNC Server doesn't allow you to connect into the current session (sharing desktop), so when you VNC from the client an instance of PICO-8 is already running. The resources of a RPI2 are limited thus I have to stop the current instance and run a new one, this can be done manually but computers are good at repetitive tasks.
I knew it was feasible and I tried it, but this was another PEBCACK story:
However even if I got the right intuition I needed help by — as usual — OP which just gave sense to my messed code…
The new script was saved like the other one in ~/.local/bin/
micro ~/.local/bin/vl.sh
The scope of the script is to check, every 20s, if a VNC connection through port 5900 or 5901 has been established, if it happens (even if you type a wrong password) it breaks the loop and launches a sigterm to "p8", which is the symbolic link to the real PIC0-8 binary, and I don't need to do it manually anymore, check the script out:
#! /bin/sh while true do if netstat -an | grep -s "590.*ESTABLISHED" then killall -q p8 break fi sleep 20 done
and to finish:
chmod +x ~/.local/bin/vl.sh
My tests and trials taught me those @reboot commands work better if invoked as shown next:
@reboot sleep 5 && sh $HOME/.local/bin/p8.sh @reboot sleep 30 && sh $HOME/.local/bin/vl.sh
I'd like to point out the script that checks the connection is delayed of 30s. It is worth to mention that I analyzed the impact of the script and I noticed that is totally uninfluenced so I decided that it can continue to run in background without needed to close it after a while.
Bluetooth service is enabled and is unnecessary so I disabled it:
sudo service bluetooth stop
On the OpenBSD it is needed a VNC client to connect to the RPI2, I installed TigerVNC that is well known to be a lightweight client, ideal for older and newer Crapbooks.
doas pkg_add tigervnc
Below the screenshots of my TigerVNC setup, it was kept simple and basic without any security or encryption features enabled.
=> VNC Tiger settings — 01 | VNC Tiger settings — 02 | VNC Tiger settings — 03 | VNC Tiger settings — 04 | VNC Tiger settings — 05 | VNC Tiger settings — 06
The most important thing is the VNC address:
10.0.10.2:1
It is important to mention that in case you use the ethernet-to-usb adapter, you must before plug it into the Crapbook, then you have to restart the network as described some chapters above and starting the RPI2 with the cable connected otherwise won't boot for some networking errors, that are difficult to investigate in headless mode…
When you close PICO-8 from the VNC windows, the remote shell becomes insensitive to any keyboard input so the best way is SSH into and then shutting down the board. Once I saw a USB dongle that could be used as power button to shutdown the PIs, it may be an options especially when in "console mode".
Power management on DevuanPi looks like is not working properly, thus nine times out of ten restarting the board won't work; it is preferable shutting down the RPI2 and then unplug and plug again the AC adapter.
Now I recycled my unused RPI2 and at the same time I kept OpenBSD into this project. I am pretty sure the newer Crapbook is able to support TIC-80 this time. As usual this was a trip into the pebcakness land, and eventually I got something. The setup is anything close to the perfection but someone else can take inspiration and doing something better, I look forward exactly for this happening!
For comments or suggestion write me at:
=> ↩ go back This content has been proxied by September (ba2dc).Proxy Information
text/gemini;lang=en