How to add Wayland to target image?

I have been able to build angstrom-lxde-image and console-trdx-image. Our application requires windows manager support. QT advised me to integrate Wayland in the build. I am new to Yocto project. Can anybody here give me instructions of how to add or modify recipes to build Wayland?

Thank you.
William

Wayland is not currently supported by our Linux images. You may be able to build the Boot2Qt image with wayland support enabled. It is commonly added to an image through DISTRO_FEATURES, but may also require additional adding, removing & modification of recipes/packages. I’m also not sure if this would be fully supported in conjunction with the closed source vivante graphics drivers.

If you simply need a window manager with Qt, I recommend building the angstrom-qt5-x11-image recipe in meta-toradex:

bitbake angstrom-qt5-x11-image

angstrom-qt5-x11-image provides our standard Angstrom-based X11 Linux image along with the non-commercial Qt5 components.

As Brandon already wrote we at Toradex have no image recipe based on weston.

There is a core-image-weston recipe which could be used to try out weston. We at Toradex did only play with it briefly.

Assuming you have a V2.6 openembedded setup as explained here you could:

  • Remove X11 from the DISTRO_FEATURES variable. This is required to get the correct Vivante GPU drivers
  • Add the Qt5 components to the image

To do so add In conf/local.conf::

 DISTRO_FEATURES_remove = " x11 "
 IMAGE_INSTALL_append = " qtbase qtbase-fonts qtbase-plugins qtwayland cinematicexperience"
 IMAGE_INSTALL_append = " ${CORE_IMAGE_BASE_INSTALL}"
  • Remove all build output and sstate from your build directory after any change to DISTRO_FEATURES (rm -rf out-glibc/ sstate-cache/) or build in a separate build directory
  • bitbake the image

e.g.

MACHINE=colibri-imx6 bitbake core-image-weston
  • Use one of our binary images and replace the rootfs/kernel/device-trees with the ones you just built and fixup the symlinks

e.g.:

sudo tar xf Colibri_iMX6_LinuxImageV2.6Beta2_20160630.tar.bz2
cd Colibri_iMX6_LinuxImageV2.6/rootfs
sudo rm *
sudo tar xf <path-to-buildoutput>/Angstrom-core-image-weston-glibc-ipk-v2015.12-colibri-imx6.rootfs.tar.bz2
cd ../colibri-imx6_bin
ls -l
sudo rm uImage--3.14.52*
sudo cp /mnt/sdc2/oe-disk/oe-core_V2.6/build-wayland/out-glibc/deploy/images/colibri-imx6/uImage--3.14.52* . 
ls -l
sudo ln -s uImage--3.14.52-r0-colibri-imx6-*.bin uImage
sudo ln -sf uImage--3.14.52-r0-imx6dl-colibri-cam-eval-v3-*.dtb uImage-imx6dl-colibri-cam-eval-v3.dtb
sudo ln -sf uImage--3.14.52-r0-imx6dl-colibri-eval-v3-*.dtb uImage-imx6dl-colibri-eval-v3.dtb
ls -l
  • I had to edit the weston init script to get a working weston. Probably this should be done differently.

e.g. I added two lines in rootfs/init.d/weston:

--- etc/init.d/weston.orig	2016-08-19 14:38:46.013180814 +0200
+++ etc/init.d/weston	2016-08-19 14:39:56.292396432 +0200
@@ -8,6 +8,9 @@
 # Default-Stop:      0 1 6
 ### END INIT INFO
 
+OPTARGS="$OPTARGS --backend=fbdev-backend.so"
+export WAYLAND_DISPLAY=wayland-0
+
 if test -e /etc/default/weston ; then
         . /etc/default/weston
 fi
  • Flash the image.

  • After boot I had to restart the automatically started weston

  • Start the Qt application

e.g.

root@colibri-imx6:~# /etc/init.d/weston restart
root@colibri-imx6:~# Qt5_CinematicExperience -platform wayland &

Max

Hi Max
Thank you for your step-by-step instructions.
However my bitbake ran into errors:

