-
Notifications
You must be signed in to change notification settings - Fork 75
RPi
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.
To build WPE for the RPi there are two alternatives:
- Use proprietary Broadcom OpenGL drivers (
userland
drivers) andwpebackend-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.
- Use upstream Mesa
VC4
driver with wayland (weston) andwpebackend-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.
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
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
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 \
"
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.
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.
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
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) andwpebackend-rdk/rpi-dispmanx
then you need to export this two environment variables before running the launcher to have mouse and/or touchscreen supportexport 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.
Option 1) With proprietary Broadcom OpenGL drivers (userland
drivers) and wpebackend-rdk/rpi-dispmanx
The RPi GPU is capable of decoding H.264 via hardware. To leverage this with WPE we need the following:
- Select to build an image with the propietary Broadcom OpenGL drivers (
userland
drivers) (option 1 above). - 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.
- 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"
- Ensure the packageconfig
gst_gl
is enabled on WPE (this is the default) - 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.
See also this issue that links some patches for WebKit that may be needed
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.