Follow up on “Going Public” post

My first post on this blog was about “going public” in two ways: launching the blog, and trying to upstream my support for Monark stationary bikes in GoldenCheetah. The latter went really well, and I know that more and more people are actually using GC with their Monark bikes. Knowing that the work I did benefit others is an extra motivating factor, and it feels nice to be able to contribute to a project I use and love.

I could also add support for the more advanced bikes which can be computer-controlled since I got help with the testing from a bunch of helpful people from a Facebook group for Monark users.

Posted in Cycling, Programming | Leave a comment

Setting up a Yocto build with Qt5 for Raspberry Pi 2/3 with official touchscreen

Update 2:

I’ve updated the post to work with the Krogoth release of Yocto/Poky, and with the Raspberry Pi 3.


I’ve updated the post to work with the Jethro release of Yocto/Poky, all with the help of your helpful comments!


In this post I intend to provide easy instructions for how to build an image for running Qt Qml applications on a Raspberry Pi 2 with the official 7″ multi-touch screen. It probably helps if you have used Yocto or Open Embedded before, but it shouldn’t be a must. Feel free to ask questions in the comments and I’ll try to answer and makes things clearer in the post if needed.

Getting the layers

First of all we need to get the different layers involved. I like to keep the layers in a directory called sources, keeping them in a separate directory makes it easy to grep for things in them when I need to.

mkdir -p ~/rpi/sources
cd ~/rpi/sources

git clone -b krogoth git://
git clone -b krogoth git://
git clone -b master git://
git clone -b krogoth
git clone -b krogoth

Preparing the build configuration

Next thing to do is to create a build environment using the setup script that comes with poky. This will create example configuration files that we will modify to add our extra layers, and to build for the Raspberry Pi 2/3.

cd ~/rpi/
source sources/poky/oe-init-build-env rpi-build

We now need to add a couple of rows to local.conf that configures the build for us.

# Set the correct target machine, change to raspberrypi2 if you have one of those
echo 'MACHINE = "raspberrypi3"' >> conf/local.conf

#Prefer version 4.x of the kernel
echo 'PREFERRED_VERSION_linux-raspberrypi = "4.%"' >> conf/local.conf

# Don't use X11 and wayland
echo 'DISTRO_FEATURES_remove = "x11 wayland"' >> conf/local.conf

# Use systemd as init system
echo 'DISTRO_FEATURES_append = " systemd"' >> conf/local.conf
echo 'VIRTUAL-RUNTIME_init_manager = "systemd"' >> conf/local.conf

In order to enable the new layers bblayers.conf needs to be modified, in meta-erborpi/misc/ there’s a version you can use.

cp ~/rpi/sources/meta-erborpi/misc/bblayers.conf conf/bblayers.conf

Building the image

In meta-erborpi there’s an image based on the minimalistic core-image but with the addition of Qt5 and qmlscene that can be used to launch Qml applications. It also comes with an example Qml application which shows the use of up to four simultaneous touch points. Note that both Qt and the touchscreen support more than these four points. The image is called core-image-qt

To start the build

bitbake core-image-qt

This will take a long time but will hopefully finish without any errors. The resulting image is found in ~/rpi/rpi-build/tmp/deploy/images/raspberrypi2/core-image-qt-raspberrypi2.rpi-sdimg.

Write the image to an SD-micro

The result of the build is an image that can be written directly to an SD-micro using e.g. dd. Make sure you use the correct target device instead of /dev/sdX, otherwise you might erase you local harddrive!

dd if=~/rpi/rpi-build/tmp/deploy/images/raspberrypi2/core-image-qt-raspberrypi3.rpi-sdimg of=/dev/sdX bs=4M

Boot and launch the example application

Insert the SD-micro into the Raspberry Pi 2 and boot it up, after some time you should see a login prompt where you can log in using the user root with no password.

Use systemctl to launch the touchpoints Qml example.

systemctl start touchpoints

In order to make the Qml example start automatically on boot use the following

systemctl enable touchpoints

Final words

