Leon Anavi
IT Tips && Tricks

Mobile & Embedded

Created: 27.07.2015 02:04 Last Modified: 17.04.2016 08:14 Views: 23263
Keywords: ARM, build, Linux, Poky, RaspberryPi2, rpi, Wayland, Weston, Yocto

Building Poky with Wayland and Weston for Raspberry Pi 2 using the Yocto Project

Introduction

Raspberry Pi 2 Model 2 is second version of the most popular single board computer. It has ARMv7 processor from Broadcom and the same GPU as is the first Raspberry Pi version - VideoCore IV.

Yocto is an umbrella project of the Linux Foundation with tools for building and maintaining a GNU/Linux distribution for embedded devices. Poky is its reference implementation that contains meta layers and recipes for building a distribution from scratch. It supports both X11 and Wayland display server protocols.

In this example we will build a Poky image for Raspberry Pi 2 Model B with Wayland and its reference implementation Weston with enabled hardware graphics acceleration. It is recommended to use a powerful personal computer (for example: Intel Core i7 CPU, 8GB RAM, at least 80GB free disk space) with a GNU/Linux distribution, in my case Ubuntu.

Cook an Image for Raspberry Pi 2

Follow the steps below to build an image for Raspberry Pi with Wayland and Weston using the Yocto Project. Jethro, the latest release of the Yocto project by the time of writing (updating) this tutorial, will be used.

Get all Yocto meta layers

  • Get Poky:
    git clone -b jethro git://git.yoctoproject.org/poky.git poky-rpi2
    cd poky-rpi2
      
  • Get Raspberry Pi BSP (board support package):
    git clone -b jethro git://git.yoctoproject.org/meta-raspberrypi
  • Get meta-weston-rpi:
    git clone https://github.com/leon-anavi/meta-weston-rpi.git

Initialize Build Envieronment

Execute the following command to initialize the build environment:

source ./oe-init-build-env

conf/local.conf

Edit conf/local.com and set the following value to the specified variables:

MACHINE ?= "raspberrypi2"
GPU_MEM = "128"
LICENSE_FLAGS_WHITELIST += "commercial"

FETCHCMD_wget = "/usr/bin/env wget -t 2 -T 3000 -nv --passive-ftp --no-check-certificate"

PREFERRED_PROVIDER_virtual/egl = "userland"
PREFERRED_PROVIDER_virtual/libgles2 = "userland"

MULTI_PROVIDER_WHITELIST += " \
             virtual/libgl \
             virtual/egl \
             virtual/libgles2 \
             virtual/mesa \
"

CORE_IMAGE_BASE_INSTALL_remove = " clutter-1.0-examples"

EXTRA_IMAGE_FEATURES_append = " ssh-server-openssh"

IMAGE_INSTALL_append = " connman dhcp-client"

Optionally, you may also adjust the settings for parallel build operations depending on the hardware specifications of your computer, for example:

BB_NUMBER_THREADS = "8"
PARALLEL_MAKE = "-j 8"

conf/bblayers.conf

Edit conf/bblayers.conf and append the new Yocto meta layers to variable BBLAYERS, for example:

  /media/storage/poky-rpi2/meta-raspberrypi \
  /media/storage/poky-rpi2/meta-weston-rpi \

Build and Test

Run the following command to build Poky image with Wayland and Weston for Raspberry Pi 2:

bitbake core-image-weston

Grab a cup of coffee and calmly wait until the end of the build procedure. Depending on the hardware of your computer it may take up to several hours.

Plug a microSD card to your computer, replace X with its corresponding ID (which can be found through commands like lsblk or fdisk -l) and execute the following commands to flash the image on it:

sudo umount /dev/sdX
sudo dd if=tmp/deploy/images/raspberrypi2/core-image-weston-raspberrypi2.rpi-sdimg of=/dev/sdX
sync
sudo umount /dev/sdX

Alternatively, if you prefer you can use bmaptool instead of dd.

Connect a keyboard, a mouse and a monitor to your Raspberry Pi 2. Plug the microSD card and turn on the board. Your GNU/Linux distribution with Wayland and Weston should boot in a few seconds. Enjoy it :)

Build Configuration

If you experience any difficulties using this tutorial please try exactly the same versions of the meta layers as in my build configuration:

Build Configuration:
BB_VERSION        = "1.28.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-15.10"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "raspberrypi2"
DISTRO            = "poky"
DISTRO_VERSION    = "2.0.1"
TUNE_FEATURES     = "arm armv7a vfp thumb neon callconvention-hard vfpv4 cortexa7"
TARGET_FPU        = "vfp-vfpv4-neon"
meta              
meta-yocto        
meta-yocto-bsp    = "jethro:6dba9abd43f7584178de52b623c603a5d4fcec5c"
meta-raspberrypi  = "jethro:f2cff839f52a6e6211337fc45c7c3eabf0fac113"
meta-weston-rpi   = "master:735c0253204c959006c6f28bed0ef2bceeb3ca0f"

See also

raspberrypi2 yocto weston(wayland)

  Home | About | Contact | Disclaimer | Sitemap © 2009-2022 Leon Anavi. All rights reserved.