How to compile Linux with Qt5 option using Yocto for STM32MP1

Short manual how to prepare Linux Qt5 image in ST Yocto


The tutorial is dedicated to Linux users

NOTE: The Following description based on description from the manufacturer webpage

1. Create main directory for Yocto purposes

mkdir openstlinux-4.19-thud-mp1-19-02-20

2. Go to created folder

cd openstlinux-4.19-thud-mp1-19-02-20 

4. Initialize repo

repo init -u -b refs/tags/openstlinux-4.19-thud-mp1-19-02-20

and synchronize repo

repo sync

In this place some modification in Yocto are necessary.

First open file


and remove from line 141

openocd-stm32mp-native \

next remove from line 149

nativesdk-openocd-stm32mp \

Note: Removed “openocd” due to some problem with the package itself. For this purposes application “openocd” is not necessary.

and finally remove from line 150

nativesdk-sdcard-raw-tools \

Store file after deletion.

Next open file


Add two lines after “export QT_QPA_PLATFORM=eglfs”

export QT_QPA_EGLFS_INTEGRATION="eglfs_kms"

After modification store the file. Modifed file should look like below

!/bin/sh -
export QT_QPA_PLATFORM=eglfs
export QT_QPA_EGLFS_INTEGRATION="eglfs_kms"
if [ -e /usr/share/qt5/cursor.json ];
export QT_QPA_EGLFS_KMS_CONFIG=/usr/share/qt5/cursor.json

5. Choose DISTRO. Valid DISTRO for QT5 purpose is

DISTRO=openstlinux-eglfs MACHINE=stm32mp1 source layers/meta-st/scripts/

NOTE: Accept all necessary agreements

6. When DISTRO is choosen it is good time to start compile QT5 image for STM32MP1

bitbake st-example-image-qt

7. After couple of hours 😉 image should be ready

8. Create image for SD-Card using dedicated script. So go to

cd tmp-glibc/deploy/images/stm32mp1/scripts

folder and execute following command to generate *.raw file for SD-Card

./ ../flashlayout_st-example-image-qt/FlashLayout_sdcard_stm32mp157c-dk2-optee.tsv

9. After image generation script suggest how to write an image to SD-Card.

sudo dd if=../flashlayout_st-example-image-qt/../flashlayout_st-example-image-qt_FlashLayout_sdcard_stm32mp157c-dk2-optee.raw of=/dev/mmcblk0 bs=8M conv=fdatasync status=progress

NOTE: Only thing to do is replace if necessary of=/dev/mmcblk0 to of=/dev/sdx for instance. Be aware wrong specification of “of=/dev/..” can damage Your local system, check twice !. To check where the SD-Card is connected “df -h” command can be useful

10. Insert SD-Card in to SD-Card slot in development board and check if boot pins are configured as follow

STM32MP157x-DKx boot switches microSD card.png

11. Connect USB C wire located near distance of SD-CARD slot. System should start

12. Connect ethernet wire to ethernet connector and check it IP address.

13. Using ssh log in on to board

ssh 192.168.x.y -l root

NOTE: Accept key

14. Remove “psplash-drm service permanently to be able run QT5 application. To do this issue following commands

systemctl stop psplash-drm-start
systemctl disable psplash-drm-start
systemctl daemon-reload
systemctl reset-failed

15. Next compile QT5 toolchain in Yocto. Go back again to main Yocto build folder

cd ~/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1

and execute toolchain generation. This process can take a lot of hours.

bitbake meta-toolchain-qt5

NOTE: During compilation some WARNINGS can appears

16. Next step is install sdk into system. Go to directory

cd tmp-glibc/deploy/sdk/

Note: Accept all agreements and choose default proposed installation place

17. When installation finished created on Your desktop two files

activator stm32_qtcreator and

stm32_qtcreator content

!/usr/bin/env xdg-open
[Desktop Entry]
Name=stm32_qtcreator content

. /opt/st/stm32mp1/2.6-snapshot/environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi

Use activator stm32_qtcreator to open QTCreator application. This process is necessary because “. /opt/st/stm32mp1/2.6-snapshot/environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi” set all necessary export, path etc. demanded by QTCreator to proper make a cross-compilation.

18. Last thing to do is create Kit for STM32 into QTCreator application

Michał Wołowik

