While getting a Psion Series 5mx emulator running on my Cardputer Zero, I wanted a shell I could come back to when I closed it. The device already had Linux, a keyboard and a 320 × 170 LCD. It was a matter of getting the screen to show the console at boot.
Finding the framebuffer
The factory launcher, APPLaunch, draws to the built-in LCD through Linux’s framebuffer interface. The kernel’s framebuffer console, fbcon, can use that same display to draw a text session. On my Cardputer, the /dev/fb_lcd alias resolves to /dev/fb0. The alias is what I check first, since the framebuffer number depends on which displays the kernel finds. APPLaunch source · Linux framebuffer console documentation
readlink -f /dev/fb_lcd
cat /proc/fbThe factory /boot/firmware/cmdline.txt on my image already had console=tty1. It also had fbcon=map:off. Changing that to fbcon=map:0 mapped the console to the built-in display on my unit. I kept the other boot arguments on the same line. Raspberry Pi boot configuration
Giving the console the screen at boot
I set the default boot target to multi-user.target, made sure the tty1 login service was enabled, and disabled APPLaunch for the account that ran it. I also disabled the vendor’s fb_load.service and commented out splash_screen= in /boot/firmware/config.txt. That covered both places the vendor splash came from on my image.
I did the setup over SSH, with copies of the boot files and keyboard configuration available for recovery. SSH is also how I verified the virtual terminal after rebooting. M5Stack’s SSH setup guide
cat /sys/class/tty/tty0/activeGetting the blue symbols back
The factory image ships a keymap for the TCA8418 keyboard. Once I was using the virtual console, I needed Debian’s console setup to load that map so the keys printed in blue matched what I typed. I added this line to /etc/default/keyboard.
KMAP="/usr/share/keymaps/tca8418_keypad_m5stack_keymap.map"Then I saved the keyboard configuration for the next boot.
sudo setupcon --keyboard-only --save-onlyMaking it reversible
I put the setup into a small Bash script with three commands. status shows the running and saved console settings. apply backs up the boot files and service settings before changing them. restore puts the saved configuration back over SSH, even if the LCD device is missing. Script and setup instructions on GitHub
I confirmed the LCD console on my Cardputer and tested the script’s apply and restore paths with temporary files and simulated services. Running the script from scratch on a fresh image is still on my list.
The part I use most is the simplest one. With the emulator closed, there’s a shell on the little screen and the keyboard is ready to use.

Discussion