Skip to content
Michael Kaiser edited this page Apr 9, 2019 · 20 revisions

Introduction

This wiki page documents how to build an image with WPE for the Raspberry Pi (model 3 or 2)

Please be sure to first read the WPE introduction page that gives an overview of the launchers and wpebackends available.

Building an image with WPE for the RPi

To build WPE for the RPi there are two alternatives:

  1. Use proprietary Broadcom OpenGL drivers (userland drivers) and wpebackend-rdk/rpi-dispmanx
    • Benefits: currently (as of time of writing this) it has better performance than the VC4 alternative and allows to run WPE full-screen.
  2. Use upstream Mesa VC4 driver with wayland (weston) and wpebackend-fdo.
    • Benefits: you get a fully open source stack and you also get to test the graphic architecture the project is currently pushing for (next-gen graphics: wpebackend-fdo)

NOTE: This wiki page documents both options.

Common steps: setup the Yocto build environment

Get the sources for your yocto build environment

The first thing is to get the poky, meta-openembedded, meta-gstreamer1.0 and meta-rapsberrypi layers. In this example I'm using sumo as version because is the last stable available as of time of writing this.

mkdir ${HOME}/yocto-rpi3-wpe
cd ${HOME}/yocto-rpi3-wpe
git clone https://git.yoctoproject.org/git/poky -b sumo
git clone git://git.openembedded.org/meta-openembedded -b sumo
git clone https://github.com/OSSystems/meta-gstreamer1.0 -b sumo
git clone https://git.yoctoproject.org/git/meta-raspberrypi -b sumo
git clone https://github.com/Igalia/meta-webkit -b sumo

Initialize the yocto build environment

Now we should initialization the build environment and do the initial configuration of the build

cd ${HOME}/yocto-rpi3-wpe
source poky/oe-init-build-env build

Configure the list of layers.

Now edit the file conf/bblayers.conf and add to it (inside the BBLAYERS variable) the paths (full path) to the directories containing meta-openembedded/meta-oe, meta-openembedded/meta-python, meta-raspberrypi and meta-webkit

Example. Initially I had:

$ cat conf/bblayers.conf 
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /home/igalia/clopez/yocto-rpi3-wpe/poky/meta \
  /home/igalia/clopez/yocto-rpi3-wpe/poky/meta-poky \
  /home/igalia/clopez/yocto-rpi3-wpe/meta-yocto-bsp \
  "

After editing I should have:

$ cat conf/bblayers.conf 
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /home/igalia/clopez/yocto-rpi3-wpe/poky/meta \
  /home/igalia/clopez/yocto-rpi3-wpe/poky/meta-poky \
  /home/igalia/clopez/yocto-rpi3-wpe/meta-yocto-bsp \
  /home/igalia/clopez/yocto-rpi3-wpe/meta-openembedded/meta-oe \
  /home/igalia/clopez/yocto-rpi3-wpe/meta-openembedded/meta-python \
  /home/igalia/clopez/yocto-rpi3-wpe/meta-gstreamer1.0 \
  /home/igalia/clopez/yocto-rpi3-wpe/meta-raspberrypi \
  /home/igalia/clopez/yocto-rpi3-wpe/meta-webkit \
  "

Configure the build.

Option 1) Building an image with proprietary Broadcom OpenGL drivers (userland drivers) and wpebackend-rdk/rpi-dispmanx

Edit the file conf/local.conf and add this lines at the bottom:

MACHINE = "raspberrypi3"
GPU_MEM_256 = "128"
GPU_MEM_512 = "196"
GPU_MEM_1024 = "396"
EXTRA_IMAGE_FEATURES = "debug-tweaks"
IMAGE_FEATURES_append = " ssh-server-dropbear hwcodecs"
PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-rdk"
PACKAGECONFIG_pn-wpebackend-rdk = "rpi"
IMAGE_INSTALL_append = " wpewebkit cog"
  • Note: the line for debug-tweaks is optional, but it makes testing easier (e.g.: enables ssh access for root without password)
  • Note: if you have a raspberrypi2 simply set raspberrypi2 instead of raspberrypi3 in the MACHINE line.

Option 2) Building an image with Mesa VC4 driver, weston and wpebackend-fdo

Edit the file conf/local.conf and add this lines at the bottom:

MACHINE = "raspberrypi3"
MACHINE_FEATURES_append = " vc4graphics"
GPU_MEM_256 = "128"
GPU_MEM_512 = "196"
GPU_MEM_1024 = "396"
EXTRA_IMAGE_FEATURES = "debug-tweaks"
IMAGE_FEATURES_append = " ssh-server-dropbear hwcodecs"
PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-fdo"
IMAGE_INSTALL_append = " wpewebkit cog"
  • Note: the line for debug-tweaks is optional, but it makes testing easier (e.g.: enables ssh access for root without password)
  • Note: if you have a raspberrypi2 simply set raspberrypi2 instead of raspberrypi3 in the MACHINE line.
  • Note: if you want to test the dyz launcher as well, add dyz also the the list of packages to be installed on the image (after cog).

