Yocto/Qt5: hello-qt part4 - devtool
Introduction
This work is sponsored by Reliable Embedded Systems. You can find more information about our training/consulting services here.
Objectives
The
goal of this blog post is to show my journey trying to build a hello-qt
application and reasons why I don't like Qt. As far as I can tell this is going to be a multi part blog post. You might want to have a look at part one, part two and part three as well. We'll try to use the devtool in order to create a recipe for what we built with the SDK plus a layer where we'll move the recipe.
devtool: create recipe/run on board
As a Yocto person.
devtool: create a recipe
pokyuser@fc3633f77731:/workdir$ devtool add hello-qt https://gitlab.com/exempli-gratia/hello-qt-sdk.git --src-subdir=src NOTE: Starting bitbake server... INFO: Creating workspace layer in /workdir/build/multi-v7-ml-qt5/workspace NOTE: Starting bitbake server... INFO: Fetching git://gitlab.com/exempli-gratia/hello-qt-sdk.git;protocol=https... NOTE: Started PRServer with DBfile: /workdir/build/multi-v7-ml-qt5/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 34303, PID: 574 Parsing recipes: 100% |#######################################################################################################################################| Time: 0:00:58 Parsing of 2266 .bb files complete (0 cached, 2266 parsed). 3377 targets, 372 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "1.46.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "arm-resy-linux-gnueabi" MACHINE = "multi-v7-ml" DISTRO = "resy" DISTRO_VERSION = "3.1.2" TUNE_FEATURES = "arm armv7a vfp thumb callconvention-hard" TARGET_FPU = "hard" meta meta-poky meta-yocto-bsp = "2020-08-28-dunfell-3.1.2+:d2877e208112ed479ab0b3a961aea87c31591d17" meta-multi-v7-ml-bsp = "dunfell:64005615f681d984df398130caa5b21ca70b2fc8" meta-u-boot-wic-bsp = "dunfell:4dbfc93ee3fe797cee5a25ef7a389eeaec70f418" meta-resy = "dunfell:0c0bd4bb2defd6c5a55b172a20c7ee6694459d31" meta-oe meta-networking meta-filesystems meta-python = "2020-04-30-dunfell-3.1:17fd382f3467e20308924499b7531ae8b789f056" meta-qt5 = "2020-09-08-dunfell:0e7015f7a86dda995a39662edbb5c26da647c496" meta-qt5-examples = "dunfell:44dc00fa08c78c6eb75a1d97018bd7cee999a4f1" workspace = "<unknown>:<unknown>" Initialising tasks: 100% |####################################################################################################################################| Time: 0:00:00 Sstate summary: Wanted 0 Found 0 Missed 0 Current 0 (0% match, 0% complete) NOTE: No setscene tasks NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 2 tasks of which 0 didn't need to be rerun and all succeeded. NOTE: Writing buildhistory NOTE: Writing buildhistory took: 1 seconds INFO: Using default source tree path /workdir/build/multi-v7-ml-qt5/workspace/sources/hello-qt NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... NOTE: Reconnecting to bitbake server... NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... NOTE: Retrying server connection (#1)... NOTE: Starting bitbake server... INFO: Recipe /workdir/build/multi-v7-ml-qt5/workspace/recipes/hello-qt/hello-qt_git.bb has been automatically created; further editing may be required to make it fully functional
That's how the created recipe looks like
# Recipe created by recipetool # This is the basis of a recipe and may need further editing in order to be fully functional. # (Feel free to remove these comments when editing.) # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is # your responsibility to verify that the values are complete and correct. # # The following license files were not able to be identified and are # represented as "Unknown" below, you will need to check them yourself: # LICENSE LICENSE = "Unknown" LIC_FILES_CHKSUM = "file://LICENSE;md5=d7ae45e19108e890d6501374320fc40f" SRC_URI = "git://gitlab.com/exempli-gratia/hello-qt-sdk.git;protocol=https" # Modify these as desired PV = "1.0+git${SRCPV}" SRCREV = "170daf4616723edb96de0c8fd15b6dff5432e173" S = "${WORKDIR}/git/src" DEPENDS = "qtbase" inherit cmake cmake_qt5 # Specify any options you want to pass to cmake using EXTRA_OECMAKE: EXTRA_OECMAKE = ""
It needs a bit of fixing like e.g. the LICENSE, but does not look too bad.
That's the modified version
# Copyright (C) 2020 Robert Berger <robert.berger@ReliableEmbeddedSystems.com> # Released under the MIT license (see COPYING.MIT for the terms) LICENSE = "GPL-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=d7ae45e19108e890d6501374320fc40f" SRC_URI = "git://gitlab.com/exempli-gratia/hello-qt-sdk.git;protocol=https" # Modify these as desired PV = "1.0+git${SRCPV}" SRCREV = "170daf4616723edb96de0c8fd15b6dff5432e173" S = "${WORKDIR}/git/src" DEPENDS = "qtbase" inherit cmake cmake_qt5 # Specify any options you want to pass to cmake using EXTRA_OECMAKE: EXTRA_OECMAKE = ""
devtool: build application
pokyuser@fc3633f77731:/workdir$ devtool build hello-qt NOTE: Starting bitbake server... NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... NOTE: Started PRServer with DBfile: /workdir/build/multi-v7-ml-qt5/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 45625, PID: 889 Loading cache: 100% |#########################################################################################################################################| Time: 0:00:00 Loaded 3375 entries from dependency cache. Parsing recipes: 100% |#######################################################################################################################################| Time: 0:00:00 Parsing of 2266 .bb files complete (2264 cached, 2 parsed). 3377 targets, 372 skipped, 0 masked, 0 errors. NOTE: Started PRServer with DBfile: /workdir/build/multi-v7-ml-qt5/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 42385, PID: 918 Loading cache: 100% |#########################################################################################################################################| Time: 0:00:05 Loaded 3375 entries from dependency cache. Parsing recipes: 100% |#######################################################################################################################################| Time: 0:00:00 Parsing of 2266 .bb files complete (2264 cached, 2 parsed). 3377 targets, 372 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "1.46.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "arm-resy-linux-gnueabi" MACHINE = "multi-v7-ml" DISTRO = "resy" DISTRO_VERSION = "3.1.2" TUNE_FEATURES = "arm armv7a vfp thumb callconvention-hard" TARGET_FPU = "hard" meta meta-poky meta-yocto-bsp = "2020-08-28-dunfell-3.1.2+:d2877e208112ed479ab0b3a961aea87c31591d17" meta-multi-v7-ml-bsp = "dunfell:64005615f681d984df398130caa5b21ca70b2fc8" meta-u-boot-wic-bsp = "dunfell:4dbfc93ee3fe797cee5a25ef7a389eeaec70f418" meta-resy = "dunfell:0c0bd4bb2defd6c5a55b172a20c7ee6694459d31" meta-oe meta-networking meta-filesystems meta-python = "2020-04-30-dunfell-3.1:17fd382f3467e20308924499b7531ae8b789f056" meta-qt5 = "2020-09-08-dunfell:0e7015f7a86dda995a39662edbb5c26da647c496" meta-qt5-examples = "dunfell:44dc00fa08c78c6eb75a1d97018bd7cee999a4f1" workspace = "<unknown>:<unknown>" Initialising tasks: 100% |####################################################################################################################################| Time: 0:00:01 Sstate summary: Wanted 30 Found 30 Missed 0 Current 212 (100% match, 100% complete) NOTE: Executing Tasks NOTE: hello-qt: compiling from external source tree /workdir/build/multi-v7-ml-qt5/workspace/sources/hello-qt/src NOTE: Tasks Summary: Attempted 912 tasks of which 903 didn't need to be rerun and all succeeded. NOTE: Writing buildhistory NOTE: Writing buildhistory took: 1 seconds pokyuser@fc3633f77731:/workdir$
devtool: deploy application to the board
pokyuser@fc3633f77731:/workdir$ ssh-keygen -f "/home/pokyuser/.ssh/known_hosts" -R "192.168.42.11" # Host 192.168.42.11 found: line 22 /home/pokyuser/.ssh/known_hosts updated. Original contents retained as /home/pokyuser/.ssh/known_hosts.old pokyuser@fc3633f77731:/workdir$ devtool deploy-target -s hello-qt root@192.168.42.11 NOTE: Starting bitbake server... NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... NOTE: Started PRServer with DBfile: /workdir/build/multi-v7-ml-qt5/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 40681, PID: 1490 Loading cache: 100% |#########################################################################################################################################| Time: 0:00:00 Loaded 3375 entries from dependency cache. Parsing recipes: 100% |#######################################################################################################################################| Time: 0:00:00 Parsing of 2266 .bb files complete (2264 cached, 2 parsed). 3377 targets, 372 skipped, 0 masked, 0 errors. The authenticity of host '192.168.42.11 (192.168.42.11)' can't be established. RSA key fingerprint is SHA256:qDISpPUmRH1PzZGM0HBFUthfsDLQ9wD9C6lWYF/2NMc. Are you sure you want to continue connecting (yes/no)? Host key verification failed. lost connection ERROR: Failed to copy script to root@192.168.42.11 - rerun with -s to get a complete error message pokyuser@fc3633f77731:/workdir$ devtool deploy-target -s hello-qt root@192.168.42.11 NOTE: Starting bitbake server... NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... NOTE: Started PRServer with DBfile: /workdir/build/multi-v7-ml-qt5/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 46535, PID: 1532 Loading cache: 100% |#########################################################################################################################################| Time: 0:00:00 Loaded 3375 entries from dependency cache. Parsing recipes: 100% |#######################################################################################################################################| Time: 0:00:00 Parsing of 2266 .bb files complete (2264 cached, 2 parsed). 3377 targets, 372 skipped, 0 masked, 0 errors. The authenticity of host '192.168.42.11 (192.168.42.11)' can't be established. RSA key fingerprint is SHA256:qDISpPUmRH1PzZGM0HBFUthfsDLQ9wD9C6lWYF/2NMc. Are you sure you want to continue connecting (yes/no)? Warning: Permanently added '192.168.42.11' (RSA) to the list of known hosts. devtool_deploy.list 100% 24 33.1KB/s 00:00 devtool_deploy.sh 100% 1017 1.3MB/s 00:00 ./ ./usr/ ./usr/bin/ ./usr/bin/hello-qt INFO: Successfully deployed /workdir/build/multi-v7-ml-qt5/tmp/work/armv7at2hf-vfp-resy-linux-gnueabi/hello-qt/1.0+git999-r0/image
Let's run application on the board
root@multi-v7-ml:~# hello-qt Hello, Qt!
This looks promising!
devtool: build an image
Please note, that since hello-qt is in the devtool workspace it's being added automatically to the image, but it can take a few hours to build ;) In an attempt to speed things up a bit I commented out the archiver class in local.conf.
pokyuser@fc3633f77731:/workdir/build/multi-v7-ml-qt5/conf$ devtool build-image core-image-minimal-qt5 --debug DEBUG: Using basepath /workdir/build/multi-v7-ml-qt5 DEBUG: Using standard bitbake path /workdir/sources/poky/bitbake DEBUG: Removed the following variables from the environment: TEMPLATECONF, LS_COLORS, LESSCLOSE, LANG, SUDO_GID, HOSTNAME, OLDPWD, USERNAME, SUDO_COMMAND, SUDO_USER, BUILDDIR, SUDO_UID, SHLVL, LESSOPEN, _ NOTE: Starting bitbake server... DEBUG: Loading plugins from /workdir/build/multi-v7-ml-qt5/workspace/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/meta-poky/lib/devtool... DEBUG: Loading plugins from /workdir/build/multi-v7-ml-qt5/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/meta/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/meta-yocto-bsp/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/../meta-multi-v7-ml-bsp/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/../meta-u-boot-wic-bsp/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/../meta-resy/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/../meta-openembedded/meta-oe/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/../meta-openembedded/meta-networking/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/../meta-openembedded/meta-filesystems/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/../meta-openembedded/meta-python/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/../meta-qt5/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/../meta-qt5-examples/lib/devtool... DEBUG: Loading plugins from /workdir/sources/poky/scripts/lib/devtool... DEBUG: Loading plugin menuconfig DEBUG: Loading plugin search DEBUG: Loading plugin package DEBUG: Loading plugin utilcmds DEBUG: Loading plugin upgrade DEBUG: Loading plugin export DEBUG: Loading plugin sdk DEBUG: Loading plugin standard DEBUG: Loading plugin build_image DEBUG: Loading plugin import DEBUG: Loading plugin runqemu DEBUG: Loading plugin build DEBUG: Loading plugin deploy DEBUG: Loading plugin build_sdk DEBUG: Reading workspace in /workdir/build/multi-v7-ml-qt5/workspace DEBUG: Found recipe {'srctree': '/workdir/build/multi-v7-ml-qt5/workspace/sources/hello-qt/src', 'bbappend': '/workdir/build/multi-v7-ml-qt5/workspace/appends/hello-qt_git.bbappend', 'recipefile': '/workdir/build/multi-v7-ml-qt5/workspace/recipes/hello-qt/hello-qt_git.bb', 'srctreebase': '/workdir/build/multi-v7-ml-qt5/workspace/sources/hello-qt/src'} NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... NOTE: Started PRServer with DBfile: /workdir/build/multi-v7-ml-qt5/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 36739, PID: 220769 Loading cache: 100% |#########################################################################################################################################| Time: 0:00:00 Loaded 3375 entries from dependency cache. Parsing recipes: 100% |#######################################################################################################################################| Time: 0:00:01 Parsing of 2266 .bb files complete (2263 cached, 3 parsed). 3377 targets, 372 skipped, 0 masked, 0 errors. DEBUG: writing to config file /workdir/build/multi-v7-ml-qt5/conf/devtool.conf INFO: Building image core-image-minimal-qt5 with the following additional packages: hello-qt DEBUG: Executing command "bitbake core-image-minimal-qt5" NOTE: Started PRServer with DBfile: /workdir/build/multi-v7-ml-qt5/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 39809, PID: 220800 Loading cache: 100% |#########################################################################################################################################| Time: 0:00:05 Loaded 3375 entries from dependency cache. Parsing recipes: 100% |#######################################################################################################################################| Time: 0:00:00 Parsing of 2266 .bb files complete (2263 cached, 3 parsed). 3377 targets, 372 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "1.46.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "arm-resy-linux-gnueabi" MACHINE = "multi-v7-ml" DISTRO = "resy" DISTRO_VERSION = "3.1.2" TUNE_FEATURES = "arm armv7a vfp thumb callconvention-hard" TARGET_FPU = "hard" meta meta-poky meta-yocto-bsp = "2020-08-28-dunfell-3.1.2+:d2877e208112ed479ab0b3a961aea87c31591d17" meta-multi-v7-ml-bsp = "dunfell:64005615f681d984df398130caa5b21ca70b2fc8" meta-u-boot-wic-bsp = "dunfell:4dbfc93ee3fe797cee5a25ef7a389eeaec70f418" meta-resy = "dunfell:0c0bd4bb2defd6c5a55b172a20c7ee6694459d31" meta-oe meta-networking meta-filesystems meta-python = "2020-04-30-dunfell-3.1:17fd382f3467e20308924499b7531ae8b789f056" meta-qt5 = "2020-09-08-dunfell:0e7015f7a86dda995a39662edbb5c26da647c496" meta-qt5-examples = "dunfell:44dc00fa08c78c6eb75a1d97018bd7cee999a4f1" workspace = "<unknown>:<unknown>" Initialising tasks: 100% |####################################################################################################################################| Time: 0:00:04 Sstate summary: Wanted 42 Found 41 Missed 1 Current 615 (97% match, 99% complete) NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 1846 tasks of which 1846 didn't need to be rerun and all succeeded. NOTE: Writing buildhistory NOTE: Writing buildhistory took: 1 seconds INFO: Successfully built core-image-minimal-qt5. You can find output files in /workdir/build/multi-v7-ml-qt5/tmp/deploy/images/multi-v7-ml
update nfs
student@e450-tr1:/opt/poky$ sudo rm -rf /opt/resy/3.1.2/multi-v7-ml/imx6q-phytec-mira-rdk-nand-qt/core-image-minimal-qt5-multi-v7-ml student@e450-tr1:/opt/poky$ sudo mkdir -p /opt/resy/3.1.2/multi-v7-ml/imx6q-phytec-mira-rdk-nand-qt/core-image-minimal-qt5-multi-v7-ml student@e450-tr1:/opt/poky$ sudo ln -sf /opt/resy/3.1.2/multi-v7-ml/imx6q-phytec-mira-rdk-nand-qt/core-image-minimal-qt5-multi-v7-ml mira-rootfs student@e450-tr1:/opt/poky$ sudo tar xf /workdir/build/multi-v7-ml-qt5/tmp/deploy/images/multi-v7-ml/core-image-minimal-qt5-multi-v7-ml-20201005095949.rootfs.tar.bz2 -C /opt/resy/3.1.2/multi-v7-ml/imx6q-phytec-mira-rdk-nand-qt/core-image-minimal-qt5-multi-v7-ml
run application on target
Resy (Reliable Embedded Systems Reference Distro) 3.1.2 multi-v7-ml /dev/ttymxc1 multi-v7-ml login: root root@multi-v7-ml:~# hello-qt Hello, Qt!
Put recipe into it's own layer
bitbake-layers: Create a layer & add it to bblayers.conf
pokyuser@fc3633f77731:/workdir/build/multi-v7-ml-qt5$ bitbake-layers create-layer /workdir/sources/meta-my-qt5-examples NOTE: Starting bitbake server... Add your new layer with 'bitbake-layers add-layer /workdir/sources/meta-my-qt5-examples' pokyuser@fc3633f77731:/workdir/build/multi-v7-ml-qt5$ bitbake-layers add-layer /workdir/sources/meta-my-qt5-examples NOTE: Starting bitbake server...
devtool: Remove recipe from workspace & add it to new layer
pokyuser@fc3633f77731:/workdir/build/multi-v7-ml-qt5$ devtool finish -f hello-qt /workdir/sources/meta-my-qt5-examples NOTE: Starting bitbake server... WARNING: Source tree is not clean, continuing as requested by -f/--force NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... NOTE: Started PRServer with DBfile: /workdir/build/multi-v7-ml-qt5/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 46453, PID: 221217 Loading cache: 100% |#########################################################################################################################################| Time: 0:00:00 Loaded 3376 entries from dependency cache. Parsing recipes: 100% |#######################################################################################################################################| Time: 0:00:01 Parsing of 2267 .bb files complete (2265 cached, 2 parsed). 3378 targets, 372 skipped, 0 masked, 0 errors. INFO: Updating SRCREV in recipe hello-qt_git.bb INFO: Moving recipe file to /workdir/sources/meta-my-qt5-examples/recipes-hello-qt/hello-qt INFO: Leaving source tree /workdir/build/multi-v7-ml-qt5/workspace/sources/hello-qt/src as-is; if you no longer need it then please delete it manually pokyuser@fc3633f77731:/workdir/build/multi-v7-ml-qt5$ rm -rf /workdir/build/multi-v7-ml-qt5/workspace/sources/hello-qt/src
Clean up the new layer
pokyuser@fc3633f77731:/workdir/build/multi-v7-ml-qt5$ tree /workdir/sources/meta-my-qt5-examples /workdir/sources/meta-my-qt5-examples ├── conf │ └── layer.conf ├── COPYING.MIT ├── README ├── recipes-example │ └── example │ └── example_0.1.bb └── recipes-hello-qt └── hello-qt └── hello-qt_git.bb 5 directories, 5 files pokyuser@fc3633f77731:/workdir/build/multi-v7-ml-qt5$ rm -rf /workdir/sources/meta-my-qt5-examples/recipes-example
Conclusion
This was a very simple devtool workflow, which can be used as well with other build systems and languages.
Comments
Post a Comment