| /home/natalie/oe-core26/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-ld.gold: error: cannot find -lqtfreetype
| /home/natalie/oe-core26/build/out-glibc/work/armv7at2hf-vfp-neon-mx6qdl-angstrom-linux-gnueabi/qtbase/5.5.1+gitAUTOINC+5afc431323-r0/git/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp:204: error: undefined reference to 'FT_New_Memory_Face'
| /home/natalie/oe-core26/build/out-glibc/work/armv7at2hf-vfp-neon-mx6qdl-angstrom-linux-gnueabi/qtbase/5.5.1+gitAUTOINC+5afc431323-r0/git/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp:236: error: undefined reference to 'FT_Get_Sfnt_Table'
| /home/natalie/oe-core26/build/out-glibc/work/armv7at2hf-vfp-neon-mx6qdl-angstrom-linux-gnueabi/qtbase/5.5.1+gitAUTOINC+5afc431323-r0/git/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp:287: error: undefined reference to 'FT_Done_Face'
...
| /home/natalie/oe-core26/build/out-glibc/work/armv7at2hf-vfp-neon-mx6qdl-angstrom-linux-gnueabi/qtbase/5.5.1+gitAUTOINC+5afc431323-r0/git/src/gui/text/qfontengine_ft.cpp:1213: error: undefined reference to 'FT_Get_Sfnt_Table'
| collect2: error: ld returned 1 exit status
| make[2]: *** [../../lib/libQt5WaylandClient.so.5.5.1] Error 1
| make[2]: Leaving directory `/home/natalie/oe-core26/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/qtwayland/5.5.1+gitAUTOINC+9d40864945-r0/build/src/client'
| make[1]: *** [sub-client-make_first] Error 2
| make[1]: Leaving directory `/home/natalie/oe-core26/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/qtwayland/5.5.1+gitAUTOINC+9d40864945-r0/build/src'
| make: *** [sub-src-make_first] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/natalie/oe-core26/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/qtwayland/5.5.1+gitAUTOINC+9d40864945-r0/temp/log.do_compile.28184)
ERROR: Task 239 (/home/natalie/oe-core26/build/../stuff/meta-qt5/recipes-qt/qt5/qtwayland_git.bb, do_compile) failed with exit code '1'

Any ideas?
William

Hi William

Can you try the answer from this community post?

Max

I was able to go through the end of the procedure after I modified the qtbase_git.bb file as suggested. But the “Qt5_CinematicExperience” application was not able to run. Here is the log:

