How to do it...

SATO is the default visual style for the Poky distribution, based on Gnome Mobile and Embedded (GMAE). It is a desktop environment based on GTK+ that uses the matchbox window manager. It has the peculiarity of showing one single fullscreen window at a time. To build the core-image-sato image with X11 support, you need to remove other graphical distribution features by adding the following to your conf/local.conf file:

DISTRO_FEATURES_remove = "wayland" 

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

To build the GTK hello world application, meta-custom/recipes-graphics/gtk-helloworld/gtk-helloworld-1.0/gtk_hello_world.c, that we introduced earlier, uses the following code:

#include <gtk/gtk.h> 
 
int main(int argc, char *argv[]) 
{ 
    GtkWidget *window; 
    gtk_init (&argc, &argv); 
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 
    gtk_widget_show (window); 
    gtk_main (); 
    return 0; 
} 

We can use the following meta-custom/recipes-graphics/gtk-helloworld/gtk-helloworld_1.0.bb recipe:

DESCRIPTION = "Simple GTK helloworld application"                                
SECTION = "examples"                                                             
LICENSE = "MIT"                                                                  
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 
 
SRC_URI = "file://gtk_hello_world.c"
S = "${WORKDIR}"
DEPENDS = "gtk+3"
inherit pkgconfig
do_compile() { ${CC} ${LDFLAGS} gtk_hello_world.c -o helloworld `pkg-config --cflags --libs gtk+-3.0` }
do_install() { install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} }

We can then add the package to the core-image-sato image by using the following:

IMAGE_INSTALL_append = " gtk-helloworld" 

Next, we can build it with the following:

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

After the build completes, we will find the image under tmp/deploy/images/wandboard. We can then program it and run the application from the serial Terminal with the following:

# export DISPLAY=:0
# /usr/bin/helloworld
..................Content has been hidden....................

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