Software, hardware embedded engineer. Current duties: Linux(YOCTO) and Android(AOSP) images preparation. Main duties are to develop c/c++ application.

This Post Has 17 Comments

  1. Hello, I am following your manual. bitbake st-example-image-qt leaves me with 2 task failed:
    Summary: 2 tasks failed:
    Do you think I can go on anyway ?
    Thank you

    1. Hi Paolo,
      do You use Ubuntu operating system? Maybe in the meantime, ST changed something in their packages and You get an error. I check it and let You know.

      1. Hello Michal,
        I am following your manual. bitbake st-example-image-qt leaves me with 2 task failed as Paolo. Have you found the problem?


        1. Hello Giulio,
          I removed everything and compile again. According to my description, everything compile as is should, some minor warnings only. Maybe You should refer to Yocto manual which needs to install some package first.
          So install
          sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
          build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
          xz-utils debianutils iputils-ping libsdl1.2-dev xterm
          all this package first. Short manual about Yocto You can find on

          If this not help please apply in comment error You get.

          Best Regards

  2. Yes. I am using Ubuntu 18.04. Thanks for helping

    1. Paolo,
      sorry for the long answer period, I’m currently heavy busy. Unfortunately, I can’t confirm your errors. I install Ubuntu 18.04 LTS 64bit. I didn’t see any errors just only a few warnings. ‘st-example-image-qt’ and ‘meta-toolchain-qt5’ compile well. Please check if You have installed all necessary packages form Yocto quick start

      sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
      build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
      xz-utils debianutils iputils-ping libsdl1.2-dev xterm


      1. Hi Michal,

        I am having similar issue as Paolo.
        bitbake st-example-image-qt with 3 tasks failed
        Summary: 3 tasks failed:

        bitbake meta-toolchain-qt5 with 1 task failed
        Summary: 1 task failed:

        Using Ubuntu 18.04 LTS 64 bit, all necessary packages are installed.
        Any clue what might go wrong?

        Thank you.


        1. Maybe something changes in the official repo. In free time I check it. Qt5 compilation is always difficult.

  3. Hi,
    I get an error /opt/st/stm32mp1/2.6-snapshot/sysroots/x86_64-openstlinux_eglfs_sdk-linux/usr/libexec/arm-openstlinux_eglfs-linux-gnueabi/gcc/arm-openstlinux_eglfs-linux-gnueabi/8.2.0/real-ld:-1: error: cannot find -lGLESv2. Why does Qt give this error? I have checked read-ld file exists in this path.

    1. It’s normal You need to check if in *.pro file You have the correct path to GLESv2 and if GLESv2 is somewhere in rootfs.

  4. Hi Michał,

    thanks for this usefull blog. I have a question if you have time:
    I went through all the steps executed the command “bitbake meta-toolchain-qt5” and installed sdk succesfully. Wenn I run the desktop entry and therefore “” file, I receive an error:

    /opt/Qt5.12.0/Tools/QtCreator/bin/qtcreator: No such file or directory

    I checked the /opt directory and there isn’t “Qt5.12.0” indeed.
    Why do you think this path and its contents was not created ?

    1. It possible,
      You probably have a newer version of QT or installed in other location than mine. Please align those line to Your condition. My current location of qtcreator is /opt/Qt5.12.3/Tools/QtCreator/bin/qtcreator.
      If you have no installed Qtcreator yet just download qt5 kit from location

  5. Hello,

    I prepared and flashed st-example-image-qt. When I booted the board, only linux splash screen is coming.
    Why doesn’t it have the following things which weston image already has:
    – uboot spash screen
    – weston desktop
    – gtk demo launcher

    If I also do ctrl+alt+T, terminal is not coming.

    How can I prepare st-example-image-qt along with all the features of weston image (including linux terminal) ?

    1. be sure to add

      export QT_QPA_EGLFS_INTEGRATION=”eglfs_kms”

      in ../layers/meta-st/meta-st-openstlinux/recipes-qt/qt5/files/

    2. you probably miss to add
      export QT_QPA_EGLFS_INTEGRATION=”eglfs_kms”
      in file ../layers/meta-st/meta-st-openstlinux/recipes-qt/qt5/files/

  6. Hello,

    I have a question about the qt examples already in st-example-image-qt :

    Is it possible to modify, build, cross compile them, load and run them on the board again ?

Leave a Reply

Close Menu