はじめに
Yocto Project Pokyリポジトリのmasterブランチの更新停止でPokyリポジトリのmasterブランチの更新が停止された後のPokyのセットアップ手順のうち下記について試す。
a) switch to individual clones of bitbake, openembedded-core, meta-yocto and yocto-docs https://docs.yoctoproject.org/dev/dev-manual/poky-manual-setup.html
環境作成
作業ディレクトリ
~/yocto/poky-manualを作業ディレクトリとする。
$ mkdir -p ~/yocto/poky-manual $ cd ~/yocto/poky-manual
リポジトリの取得
https://docs.yoctoproject.org/dev/dev-manual/poky-manual-setup.html の手順と全く同じ事をしてみる。
$ mkdir layers/ $ git clone -b yocto-5.2 https://git.openembedded.org/bitbake ./layers/bitbake $ git clone -b yocto-5.2 https://git.openembedded.org/openembedded-core ./layers/openembedded-core $ git clone -b yocto-5.2 https://git.yoctoproject.org/meta-yocto ./layers/meta-yocto
ディレクトリ構造
取得直後は以下のようになっている。layersディレクトリが(若干異なるが)以前のpokyディレクトリ相当になる。
meta-yoctoにはmeta-pokyとmeta-yocto-bspが含まれている。
poky-manual
└── layers
├── bitbake
├── meta-yocto
└── openembedded-core
コミットログ
それぞれyocto-5.2のタグバージョンが取得されている。
もともとバージョン番号がPokyと連動していないbitbakeのリポジトリもPokyのバージョンでタグが打ってあるので、
使いたいバージョンのPoky環境が思ったよりも簡単に構築できる。
bitbake
commit 5b4e20377eea8d428edf1aeb2187c18f82ca6757 (HEAD, tag: yocto-5.2.1, tag: yocto-5.2, tag: 2025-04.1-walnascar, tag: 2025-04-walnascar, tag: 2.12.0)
Author: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Sat Mar 29 15:28:39 2025 +0000
bitbake: Update version to 2.12.0 for release
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
openembedded-core
commit 6ec2c52b938302b894f119f701ffcf0a847eee85 (HEAD, tag: yocto-5.2, tag: 2025-04-walnascar, tag: 2025-04)
Author: Ross Burton <ross.burton@arm.com>
Date: Tue Apr 22 20:00:52 2025 +0100
systemd: always depend on the explicit serial console units
The systemd-serialgetty recipe generates explicit units for consoles
that are defined in SERIAL_CONSOLES, and if that variable is not defined
then just produces an empty package.
Even when systemd has been configured to use the getty generator, if
there are explicit consoles defined then we should respect them. Don't
conditionalise the dependency on systemd-serialgetty so that we always
pull in the explicit consoles.
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta-yocto
commit 09bef6a491c087f0f0371874e759aae08a720c4e (HEAD, tag: yocto-5.2, tag: yocto-5.0.9, tag: walnascar-5.2, tag: scarthgap-5.0.9)
Author: Mikko Rapeli <mikko.rapeli@linaro.org>
Date: Tue Apr 22 09:59:07 2025 +0300
genericarm64.conf: increase INITRAMFS_MAXSIZE
Since pmem kernel drivers were enabled as modules, the initrd
size limit is hit. On genericarm64 all kernel modules and some
firmware files get installed to initrd by default which make
the thing large. I'm working on patches to reduce the kernel drivers
installed to initrd and to make the kernel in general more modular
(btrfs 5 Mb etc built into kernel by default). For now just increase
the size limit to unblock genericarm64 builds and testing.
Fixes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15833
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
環境変数の設定
おなじみのoe-init-build-envだが、meta-pokyのTEMPLATECONFを明示的に指定している。
$ TEMPLATECONF=$PWD/layers/meta-yocto/meta-poky/conf/templates/default source ./layers/openembedded-core/oe-init-build-env
ここでTEMPLATECONFを指定しない場合、openembedded-coreのTEMPLATECONFが使用されるので注意が必要。 opemembedded-coreのものを使用した場合以下のようになる。
- BBLAYERSにopembedded-core(meta)のみになる
- DISTRO設定がnodistroになる
重要 bblayers.confの修正
オフィシャルの手順をなぞっているのだが、実のところmeta-pokyのTEMPLATECONFを使用すると今回のディレクトリ構成ではエラーになる。
エラーを回避するために以下を実行する必要がある。
$ perl -pe 'BEGIN{$count=0} s/openembedded-core/++$count > 1 ? "meta-yocto" : $&/ge' conf/bblayers.conf > /tmp/tmpfile && cat /tmp/tmpfile > conf/bblayers.conf
もちろん、パスの辻褄が合うようにエディタで直接で編集しても良い。
TEMPLATECONFのbblayers.conf.sampleが以下のようになっているため、meta-pokyとmeta-yocto-bspが
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
##OEROOT##/meta \
##OEROOT##/meta-poky \
##OEROOT##/meta-yocto-bsp \
local.confの修正
MACHINEなど必要に応じて修正する。
$ echo 'MACHINE = "qemuarm64"' >> conf/local.conf
ビルド
ビルドは今までと同じ
$ time bitbake core-image-minimal
今回はtimeコマンドで時間計測
real 51m32.148s user 1m35.292s sys 0m7.959s
オフィシャルのsstate-cacheを試す
Tipという項目で以下の設定が紹介されている。
BB_HASHSERVE_UPSTREAM = "wss://hashserv.yoctoproject.org/ws" SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH" BB_HASHSERVE = "auto" BB_SIGNATURE_HANDLER = "OEEquivHash"
BB_HASHSERVE_UPSTREAMで指定されているwssを処理するためにはpythonのwebsocketsモジュールが必要となる。
$ pip3 install --user websockets
websocketではないので注意 ここが解決できないと下記のようなエラーが発生する。
ERROR: "Unable to use hash equivalence server at 'wss://hashserv.yoctoproject.org/ws' due to missing or incorrect python module:
ModuleNotFoundError("No module named 'websockets'")
Please install the needed module on the build host, or use an environment containing it (e.g a pip venv or OpenEmbedded's buildtools tarball).
You can also remove the BB_HASHSERVE_UPSTREAM setting, but this may result in significantly longer build times as bitbake will be unable to reuse prebuilt sstate artefacts.
ここまで解決した上でbitbakeを実行する。
$ time bitbake core-image-minimal
以下のような結果になる。
real 61m22.357s user 1m16.911s sys 0m7.017s
これは筆者のセミナーなどで質問があるたびに「日本からだとそこまでの時間短縮は期待できない」回答をしているがその解釈とおそらく一致している。 日本にミラーサーバがあり、そちらを参照するなどのワークアラウンドがあれば、きっと効果はある。
これはハッシュサーブに効果がないと言うことではなく、ローカルネットワークなどにsstate-cache及びハッシュサーバを構築すると 劇的にビルド時間が短くなるのは確認済みなので、距離が遠いサーバでは思うほど効果はないということ。
まとめ
Pokyリポジトリのmasterブランチが更新停止になった後のビルドの代替手順のうちの1つを試した。 ただ、ドキュメントどおりにやっても基礎的な知識がないとワークアラウンドできないだろうということがわかった。
まだ移行過程が始まったばかりなので仕方がない。 今後、ドキュメントもテンプレートも整備されることを期待している。