How to do it...

Poky offers a core-image-weston image that includes the Weston compositor. To build the core-image-weston image, you need to remove other graphical distribution features by adding the following to your conf/local.conf file:

DISTRO_FEATURES_remove = "x11 directfb" 

Alternatively, the FSL BSP community offers an fslc-wayland distribution as part of meta-freescale-distro with a reference configuration for Wayland images. To use it, change your DISTRO in conf/local.conf to fslc-wayland.

You will need to build from scratch by removing both the tmp and sstate-cache directories when changing the DISTRO_FEATURES variable.

Wayland is supported in the Qt5 toolkit by the Qt Platform Abstraction (QPA) Wayland plugin. We can use the same Qt hello world example from the Using the X Windows system recipe and run it with Weston just by adding the application and the Wayland plugin to the image by adding the next line to the conf/local.conf file:

IMAGE_INSTALL_append = " qtwayland qt-helloworld" 

Then, we build the image with the following:

$ cd /opt/yocto/fsl-community-bsp/
$ source setup-environment wandboard
$ bitbake core-image-weston

Once the build finishes, you will find the WIC image ready to be programmed under tmp/deploy/images/wandboard.

At the time of writing, the meta-freescale layer needed to be patched for this build to succeed. The meta-freescale layer used can be found at:
https://github.com/yoctocookbook2ndedition/meta-freescale.

On boot, we see a single application, the Wayland Terminal, which we can launch and use to start other applications. To do that, we need to connect a USB mouse and keyboard, and click on the Terminal icon to launch it. You can then launch the helloworld application from the Wayland graphical Terminal by running the following:

# qt_hello_world -platform wayland 

Wayland can also run an X11 server for backwards compatibility in a mode known as XWayland. To build XWayland, we can either use Poky's default distribution features or configure our conf/local.conf configuration file with the fslc-xwayland distro as follows:

DISTRO = "fslc-xwayland" 

We will then be able to launch our application just by doing:

# qt_hello_world

As the default QPA is already xcb.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset