Building Wayland and Weston on Tizen Device with Freescale i.MX6 SoC

From Tizen Wiki
Jump to: navigation, search

The following tutorial provides step by step instructions how to build Wayland and Weston on a Tizen profile based on Tizen:Common for device with Freescale i.MX6 ARM SoC.

Requirements

The following hardware and software is required:

  • HummingBoard-i2eX (or another device with Freescale i.MX6 ARM SoC)
  • Tizen 3 profile based on Tizen:Common, for example Tizen IVI

This tutorial has been tested with Tizen IVI rootfs for ARMv7 from 4 February 2015.

Getting Ready

  • Login as root on the Tizen device. The default root password for Tizen images built with GBS is tizen.
  • If you are using Tizen IVI image add Tizen:Common repository which will deliver required packages for development
zypper addrepo http://download.tizen.org/snapshots/tizen/common/latest/repos/arm-wayland/packages/ tizen-common-packages
zypper refresh
  • Install packages which are required to build from scratch Wayland and Weston
zypper in automake gcc make git libtool libffi-devel libexpat-devel libudev-devel mtdev mtdev-devel libjpeg-devel libpng-devel cairo-devel pam-devel libxkbcommon-devel libdrm-devel
  • After the previous operation you may notice the following warning: "There are some running programs that might use files deleted by recent upgrade. You may wish to check and restart some of them. Run 'zypper ps' to list these programs." The easiest solution is to reboot the Tizen device and log in again:
reboot
  • Remove Weston (which is shipped with Tizen IVI) and other packages
rpm -evh --nodeps mesa mesa-libEGL mesa-libGLESv2 mesa-libglapi libgbm libwayland-egl libwayland-client libwayland-cursor libwayland-server weston

Wayland

Getting Wayland

Peform the steps below to download the source code of Wayland depending on its version.

Wayland 1.5

  • Go to directory /opt/
cd /opt
  • Download Wayland 1.5.0
wget http://wayland.freedesktop.org/releases/wayland-1.5.0.tar.xz
  • Extract the downloaded archive
tar xvvf wayland-1.5.0.tar.xz
cd wayland-1.5.0

Wayland 1.6

  • Go to directory /opt/
cd /opt
  • Download Wayland 1.6.0
wget http://wayland.freedesktop.org/releases/wayland-1.6.0.tar.xz
  • Extract the downloaded archive
tar xvvf wayland-1.6.0.tar.xz
cd wayland-1.6.0

Building Wayland

  • Configure the environment
export WLD=/usr
export LD_LIBRARY_PATH=$WLD/lib
export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
export ACLOCAL="aclocal -I $WLD/share/aclocal"
  • Create directory /usr/share/aclocal
mkdir -p $WLD/share/aclocal
  • Configure and build
./configure --prefix=$WLD --disable-documentation
make
make install

Setting up GPU-VIV Graphics Drivers

L3.0.101 BSP

BSP L3.0.101 is appropriate for running Wayland and Weston version 1.1 and 1.5 (1.6 can also work with it but it is recommended to use it with newer BSP):

tar -xzf gpu-viv-wl-bin-mx6q-3.0.101-4.1.1.tar.gz
  • Copy drivers to appropriate locations
