Home Enabling framebuffer on qemu_arm_versatile and Buildroot
Post
Cancel

Enabling framebuffer on qemu_arm_versatile and Buildroot

Introduction

When using the default Buildroot target qemu_arm_versatile, no display is enabled:

Desktop View That’s sad and disappointing

In this tutorial, we will learn how to get the kernel to recognize the display, and setup the framebuffer, so as to display beautiful images like this one:

Desktop View That’s more colorful (running fb-test)

Setting up the no-screen VM

First, let’s create a simple system based on the template Buildroot provides for Qemu’s versatilepb.

Get and extract Buildroot (2024.02.10 at the time of writing):

1
2
3
4
5
$ wget http://buildroot.org/downloads/buildroot-2024.02.10.tar.xz
$ xz -d buildroot-2024.02.10.tar.xz
$ tar -xvf buildroot-2024.02.10.tar
$ rm buildroot-2024.02.10.tar.xz
$ cd buildroot-2024.02.10

Now, let’s use the defconfig for our target:

1
2
$ make qemu_arm_versatile_defconfig 
$ make

Once the build is done, we can boot it:

1
2
3
4
5
$ output/images/start-qemu.sh

...
Welcome to Buildroot
buildroot login: 

You can login with username root, and notice how no framebuffer device is available:

1
2
# ls /dev | grep fb0
#

Enabling the display

Manually

We need to enable kernel config options to have the kernel recognize the embedded PL110 LCD controller.
Run:

1
$ make linux-menuconfig

Once in the menu, enable the following options (that Buildroot’s default qemu_arm_versatile_defconfig does not enable):

1
2
3
4
5
6
7
8
9
10
11
12
13
Device Drivers
    -> Graphics support
        -> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) [y]
        -> Display Interface Bridges
            -> Display connector support [y]
        -> Display Panels
            -> ARM Versatile panel driver [y]
            -> support for simple Embedded DisplayPort panels [y]
            -> support for simple panels (other than eDP ones)
        -> DRM Support for PL111 CLCD Controller
        -> Console display driver support
            -> Framebuffer Console support [y]
            -> Map the console to the primary display device

Alternatively, you can search for these options and enable them:

1
2
3
4
5
6
7
8
DRM [y]
DRM_DISPLAY_CONNECTOR [y]
DRM_PANEL_ARM_VERSATILE [y]
DRM_PANEL_EDP [y]
DRM_PANEL_SIMPLE [y]
DRM_PL111 [y]
CONFIG_FRAMEBUFFER_CONSOLE [y]
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY [y]

Save, exit and build.

1
2
$ make linux # if you only want to build the kernel
$ make       # to build everything

Warning! Your modifications will be lost when the build folder is cleaned!
That’s because Buildroot uses output/build/linux-x.x.x/.config to configure linux, and this folder is deleted by make clean.

Automatically

You can use this config patch that automatically enables these options.
We can tell Buildroot to apply these patches on top of its configuration before building the kernel.

You can enable it in Buildroot by adding its path to the BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES variable in Buildroot.

Conclusion

The system now boots with a working display !

Desktop View Tux!

This post is licensed under CC BY 4.0 by the author.