Yocto on the Raspberry Pi

Yocto on the Raspberry Pi

By Jeff Tranter

Yocto(1) is a software framework for embedded Linux systems. We've looked at it in previous blog posts(2). It forms the basis of many embedded Linux distributions, including The Qt Company's boot2qt that is part of their commercial product Qt For Device Creation(3).

Knowledge of Yocto is a very desirable and marketable skill to have for anyone working with embedded systems. While you can use emulators that run on a desktop Linux system, there is no substitute for experience with a real embedded board.

Yocto supports a number of embedded hardware platforms, one of the most popular being the BeagleBone Black(4). At a retail price of around US$60 it is quite affordable.

Yocto can also be built for the Raspberry Pi, which is even lower in cost than the BeagleBone. You may already have one or two kicking around, and if not you can start with a board as inexpensive as the $5 Raspberry Pi Zero.

The Raspberry Pi is not an officially supported board but there are some references around that cover how to get Yocto up and running on it, including Qt. I'll cover a few of them here that I have had experience with.

This procedure(5) is for a Raspberry Pi 2 with the official touchscreen display. I ran through the procedure and it successfully worked for me with a Raspberry Pi 2 and touchscreen, including being able run the qmlscene program to execute QML-based Qt 5 programs. I tried updating it to use the more recent "krogoth" release of Yocto so I could build Qt 5 with support for the Raspberry Pi 3. I was able to get it to build with a few changes to some of the bitbake recipes. While the generated image built and booted on the Raspberry Pi 3, running the qmlscene program would hang without anything being shown on the display. More investigation is needed to see what the problem is.

I also tried this procedure(6), configuring it for a Raspberry Pi 3. The generated Qt 5 image built and ran on the Pi, and even included the driver for the onboard WiFi hardware. I could run qmake and compile a simple widgets example natively on the board and run it successfully. The image is missing support for the xcb and eglfs platform plugins for Qt, and only has linuxfb, so it is of limited use because it won’t run QML programs. Getting eglfs working would be a good area of future work.

The Qt Company has been contributing(7) to the Qt 5 bitbake recipes for Yocto(8) and recently made their bitbake recipes for boot2qt open source(9). I was able to use these recipes to create a boot2qt image with Qt 5 and run it on a Raspberry Pi 3. I did have to make a few changes to remove some of the software components that are only available in the commercial version of Qt. This version has support for eglfs so it can run QML programs. It also builds a toolchain, which can be used to cross-compile and debug from the Qt Creator IDE.

DSCN4862.JPG 
A simple QML example running on the Raspberry Pi 3 with touchscreen (image credit: Jeff Tranter)

My experiments with Yocto on the Raspberry Pi are still in progress. I hope to cover more details in a future blog post.

References

  1. Linux Foundation Yocto Project, website, last accessed 11 July 2016, https://www.yoctoproject.org
  2. The BeagleBone Black - A Low-Cost Embedded Platform Part 2, ICS blog post, last accessed 11 July 2016, http://www.ics.com/blog/beaglebone-black-low-cost-embedded-platform-part-2
  3. Qt for Device Creation, Qt website, last accessed 11 July 2016, https://www.qt.io/qt-for-device-creation
  4. BeagleBone Black, BeagleBoard website, last accessed 11 July 2016, https://beagleboard.org/black
  5. Setting up a Yocto Build with Qt 5 for Raspberry Pi 2 with Official Touchscreen, blog.unixshell.se blog post, last accessed 11 July 2016, http://blog.unixshell.se/?p=27
  6. Building Raspberry Pi Systems with Yocto, Jumpnow Technologies website, last accessed 11 July 2016, https://www.jumpnowtek.com/rpi/Raspberry-Pi-Systems-with-Yocto.html
  7. Aligning with the Yocto Project, Qt blog, last accessed 11 July 2016, https://blog.qt.io/blog/2016/07/01/aligning-with-the-yocto-project
  8. Meta-qt5 Qt 5 layer for Yocto, Yocto Project website, last accessed 11 July 2016
  9. Meta-boot2qt Boot2Qt Layer For Yocto, Qt git repository, last accessed 11 July 2016, https://code.qt.io/cgit/yocto/meta-boot2qt.git