cd gpu-viv-wl-bin-mx6q-3.0.101-4.1.1
cp -Rv usr/* /usr/
cp -Rv opt/* /opt/
  • Enable Wayland & Weston support by changing the symbolic links of EGL and GAL
cd /usr/lib/
ln -sf libEGL-wl.so libEGL.so
ln -sf libEGL-wl.so libEGL.so.1
ln -sf libGAL-wl.so libGAL.so
ln -sf libEGL-wl.so libEGL.so.1
  • Verify that EGL and GAL are pointing to the appropriate shared objects as shown below
ls -l /usr/lib/libEGL.so*
lrwxrwxrwx 1 root root 12 мар 24 07:43 /usr/lib/libEGL.so -> libEGL-wl.so
lrwxrwxrwx 1 root root 12 мар 24 07:43 /usr/lib/libEGL.so.1 -> libEGL-wl.so

ls -l /usr/lib/libGAL.so
lrwxrwxrwx 1 root root 12 мар 24 07:43 /usr/lib/libGAL.so -> libGAL-wl.so

L3.10.17 BSP

BSP L3.10.17 SFP (software floating point) is appropriate for running Wayland and Weston version 1.6:

  • Download BSP L3.10.17 SFP
wget http://www.freescale.com/lgfiles/NMG/MAD/YOCTO//gpu-viv-bin-mx6q-3.10.17-1.0.0-sfp.bin
  • Extract BSP L3.10.17 SFP and accept EULA
chmod +x gpu-viv-bin-mx6q-3.10.17-1.0.0-sfp.bin
./gpu-viv-bin-mx6q-3.10.17-1.0.0-sfp.bin
  • Copy files
cd gpu-viv-bin-mx6q-3.10.17-1.0.0-sfp
cp -Rv usr/* /usr/
cp -Rv opt/* /opt/
  • Enable Wayland & Weston support by changing the symbolic links of EGL and GAL
cd /usr/lib/
ln -sf libEGL-wl.so libEGL.so
ln -sf libEGL-wl.so libEGL.so.1
ln -sf libGAL-wl.so libGAL.so
ln -sf libEGL-wl.so libEGL.so.1
ln -sf libEGL-wl.so libEGL.so.1.0
  • Verify that EGL and GAL are pointing to the appropriate shared objects as shown below
ls -l /usr/lib/libEGL.so*
lrwxrwxrwx 1 root root 12 мар 26 13:28 /usr/lib/libEGL.so -> libEGL-wl.so
lrwxrwxrwx 1 root root 12 мар 26 13:28 /usr/lib/libEGL.so.1 -> libEGL-wl.so
lrwxrwxrwx 1 root root 12 мар 26 13:28 /usr/lib/libEGL.so.1.0 -> libEGL-wl.so

ls -l /usr/lib/libGAL.so
lrwxrwxrwx 1 root root 12 мар 26 13:28 /usr/lib/libGAL.so -> libGAL-wl.so

Weston

Weston 1.5

Getting Patches for i.MX6

Perform the steps below to download the patches for Weston 1.5 from GitHub using Git sparse checkout (which reduces the size of the downloaded data):

  • Create a directory to store the patches
cd ~
mkdir weston-patches
cd weston-patches
  • Obtain patches using Git sparse checkout
git init
git remote add freescale https://github.com/Freescale/meta-fsl-arm.git
git config core.sparsecheckout true
echo recipes-graphics/wayland/weston/ >> .git/info/sparse-checkout
git pull freescale master
  • Checkout the commit with patches for Weston 1.5.0
git checkout da650496d88f8d1d7d396c7c8c9c9b4d0f053c65

Getting the Source Code

  • Download Weston version 1.5.0 in directory /opt/
cd /opt
wget http://wayland.freedesktop.org/releases/weston-1.5.0.tar.xz
  • Extract Weston version 1.5.0
tar xvvf weston-1.5.0.tar.xz

Applying Patches

  • Apply specific patches for Freescale i.MX6
cd /opt/weston-1.5.0
patch -p1 < ~/weston-patches/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch
patch -p1 < ~/weston-patches/recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch
patch -p1 < ~/weston-patches/recipes-graphics/wayland/weston/0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch
patch -p1 < ~/weston-patches/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch
patch -p1 < ~/weston-patches/recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch
patch -p1 < ~/weston-patches/recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch
patch -p1 < ~/weston-patches/recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch
  • Manually edit /usr/include/EGL/eglvivante.h and change the following lines:
244c249
< #error "Platform not recognized"
---
> /*#error "Platform not recognized"*/
247c252
< typedef void *  EGLNativeDisplayType;
---
> /*typedef void *  EGLNativeDisplayType;
249c254,259
< typedef void *  EGLNativePixmapType;
---
> typedef void *  EGLNativePixmapType;*/
> 
> /* Wayland types for client apps. */
> typedef struct wl_display *      EGLNativeDisplayType;
> typedef struct wl_egl_window *   EGLNativeWindowType;
> typedef struct wl_egl_pixmap *   EGLNativePixmapType;

Weston 1.6

Getting Patches for i.MX6

Perform the steps below to download the patches for Weston 1.6 using Git sparse checkout (which reduces the size of the downloaded data):

  • Create a directory to store the patches
cd ~
mkdir weston-patches
cd weston-patches
  • Obtain patches using Git sparse checkout
git init
git remote add freescale git://git.freescale.com/imx/meta-fsl-bsp-release
git config core.sparsecheckout true
echo imx/meta-fsl-arm/recipes-graphics/wayland/weston-1.6.0 >> .git/info/sparse-checkout
git pull freescale daisy_3.10.53-1.1.0_GA

Getting Source Code

  • Download Weston version 1.6.0 in directory /opt/
cd /opt
wget http://wayland.freedesktop.org/releases/weston-1.6.0.tar.xz
  • Extract Weston version 1.6.0
tar xvvf weston-1.6.0.tar.xz

Applying Patches

  • Apply specific patches for Freescale i.MX6
cd weston-1.6.0

patch -p1 < ~/weston-patches/imx/meta-fsl-arm/recipes-graphics/wayland/weston-1.6.0/0001-Add-Vivante-EGL-and-GAL2D-compositor-support.patch

patch -p1 < ~/weston-patches/imx/meta-fsl-arm/recipes-graphics/wayland/weston-1.6.0/0002-disable_libinput_backend.patch