root@colibri-imx6:~# /etc/init.d/weston restart
Stopping Weston
[   75.223022] mxc_sdc_fb fb.18: 480x272 h_sync,r,l: 41,2,2  v_sync,l,u: 10,2,2 pixclock=9000000 Hz
root@colibri-imx6:~# Qt5_CinematicExperience -platform wayland &
root@colibri-imx6:~# Using Wayland-EGL
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
[   93.903447] PU: Power-on latency exceeded, new value 23085667 ns
[   96.433789] Qt5_CinematicEx invoked oom-killer: gfp_mask=0x200da, order=0, oom_score_adj=0
[   96.442103] CPU: 0 PID: 506 Comm: Qt5_CinematicEx Tainted: G           O 3.14.52-v2.6b2+g7c83cef #1
[   96.451201] Backtrace:
[   96.453710] [<80011dbc>] (dump_backtrace) from [<80011fcc>] (show_stack+0x18/0x1c)
[   96.461286]  r7:00000000 r6:000200da r5:808544c8 r4:00000000
[   96.467046] [<80011fb4>] (show_stack) from [<805f33a0>] (dump_stack+0x7c/0x8c)
[   96.474312] [<805f3324>] (dump_stack) from [<800aae48>] (dump_header.isra.4+0x84/0x1ac)
[   96.482321]  r5:00000000 r4:8f992000
[   96.485974] [<800aadc4>] (dump_header.isra.4) from [<800ab5b8>] (oom_kill_process+0x3bc/0x418)
[   96.494609]  r10:80842154 r9:00000000 r8:00000000 r7:000200da r6:0000f4c2 r5:000200da
[   96.502518]  r4:8e25b600
[   96.505102] [<800ab1fc>] (oom_kill_process) from [<800aba44>] (out_of_memory+0x270/0x338)
[   96.513282]  r10:80842154 r9:00000000 r8:00000000 r7:000200da r6:0000f4c2 r5:00000000
[   96.521208]  r4:8e25d8d0
[   96.523789] [<800ab7d4>] (out_of_memory) from [<800b03d8>] (__alloc_pages_nodemask+0x970/0x988)
[   96.532492]  r10:00000000 r9:00000002 r8:00000003 r7:80877f80 r6:00000000 r5:00000000
[   96.540426]  r4:000200da
[   96.542991] [<800afa68>] (__alloc_pages_nodemask) from [<800cb690>] (handle_mm_fault+0x718/0x8c0)
[   96.551885]  r10:8e316210 r9:000001fd r8:fffff000 r7:04bfd000 r6:8f994000 r5:00000025
[   96.559808]  r4:00000000
[   96.562376] [<800caf78>] (handle_mm_fault) from [<8001a0e0>] (do_page_fault+0x29c/0x3e4)
[   96.570488]  r10:8e316210 r9:8e25b600 r8:04bfd000 r7:00000817 r6:8e30d180 r5:8f993fb0
[   96.578412]  r4:8f992000
[   96.580973] [<80019e44>] (do_page_fault) from [<800083ec>] (do_DataAbort+0x40/0xa0)
[   96.588649]  r10:013c2780 r9:021ed6e0 r8:8f993fb0 r7:04bfd000 r6:80019e44 r5:00000817
[   96.596581]  r4:80843a18
[   96.599139] [<800083ac>] (do_DataAbort) from [<80012bf8>] (__dabt_usr+0x38/0x40)
[   96.606558] Exception stack(0x8f993fb0 to 0x8f993ff8)
[   96.611618] 3fa0:                                     00000152 00000151 00000780 021f12e8
[   96.619820] 3fc0: 021f1d70 04bfd008 021f1d70 000003b5 000003b5 021ed6e0 013c2780 00003bf8
[   96.628022] 3fe0: 021f12e8 7eb22638 0000077f 70b665a6 800c0030 ffffffff
[   96.634655]  r8:000003b5 r7:000003b5 r6:ffffffff r5:800c0030 r4:70b665a6
[   96.641435] Mem-info:
[   96.643730] DMA per-cpu:
[   96.646270] CPU    0: hi:   42, btch:   7 usd:   8
[   96.651079] active_anon:29315 inactive_anon:32 isolated_anon:0
[   96.651079]  active_file:10 inactive_file:10 isolated_file:0
[   96.651079]  unevictable:0 dirty:2 writeback:14 unstable:0
[   96.651079]  free:494 slab_reclaimable:692 slab_unreclaimable:1221
[   96.651079]  mapped:17 shmem:107 pagetables:331 bounce:0
[   96.651079]  free_cma:214
[   96.682144] DMA free:1976kB min:2000kB low:2500kB high:3000kB active_anon:117260kB inactive_anon:128kB active_file:40kB inactive_file:40kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:262144kB managed:250632kB mlocked:0kB dirty:8kB writeback:56kB mapped:68kB shmem:428kB slab_reclaimable:2768kB slab_unreclaimable:4884kB kernel_stack:600kB pagetables:1324kB unstable:0kB bounce:0kB free_cma:856kB writeback_tmp:0kB pages_scanned:2248 all_unreclaimable? yes
[   96.723678] lowmem_reserve[]: 0 0 0 0
[   96.727413] DMA: 494*4kB (UC) 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 1976kB
[   96.740708] 130 total pagecache pages
[   96.744394] 0 pages in swap cache
[   96.747715] Swap cache stats: add 0, delete 0, find 0/0
[   96.752943] Free swap  = 0kB
[   96.755843] Total swap = 0kB
[   96.762803] 65536 pages of RAM
[   96.765912] 634 free pages
[   96.768626] 3915 reserved pages
[   96.771769] 1355 slab pages
[   96.774586] 52 pages shared
[   96.777386] 0 pages swap cached
[   96.780533] [ pid ]   uid  tgid total_vm      rss nr_ptes swapents oom_score_adj name
[   96.788407] [  159]     0   159     1627       51       7        0             0 systemd-journal
[   96.797221] [  190]     0   190     2431       82       5        0         -1000 systemd-udevd
[   96.805859] [  292]   997   292     3133       52       6        0             0 systemd-timesyn
[   96.814671] [  336]   999   336      634       42       6        0          -900 dbus-daemon
[   96.823118] [  359]   995   359      720       38       6        0             0 avahi-daemon
[   96.831669] [  364]     0   364      690       47       4        0             0 systemd-logind
[   96.840393] [  375]   995   375      720       34       6        0             0 avahi-daemon
[   96.848942] [  454]   985   454      840       43       4        0             0 systemd-resolve
[   96.857752] [  455]     0   455     1043       70       8        0             0 login
[   96.865694] [  464]     0   464      496       20       5        0             0 agetty
[   96.873724] [  465]     0   465      496       20       6        0             0 agetty
[   96.881737] [  482]     0   482      714       20       6        0             0 sh
[   96.889420] [  499]     0   499    17675      661      37        0             0 weston
[   96.897454] [  501]     0   501    18110      691      37        0             0 weston-keyboard
[   96.906265] [  502]     0   502    18143      713      37        0             0 weston-desktop-
[   96.915078] [  505]     0   505      653       11       6        0             0 Qt5_CinematicEx
[   96.923889] [  506]     0   506    76908    26388     142        0             0 Qt5_CinematicEx
[   96.932684] Out of memory: Kill process 506 (Qt5_CinematicEx) score 410 or sacrifice child
[   96.940973] Killed process 506 (Qt5_CinematicEx) total-vm:307632kB, anon-rss:105552kB, file-rss:0kB
Killed   

