Qt5 SomLabs Yocto Toolchain Preparation

Blog show how to generate QT5 toolchain using Yocto for SomLabs module

First, it is necessary to download all necessary Yocto package. When this blog begins, valid Yocto distro was “SUMO”

Before start check following things

  1. Ubuntu 16.04 or 18.04 operating system (can be other but WARNING about host distro appears)
  2. At least 35Gbytes of free disk space (50Gb is recommended)
  3. Install the following packages
    sudo apt-get install build-essential chrpath diffstat gawk libncurses5-dev texinfo git u-boot-tools
    sudo apt-get install python2.7
    sudo ln -sf /usr/bin/python2.7 /usr/bin/python
    sudo ln -sf /usr/bin/python2.7 /usr/bin/python2
  4. Next change default system shell choose  “no
    sudo dpkg-reconfigure dash
  5. Next, create the main directory of the build
    cd ~
    mkdir yocto
    cd yocto
    mkdir somlabs_build
  6. Download all necessary Yocto packages
    git clone -b sumo git://git.yoctoproject.org/poky.git poky
    cd poky
    git clone -b sumo git://git.openembedded.org/meta-openembedded
    git clone -b sumo https://github.com/meta-qt5/meta-qt5.git
    git clone -b sumo https://github.com/Freescale/meta-freescale.git
    git clone -b sumo https://github.com/SoMLabs/meta-somlabs.git
  7. Set environment
    source oe-init-build-env ~/yocto/somlabs_build
  8. Align path in bblayers.conf
    BBLAYERS ?= " \
       ${HOME}/yocto/poky/meta \
       ${HOME}/yocto/poky/meta-poky \
       ${HOME}/yocto/poky/meta-openembedded/meta-oe \
       ${HOME}/yocto/poky/meta-openembedded/meta-networking \
       ${HOME}/yocto/poky/meta-openembedded/meta-python \
       ${HOME}/yocto/poky/meta-freescale \
       ${HOME}/yocto/poky/meta-qt5 \
       ${HOME}/yocto/poky/meta-somlabs \

    Note: When decided to use different folders or structure than proposed, align the path and/or folder structure

  9. Set some parameters in local.conf. Below added some proposition of changes
    MACHINE ??= "visionsom6ull"
    DL_DIR = "${HOME}/yocto/downloads"
    SSTATE_DIR ?= "${HOME}/yocto/sstate-cache"
    TMPDIR = "${HOME}/yocto/tmp"
    PACKAGE_CLASSES ?= "package_ipk"
    SDKMACHINE = "x86_64"
    RM_OLD_IMAGE = "1"
    INHERIT += "rm_work"

    Note: Most significant is to change MACHINE ??… to MACHINE ??= “visionsom6ull”, rest is optional but recommended

  10. Then start to generate qt5-image for SomLabs module
    bitbake qt5-image

    Note: This operation takes some time, depends on HOST possibilities (CPU number and frequency, RAM, disk etc.)

  11. When compilation is finished in /yocto/tmp/deploy/images/visionsom6ull/ qt5-image-visionsom6ull.wic.gz symbolic link should appears
  12. Prepare SD Card with the generated image using the following syntax
    gunzip -c '/home/user_name/yocto/tmp/deploy/images/visionsom6ull/qt5-image-visionsom6ull.wic.gz' | sudo dd of=/dev/sdx bs=1M iflag=fullblock oflag=direct conv=fsync

    Note: Before writing an image to SD Card use “df -h” to check SD Card ID in the system. Replace user_name to Your real name and sdx to proper SD Card identifier in the system. The wrong ID of sdx SD Card identifier damage your SYSTEM FILE!

  13. When writing an image to SD Card over just remove from the card from Your Host and place into SomLab module
  14. Power up the module and check if goes to login place
  15. Login using username “root” without any password
    #EXTRA_IMAGE_FEATURES = "debug-tweaks"
    INHERIT += "extrausers"
    EXTRA_USERS_PARAMS = "usermod -P user_password user_name;"

    Note: When the custom user is needed(in the final image – no debug) in “local.conf” add following lines

  16. When the module is in good shape, it is good time to generate QT5 Host toolchain. To do this issue
    bitbake qt5-toolchain

    Note: It takes some time

  17. When the previous process finish issue
    bitbake meta-toolchain-qt5

    Note: It takes some time

  18.  When toolchain process generation finish it’s a good place to install it in the system. The generated toolchain binary is located in /yocto/tmp/deploy/sdk/ poky-glibc-x86_64-meta-toolchain-qt5-cortexa7hf-neon-toolchain-2.5.1.sh
  19. Very important is to install proper binary file
    cd ~/yocto/tmp/deploy/sdk/

    Note: Accept default proposed install location or change.

    Poky (Yocto Project Reference Distro) SDK installer version 2.5.1
    Enter target directory for SDK (default: /opt/poky/2.5.1): 
    The directory "/opt/poky/2.5.1" already contains a SDK for this architecture.
    If you continue, existing files will be overwritten! Proceed[y/N]? y
    [sudo] password for user_name: 
    Extracting SDK.................................................................................................................................................................................done
    Setting it up...done
    SDK has been successfully set up and is ready to be used.

    Note: When installation complete above the picture should appear

  20. Finally, system show how the environment should be set before open QTCreator
    Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
     $ . /opt/poky/2.5.1/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
  21. Above syntax with environment setting should be invoked from the console (terminal)
    . /opt/poky/2.5.1/environment-setup-cortexa7hf-neon-poky-linux-gnueabi

    Note: Don’t close console (terminal)

  22. At this point check if QT5 environment is installed if not please refer to topic “How to install QT5 on Linux”

Michał Wołowik

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

Leave a Reply

Close Menu