patch -p1 < ~/weston-patches/imx/meta-fsl-arm/recipes-graphics/wayland/weston-1.6.0/disable-wayland-scanner-pkg-check.patch

patch -p1 < ~/weston-patches/imx/meta-fsl-arm/recipes-graphics/wayland/weston-1.6.0/make-lcms-configurable.patch

aclocal
automake --add-missing
autoconf
  • Manually edit /usr/include/EGL/eglvivante.h and change the following lines:
244c244
< #error "Platform not recognized"
---
> /*#error "Platform not recognized"*/
247c247
< typedef void *  EGLNativeDisplayType;
---
> /*typedef void *  EGLNativeDisplayType;
249c249,253
< typedef void *  EGLNativePixmapType;
---
> typedef void *  EGLNativePixmapType;*/
> 
> typedef struct wl_display *      EGLNativeDisplayType;
> typedef struct wl_egl_window *   EGLNativeWindowType;
> typedef struct wl_egl_pixmap *   EGLNativePixmapType;

Building Weston

  • Set up the environment
export WLD=/usr
export LD_LIBRARY_PATH=$WLD/lib
export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
export ACLOCAL="aclocal -I $WLD/share/aclocal"
export LD_LIBRARY_PATH="/usr/lib"
export LDFLAGS="-lwayland-server -lwayland-client -lwayland-server -lwayland-cursor -lpixman-1"
export COMPOSITOR_LIBS="-lGLESv2 -lEGL -lGAL -lwayland-server -lxkbcommon -lpixman-1"
export COMPOSITOR_CFLAGS="-I $WLD/include -I $WLD/include/pixman-1 -L$SDK_DIR/drivers -DLINUX=1 -DEGL_API_FB -DEGL_API_WL"
export CLIENT_CFLAGS="-I $WLD/include -I $WLD/include/cairo -I $WLD/include/pixman-1"
export CLIENT_LIBS="-lGLESv2 -lEGL -lwayland-client -lwayland-cursor -lxkbcommon -lcairo"
export SIMPLE_EGL_CLIENT_CFLAGS="-DLINUX=1 -DEGL_API_FB -DEGL_API_WL -I $WLD/include"
export SIMPLE_EGL_CLIENT_LIBS="-lGLESv2 -lEGL -lwayland-client -lwayland-cursor"
export IMAGE_LIBS="-lwayland-cursor"
export WESTON_INFO_LIBS="-lwayland-client"
  • Configure
./configure --prefix=$WLD \
        --disable-setuid-install \
        --disable-x11-compositor --disable-drm-compositor \
        --disable-rpi-compositor --disable-wayland-compositor \
        --disable-libunwind \
        --disable-xwayland-test --disable-xwayland \
WESTON_NATIVE_BACKEND="fbdev-backend.so"
  • Build and install
make
make install

Launching Weston

Launching Weston on Boot

  • For Tizen IVI edit /etc/systemd/system/multi-user.target.wants/tlm.service add the following two lines to section [Service]:
ExecStartPre=/bin/chmod a+r /dev/galcore
ExecStartPre=/bin/chmod a+w /dev/galcore

After the change the file should look like:

[Unit]
Description=Tizen Login Manager
After=systemd-user-sessions.service systemd-logind.service
Requires=dbus.socket

[Service]
ExecStartPre=/bin/chmod a+r /dev/galcore
ExecStartPre=/bin/chmod a+w /dev/galcore
ExecStart=/usr/bin/tlm
#StandardInput=tty
#StandardOutput=journal
#StandardError=journal
#TTYPath=/dev/tty1

[Install]
WantedBy=multi-user.target
  • Adjust privileges:
chmod +s /usr/bin/weston-launch
  • Edit /etc/session.d/genivi-session-singleseat and apply the following change:
9c9
< $WESTON_LAUNCH -- -i0 --log=/tmp/genivi-weston.log
---
> $WESTON_LAUNCH -- -i0 --current-mode --log=/tmp/genivi-weston.log

Launching Weston Manually

If you have reached this phase without any error then you are ready to launch and enjoy Weston.

  • Type in a command line the following commands to start Weston on the first terminal
export LD_LIBRARY_PATH="/usr/lib"
export XDG_RUNTIME_DIR=/tmp
weston --tty=1
  • Optionally you may launch any of the demo applications. Replace X.X.X depending on the version of Weston and run them from /opt/weston-X.X.X/ through another terminal of the device. For example:
export LD_LIBRARY_PATH="/usr/lib"
export XDG_RUNTIME_DIR=/tmp
/opt/weston-X.X.X/weston-simple-shm &
/opt/weston-X.X.X/weston-simple-egl >/dev/null &
/opt/weston-X.X.X/weston-smoke &
/opt/weston-X.X.X/weston-flower & 

Alternatively, you may also start any of the demo applications through weston-terminal.

See Also