みつきんのメモ

組み込みエンジニアです。Interface誌で「Yocto Projectではじめる 組み込みLinux開発入門」連載中

raspberrypi2 yoctoでweston(wayland)

yoctoの環境で作成したwestonのイメージがRPi2で動作したのでメモ。 wayland-eglライブラリが存在しない為それを移植するところが非常に大変だった。 https://github.com/albertd/buildroot-rpiの実装をかなり参考にした。 この方には非常に感謝している。

ここではその詳細は割愛して、動作させる手順だけまとめておく。

meta-weston-rpiの更新について

7/26時点でwestonのレシピなどが古くなっており、ビルドが通らない状態だったのだが、Leonさんが修正してコミットしてくれた。 READMEなど細かいところまで修正してくれていて、 非常に助かりました。 ありがとう!

ファイルの取得

ベース環境

前と同様にagherzanさんのmeta-raspberrypiを使わせてもらう。

$ cd ~/
$ mkdir rpi2
$ cd rpi2
$ git clone git://git.yoctoproject.org/poky.git
$ cd poky
$ git clone https://github.com/agherzan/meta-raspberrypi.git

meta-weston-rpi

$ cd ~/rpi2/poky
$ git clone https://github.com/mickey-happygolucky/meta-weston-rpi.git

ビルドディレクトリ

今回はビルドディレクトリをbuild_westonとする。

$ cd ~/rpi2
$ source poky/oe-init-build-env build_weston

conf/bblayers.confの編集

BBLAYERS ?= " \
  /home/mickey/rpi2/poky/meta \
  /home/mickey/rpi2/poky/meta-yocto \
  /home/mickey/rpi2/poky/meta-yocto-bsp \
  /home/mickey/rpi2/poky/meta-raspberrypi \
  /home/mickey/rpi2/poky/meta-weston-rpi \
  "

conf/local.confの編集

以下を追加する。

MACHINE ?= "raspberrypi2"
BB_NUMBER_THREADS = "8"
PARALLEL_MAKE = "-j 8"
VIDEO_CAMERA = "1"
GPU_MEM = "128"
LICENSE_FLAGS_WHITELIST += "commercial"
DL_DIR ?= "${TOPDIR}/../downloads"

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"

EGLやOpenGLES関連のライブラリはmesaで提供しているため、 何もしないとコンフリクトしてしまう。 そのためEGL、OpenGLESv2のvirtualパッケージをuserlandに上書きする。

clutter-1.0はRDEPENDSでmesaを引っ張ろうとしてしまうので除外している。 RDEPNDSはvirtualによる上書きが有効にならないようなのでこれを忘れるとかなりハマる。

DL_DIRの行は必要ではないが、download済みのファイルを格納するディレクトリを変更している。

bitbake

以下のコマンドでwestonのイメージを作成する。

$ bitbake core-image-weston

$ 書き込み

SDに書き込む。

$ sudo dd if=./tmp/deploy/images/raspberrypi2/core-image-weston-raspberrypi2.rpi-sdimg of=/dev/sdb bs=40M

実行画面

RPi2を起動するとwestonが立ち上がってくる。

f:id:mickey_happygolucky:20150301155957p:plain

感動した。