By now you should have a working Yocto build to start experimenting with Yocto and the Raspberry Pi 2/3 with the official 7″ multi-touch screen. I intend to do some follow-up posts building on this one, where I extend the minimal image and describe how you can generate an SDK that you can use with QtCreator to build for, and automatically deploy to, the Raspberry Pi 2/3 over a network connection.

Posted in Programming | 24 Comments

Status of Raspberry Pi 2 with official touchscreen with Yocto

When I started looking into building an image for the Raspberry Pi 2 that supports the new touchscreen I noticed that I couldn’t just use the current release of Yocto named fido. In the fido branch of meta-raspberrypi both the firmware and the kernel is too old to support the new screen, so I had to manually bump those versions in order to get it working. In addition to this I also needed a small addition to config.txt on the boot partition of the sdcard, this addition “dtoverlay=rpi-ft5406” makes sure that an additional device-tree snippet is added to the device-tree passed to the kernel at boot.

The status right now is that qmlscene works well with touch input and the eglfs-backend, I’m not using X11 in my image.

Apparently there are some patches being prepared for the newer kernel to get into meta-raspberrypi, but they’re still not in master. If they don’t become available soon I might just put my modifications into a separate layer for now, along with my adaptations to meta-qt5 and an image recipe. Hopefully I’ll get some time to clean things up and write a how-to post in the coming days, until then feel free to ask questions in the comments.

Posted in Programming | Leave a comment

My Raspberry Pi Screen has shipped

Apparently the delivery times for the new Raspberrry Pi 7″ Touch Screen wasn’t as bad as they thought, because yesterday I got an e-mail with a tracking number and it’s currently on it’s way to Sweden. But the estimated delivery date is September 30th, so it’s still a few days away.

While waiting I’ll be preparing a build of a base OS + Qt5 using the Yocto Project. Some of my colleagues has created an awesome tool called QmlLive which will make it really nice to work Qt5/Qml on the Pi. Using QmlLive I can edit the Qml code on my PC, and as soon as I press save it will automatically update and reload on the Pi so I can see and test my changes.

When I have something up-and-running  I’m going to write up a post about how to build this and get started hacking Qml using QmlLive.

Posted in Uncategorized | Leave a comment

Ordered myself a touch screen for my Raspberry Pi

I’ve been thinking about getting a touch screen to hook up to a Raspberry Pi for a while now, and now that there’s an “official” 7″ multi-touch screen I figured it was time to finally order one. It’s not very high resolution, but seems nice enough in other ways so I hope that I can have some fun with it now that the darker months are approaching for us living a up north. The interest for the screen has been quite high so there’s an expected delivery time of six weeks, so I should have plenty of time coming up with some fun projects.

Posted in Programming | Leave a comment

Going public

Some time ago I wanted to be able to log my workouts on my stationary bike, Monark LT2, to my regular Garmin Connect training diary. That way I get all my training collected in one place. Since there is already an excellent open-source software that supports this for a number of different bikes and trainers, I decided that it’s better to build upon that than to reinvent the wheel. This project is called Golden Cheetah and is based on Qt which I’ve used quite a lot at work. Golden Cheetah can actually do a lot more than log workouts, it comes with tons of analysis tools and performance management metrics for those who are really in to the details of bike training and racing.

The Monark LT2 has a USB-port but it doesn’t come with any information on how to use this port. So first I had to contact the manufacturer of the bike, Monark Exercise, in order to get the specification for the protocol used. Luckily they were very helpful and sent me the specifications and later also gave me the permission to release, as open-source, an implementation of the protocol. The USB-port was connected to an FTDI-style serial port and the protocol allow for easy polling of data I wanted which is power, cadence and heart rate. On the more advanced versions of Monark’s bikes you can also control the power, so you can tell the bike you want a power of 300 watts and it will adjust the load so that no matter what cadence you are pedaling at you will have to produce the correct wattage. Since my bike doesn’t support this I cannot test it, but the protocol is simple enough that I’ll probably add it later and see if I can get someone at Monark to try it out for me.

After using this for a while I decided that it’s time to polish things up and try to get the patch accepted upstream, so I’ve finally sent out a first RFC patch to get some opinions on the integration.

Posted in Cycling, Programming | Leave a comment