Any idea? William

@wjzhang

[   96.433789] Qt5_CinematicEx invoked oom-killer: gfp_mask=0x200da, order=0, oom_score_adj=0

Linux run out of memory and decided to kill the Qt5_CinematicExperience process.

It looks like like Linux got 256MB RAM.

Are you using a Colibri iMX6S?

If you use a Colibri iMX6DL are you hit by this bug?

Max

I am using Colibri iMX6s with 256MB RAM.
William

@wjzhang

Then I guess you should try one of less memory hungry Qt5 examples.

Max

I ran my application built with Toradex BSP V2.6 and got this error:

root@colibri-imx6:/usr/bin# ./PSA_ENTRY_BOOTH55 &
root@colibri-imx6:/usr/bin# This application failed to start because it could not find or load the Qt platform plugin “xcb”.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, wayland-egl, wayland.

Reinstalling the application may fix this problem.

[1]+ Aborted ./PSA_ENTRY_BOOTH55

root@colibri-imx6:/usr/bin# ./PSA_ENTRY_BOOTH55 --platform wayland
Failed to create display (No such file or directory)

Looks like I am missing libxcb.so.1 library, right? This library is available in the /usr/lib directory in V2.6 angstrom-qt5-x11 image. But with the procedure posted above, it is replaced with libraries generated in core-image-weston, which does not seem to have the libxcb.

If you start your application without specifying a platform Qt will default to X11.
But you specifically did not want X11 in your image so libxcb is not part of the image. (Plus the image does not have all the rest nedded to run the X server)

Did you actually start weston before you started your application?

/etc/init.d/weston restart
./PSA_ENTRY_BOOTH55 --platform wayland

Yes, I did start weston prior to my application:
root 347 1 0 22:49 tty2 00:00:00 weston --backend=fbdev-backend.so

root@colibri-imx6:/usr/bin# ./PSA_ENTRY_BOOTH55 -platform wayland
Failed to create display (No such file or directory)