Embedded Linux projects often use serial to output their bootlog to a serial console on another computer. Some may want to just hook up a keyboard and display and connect to their embedded system that way. This can be useful for a standalone, user-facing deployment of Linux on an embedded platform.
This might be useful if you have an embedded Linux board away from any network connection, making SSH access impossible. Imagine a DIY home gardener wants to monitor soil moisture levels in their backyard away from WiFi. Or a large machine shop needs a simple Linux box to interface with an old mill and they don’t want to bring a laptop out to the shop floor.
Having the ability to interface directly to an embedded Linux board without the need to have networking or a second computer can be very helpful in many situations.
Here at DornerWorks, we wanted to add a user visible Linux bootlog to our Doom Pendulum Demo.
The main driver used to do this is called fbcon.
Fbcon is a framebuffer console driver for Arm and x86 platforms. We can use this in Linux as a regular console that displays text to the screen.
In our example we are enabling fbcon over DisplayPort on an Ultra96. The Ultra96 is an Avnet development board that utilizes Xilinx Zynqmp. Xilinx use a tool called Petalinux, built on top of Yocto, to build Linux for their embedded platforms. This blog will show Petalinux specific configurations but they Linux configs should be the same for any Linux build.
Note: This blog assumes the kernel and device tree have already been configured properly to use DisplayPort. You can follow this guide to enable DisplayPort on your ZynqMP based system.
The main Linux configs needed to use fbcon are as follows:
In Petalinux these can be added using the petalinux-config -c kernel
command. Use / to search for each config and enable them all.
They can also be added by creating the file project-spec/meta-user/recipes-kernel/linux/linux-xlnx/fbcon.cfg
and adding the following:
CONFIG_DRM_ARM=y
CONFIG_DRM_MALI_DISPLAY=y
CONFIG_FB_SIMPLE=y
CONFIG_CMA=y
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=256
And then add that fbcon.cfg
file to project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend
:
SRC_URI += "file://fbcon.cfg"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
Rebuild petalinux and fbcon should be built into your kernel.
Fbcon and supporting drivers are now built into the kernel but Linux still needs to be configured to use them. Modify the device tree’s bootargs to use fbcon.
bootargs = "earlycon console=tty0 console=ttyPS0,115200 fbcon=map:0 clk_ignore_unused root=/dev/ram0";
The lines that pertain to fbcon are as follows:
console=ttyPS0,115200
– this makes sure the output is still going to the default serial consoleconsole=tty0
– The fbcon console will appear as /dev/tty0
fbcon=map:0
– tells fbcon to map to /dev/tty0
With fbcon enabled on your embedded Linux platform you no longer have to have an exposed serial port, a network connection, or a second computer to interface with your device. You can move your embedded Linux boards into your back yard, machine shop, or anywhere you need to interface with your tools.
DornerWorks expertise in embedded platforms can enable greater flexibility in your projects, freeing you to focus on what you do best. Schedule a meeting with our team when you are ready to develop your next product and we will help you map out a plan to turn your ideas into reality.