Building Qt5 for i.MX6 using Yocto Dizzy
Please read the Yocto tutorial before you proceed with building Qt5. The following instruction were tested on our DHCOM i.MX6 computer on module with Yocto stable branch Dizzy
Configure Sources
Clone meta-qt5
Clone the stable branch dizzy of 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!
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
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 and remove cairo because of X11 dependencies:
DISTRO_FEATURES_remove = "x11 wayland"
Bitbake!
Bitbake an image like core-image-minimal (you need to be in your yocto/build directory):
$ bitbake core-image-minimal
Note: If bitbake fails with an error regarding cmake or drm recipes, locate their directories, delete them and try again. We discoverd this several times. There is no solution around for it at the moment.
Test your image
Boot your image and run some Qt5 examples:
$ . /demo/path -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:
- 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
- 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
- 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.
External References
- The content of this tutorial heavily borrowed from 'Building Qt5 using yocto on Wandboard'