Building Qt5 using yocto on Wandboard

From Wandboard Wiki
Jump to: navigation, search

Assuming you have started with Yocto and Wandboard (see Getting_started_with_Yocto_on_Wandboard if not)...

These instructions where tested with Yocto Dizzy

Clone meta-qt5

Grab the latest stable meta-qt5 inside the yocto/sources directory:

$ git clone -b dizzy https://github.com/meta-qt5/meta-qt5.git

Be sure to clone the same branch for meta-qt5 as you are using for the other layers! (here we are using dizzy, so replace "dizzy" with your preferred branch.)

Edit your yocto configuration files

1. Edit yocto/build/conf/bblayers.conf to add the meta-qt5 layer at the end:

 ${BSPDIR}/sources/meta-qt5 \
 ${BSPDIR}/sources/meta-openembedded/meta-ruby \
 ${BSPDIR}/sources/meta-openembedded/meta-multimedia \

2. Edit yocto/build/conf/local.conf and add:

EXTRA_IMAGE_FEATURES = "debug-tweaks ssh-server-openssh "

IMAGE_INSTALL_append = " gcc g++ binutils libgcc libgcc-dev libstdc++ libstdc++-dev libstdc++-staticdev \
autoconf automake ccache chkconfig glib-networking glibmm \
packagegroup-core-buildessential pkgconfig  \
boost cmake zlib glib-2.0 packagegroup-fsl-tools-testapps  \
    ruby \
    cpufrequtils \
    nano \
    gdb \
    gstreamer \
    gst-meta-video \
    gst-fsl-plugin \
    gst-plugins-base-app \
    gst-plugins-base \
    gst-plugins-good \
    gst-plugins-good-rtsp \
    gst-plugins-good-udp \
    gst-plugins-good-rtpmanager \
    gst-plugins-good-rtp \
    gst-plugins-good-video4linux2 \
    openssh-sftp-server \
    packagegroup-fsl-gstreamer \
    packagegroup-fsl-tools-testapps \
    packagegroup-fsl-tools-benchmark \
    imx-vpu \
    imx-test \    	
    qtbase-fonts \
    qtbase-plugins \
    qtbase-tools \
    qtbase-examples \
    qtdeclarative \
    qtdeclarative-plugins \
    qtdeclarative-tools \
    qtdeclarative-examples \
    qtdeclarative-qmlplugins \
    qtmultimedia \
    qtmultimedia-plugins \
    qtmultimedia-examples \
    qtmultimedia-qmlplugins \
    qtsvg \
    qtsvg-plugins \
    qtsensors \
    qtimageformats-plugins \
    qtsystems \
    qtsystems-tools \
    qtsystems-examples \
    qtsystems-qmlplugins \
    qtscript \
    qt3d \
    qt3d-examples \
    qt3d-qmlplugins \
    qt3d-tools \
    qtwebkit \
    qtwebkit-examples-examples \
    qtwebkit-qmlplugins \
    qtgraphicaleffects-qmlplugins \
    qtconnectivity-qmlplugins \
    qtlocation-plugins \
    qtlocation-qmlplugins \
    cinematicexperience \
    cairo pango fontconfig freetype pulseaudio dbus \
    alsa-lib alsa-tools alsa-state alsa-utils-alsaconf fsl-alsa-plugins \
    i2c-tools \ 
    "

We include ssh-server-openssh in EXTRA_IMAGE_FEATURES and the openssh-sftp-server in IMAGE_INSTALL_append for rapid deploying using QtCreator

  • Note: qtquickcontrols-qmlplugins fails in master branch

If you plan on using the 'core-image-minimal' image, then you must add 'dbus' to the IMAGE_INSTALL_append list.

If you plan to use Qt5 eglfs plugin for accelerated graphics using the framebuffer, you need to discard X11 and wayland so the proper graphics drivers get included:

DISTRO_FEATURES_remove = "x11 wayland"
  • The Wandboard Linux Kernel 3.10.17 comes configured with 24 bit depth for HDMI and LCD displays in the device tree. If you experience problems running Qt5 applications with the eglfs platform, change the bit depth to 32 bits in your own kernel fork or use the fbset (fbset [w] [h] [w] [h] 32) BEFORE running any egl application.
Bitbake!

Bitbake an image like core-image-minimal (you need to be in your yocto/build directory):

 $ bitbake fsl-image-multimedia-full

Note: If bitbake fails with an error regarding cmake or drm recipes, locate their directories, delete them and try again.

Test your image

Boot your image and test your Qt5 installation with the CinematicExperience (these parameters if using eglfs and a touchscreen):

$ Qt5_CinematicExperience -platform eglfs

Cross compile Qt5 for QtCreator

It is now very easy to build an environment for cross compilation using QtCreator. Version 1.7 in paths refers to Yocto Dizzy branch, if you are using different branch please use corresponding paths.

bitbake a meta-toolchain-qt5

Bitbake a poky toolchain (you need to be in your yocto/build directory):

 $ bitbake meta-toolchain-qt5
Install your new toolchain

Run the new installer that has been generated in yocto/build/tmp/deploy/sdk

$ sh poky-eglibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-1.7.sh

This will install a cross compiler and its needed environment including the Qt5 arm libraries.

Configure Qt creator

Run qtcreator from the terminal after running the setup environment script located in /opt/poky/1.7

In QtCreator go to Tools > Options > Devices and add your Wandboard as a generic linux device.

go to Tools > Options > Build & Run and:

  1. Add a new compiler. Select your poky compiler: /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-cpp
  2. Add your new cross compiled Qt version by selecting the qmake located in /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/qt5
  3. Add a new kit selecting your new Qt5 version and compiler and setting the sysroot to /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi and leave the Qt mkspec empty. Finally select your wandboard for the device.