Build the image

Finally you are ready to build an image with weston and WPE for the rpi3, to achieve that simply run

  • Option 1) if using wpebackend-rdk/rpi-dispmanx
bitbake core-image-base
  • Option 2) if using wpebackend-fdo
bitbake core-image-weston

After it finish building you should be able to find the image inside the subdirectory tmp-glibc/deploy/images/raspberrypi3. Now simply write that raw with dd to a sdcard. If you preffer a GUI program, you can use etcher to write the image instead of dd

  • Option 1) if using wpebackend-rdk/rpi-dispmanx
dd if=tmp/deploy/images/raspberrypi3/core-image-base-raspberrypi3.rpi-sdimg of=/dev/mmcblk0 bs=4k status=progress
  • Option 2) if using wpebackend-fdo
dd if=tmp/deploy/images/raspberrypi3/core-image-weston-raspberrypi3.rpi-sdimg of=/dev/mmcblk0 bs=4k status=progress

Boot the image.

The image should boot and start a weston session. Be sure to connect the ethernet cable on the RPi to your LAN. As wireless doesn't work by default. Once it starts the weston session you should be able to open a weston terminal and run dyz from there.

cog https://igalia.com
  • Note: if using wpebackend-fdo, pass --platform=fdo while lauching cog.

  • Note: if using the propietary Broadcom OpenGL drivers (userland drivers) and wpebackend-rdk/rpi-dispmanx then you need to export this two environment variables before running the launcher to have mouse and/or touchscreen support

    export WPE_BCMRPI_TOUCH=1
    export WPE_BCMRPI_CURSOR=1
    

TIP: To test easier, you can ssh into the board IP from your PC as root and launch cog from the ssh session. In case you are testing with a weston/wayland based image, for this to work you have to remember to export the WAYLAND_DISPLAY and XDG_RUNTIME_DIR environment variables. First open a weston terminal on the board, write down the values of this variables and then export the same values to this variables from the ssh terminal.

Enabling accelerated video decoding

The RPi GPU is capable of decoding H.264 via hardware. To leverage this with WPE we need the following:

  1. Select to build an image with the propietary Broadcom OpenGL drivers (userland drivers) (option 1 above).
  2. Ensure the version of GStreamer being used is 1.10 or newer. You may need to update your Yocto version if you have an older version. Yocto version rocko ships 1.12, so it is new enough already.
  3. Ensure the gl plugin of gstreamer-plugins-bad is being built. It should build by default if you add this to conf/local.conf
DISTRO_FEATURES_append = " opengl wayland"
  1. Ensure the packageconfig gst_gl is enabled on WPE (this is the default)
  2. Install the gstreamer-omx plugins into the image. You can do this by adding to conf/local.conf
IMAGE_INSTALL_append = " gstreamer1.0-omx"
LICENSE_FLAGS_WHITELIST_append = " commercial"

Note: The instructions above regarding accelerated video decoding have been only tested with the proprietary stack (userland). In theory it should be also possible to enable accelerated hardware decoding in the near future using the open source stack by leveraging the gstreamer v4l2 plugin. The steps for that should be pretty much the same, but installing the v4l2 gstreamer plugin instead of the gstreamer1.0-omx one. Watch https://github.com/anholt/linux/issues/13 for tracking video decode support in the opensource RPi vc4 stack.

Building an image with WebKitGTK+ for the RPi

Currently the only supported way to compile WebKitGTK+ for the RPi is using Mesa VC4 driver. The instructions are similar to building WPE, with the following local.conf to build with X11:

MACHINE = "raspberrypi3"
MACHINE_FEATURES_append = " vc4graphics"
GPU_MEM_256 = "128"
GPU_MEM_512 = "196"
GPU_MEM_1024 = "396"
EXTRA_IMAGE_FEATURES = "debug-tweaks"
IMAGE_FEATURES_append = " ssh-server-dropbear hwcodecs"
DISTRO_FEATURES_append = " opengl x11"
IMAGE_INSTALL_append = " webkitgtk-bin cog"
PACKAGECONFIG_pn-cog = "webkitgtk"

Then, run

bitbake core-image-sato

Note: Use DISTRO_FEATURES_append = " opengl wayland" and run bitbake core-image-weston to build for Wayland instead.

Clone this wiki locally
You can’t perform that action at this time.