はじめに
YoctoProject 4.3(nanbield)がリリースされていた。 実機で動かしたほうが楽しいのでRaspberryPi4 Model Bで試してみる。
作業ディレクトリ
作業ディレクトリは~/yocto/rpi-nanbieldとする。
$ mkdir -p ~/yocto/rpi-nanbield $ cd ~/yocto/rpi-nanbield
ソースツリーの構築
pokyの取得
いつもは~/yocto/rpi-nanbield/pokyのようにして、pokyディレクトリ配下に外部のレイヤを配置していたが、
新し目のbitbake-layers layerindex-fetchでは自由にディレクトリ構成を決められる様になっているので、
あえて下記のような構成にする。
.
└── sources
├── meta-raspberrypi
└── poky
本来はpokyとmeta-raspberrypiは別のgitリポジトリで管理されているので、 このように並列な階層になっている方が管理しやすい。
imx-yocto-bspを使用している人にはおなじみのディレクトリ構成と言える。
下記のコマンドでpokyをダウンロードする。
$ mkdir -p ~/yocto/rpi-nanbield/sources $ cd ~/yocto/rpi-nanbield/sources $ git clone git://git.yoctoproject.org/poky.git -b nanbield
meta-raspberrypiの取得
下記のコマンドでmeta-raspberrypiを取得する。
$ cd ~/yocto/rpi-nanbield $ source sources/poky/oe-init-build-env $ bitbake-layers layerindex-fetch -f ../sources meta-raspberrypi
ビルド
local.confの修正
conf/local.confに下記を追加する。
だいたいいつもの設定。
MACHINE = "raspberrypi4-64"
DL_DIR = "${TOPDIR}/../downloads"
# enable uart
ENABLE_UART = "1"
# systemd
DISTRO_FEATURES:append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
エラー発生(systemd)
下記のようなエラーが発生した。
ERROR: Nothing PROVIDES 'systemd' (but /home/mickey/yocto/rpi-nanbield/sources/poky/meta/recipes-core/psplash/psplash_git.bb DEPENDS on or otherwise requires it) systemd was skipped: missing required distro feature 'usrmerge' (not in DISTRO_FEATURES) NOTE: Runtime target 'psplash' is unbuildable, removing... Missing or unbuildable dependency chain was: ['psplash', 'systemd'] ERROR: Required build target 'core-image-base' has no buildable providers. Missing or unbuildable dependency chain was: ['core-image-base', 'psplash', 'systemd']
systemdがPROVIDESされていない。
ただしこの行に注目するとヒントがある。
systemd was skipped: missing required distro feature 'usrmerge' (not in DISTRO_FEATURES)
DISTRO_FEATURESにusrmergeが含まれていないからスキップしたとある。
DISTRO_FEATURESにusrmergeを追加してみるとエラーは発生しなくなる。
エラー発生(linux-firmware-rpidistro-bcm43456)
systemdのエラーを回避したあと下記のようなエラーが発生した。
ERROR: Nothing RPROVIDES 'linux-firmware-rpidistro-bcm43456' (but /home/mickey/yocto/rpi-nanbield/sources/poky/meta/recipes-core/packagegroups/packagegroup-base.bb RDEPENDS on or otherwise requires it) linux-firmware-rpidistro RPROVIDES linux-firmware-rpidistro-bcm43456 but was skipped: Has a restricted license 'synaptics-killswitch' which is not listed in your LICENSE_FLAGS_ACCEPTED. NOTE: Runtime target 'linux-firmware-rpidistro-bcm43456' is unbuildable, removing... Missing or unbuildable dependency chain was: ['linux-firmware-rpidistro-bcm43456'] NOTE: Runtime target 'packagegroup-base-extended' is unbuildable, removing... Missing or unbuildable dependency chain was: ['packagegroup-base-extended', 'linux-firmware-rpidistro-bcm43456'] ERROR: Required build target 'core-image-base' has no buildable providers. Missing or unbuildable dependency chain was: ['core-image-base', 'packagegroup-base-extended', 'linux-firmware-rpidistro-bcm43456']
今度はlinux-firmware-rpidistro-bcm43456がPROVIDESされていない。
こちらもヒントがある。
linux-firmware-rpidistro RPROVIDES linux-firmware-rpidistro-bcm43456 but was skipped: Has a restricted license 'synaptics-killswitch' which is not listed in your LICENSE_FLAGS_ACCEPTED.
LICENSE_FLAGS_ACCEPTEDにsynaptics-killswitch含めろと書いてある。
local.conf(修正版)
エラーを回避するためのlocal.confは下記のようになる。
MACHINE = "raspberrypi4-64"
DL_DIR = "${TOPDIR}/../downloads"
# enable uart
ENABLE_UART = "1"
# systemd
DISTRO_FEATURES:append = " systemd usrmerge"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
# Accept for the synaptics license
LICENSE_FLAGS_ACCEPTED = "synaptics-killswitch"
ビルド
core-image-baseをビルドする。
$ bitbake core-image-base
これでイメージが作成できる。
書き込み
bmaptoolで書き込む。
$ sudo bmaptool copy core-image-base-raspberrypi4.wic.bz2 /dev/sdX
/dev/sdXは環境に応じて適宜読み替える。
起動確認
動いた。
Poky (Yocto Project Reference Distro) 4.3.1 raspberrypi4-64 ttyS0 raspberrypi4-64 login: root root@raspberrypi4-64:~# cat /etc/os-release ID=poky NAME="Poky (Yocto Project Reference Distro)" VERSION="4.3.1 (nanbield)" VERSION_ID=4.3.1 VERSION_CODENAME="nanbield" PRETTY_NAME="Poky (Yocto Project Reference Distro) 4.3.1 (nanbield)" CPE_NAME="cpe:/o:openembedded:poky:4.3.1" root@raspberrypi4-64:~# uname -r 6.1.61-v8
meta-raspberrypiのカーネルは6.1系。
まとめ
久々にkirkstoneよりも新しいバージョンのYoctoProjectに触れてみた。 細かいところが変わっていた。