関連記事
Yocto のアップデートは、通常の Linux パッケージ更新とは違います。Poky、各 meta layer、build directory、cache、Docker image の関係を意識します。
基本方針
- Poky と各 layer のブランチを揃える
- いきなり既存 build directory を壊さない
- build-qemu と build-rpi4 を分ける
- 大きな更新時は新しい build directory を作る
- DL_DIR / SSTATE_DIR はできるだけ再利用する
現在のバージョン確認
cd /work/poky
git branch --show-current
git log -1 --oneline
layer も確認します。
cd /work/meta-openembedded
git branch --show-current
git log -1 --oneline
cd /work/meta-raspberrypi
git branch --show-current
git log -1 --oneline
BitBake 側で見る場合です。
cd /work
source poky/oe-init-build-env build-qemu
bitbake-layers show-layers
同一ブランチ内の更新
例として scarthgap 内で最新化します。
cd /work/poky
git checkout scarthgap
git pull --ff-only
cd /work/meta-openembedded
git checkout scarthgap
git pull --ff-only
cd /work/meta-raspberrypi
git checkout scarthgap
git pull --ff-only
その後、再ビルドします。
cd /work
source poky/oe-init-build-env build-qemu
bitbake core-image-minimal
ブランチ変更時
例として別の Yocto release に移る場合は、既存 build directory を再利用しない方が安全です。
build-qemu-scarthgap
build-qemu-newrelease
新しい build directory を作ります。
cd /work
source poky/oe-init-build-env build-qemu-new
cache の扱い
downloads はブランチをまたいでも比較的再利用しやすいです。
DL_DIR ?= "/cache/downloads"
sstate-cache は release や layer 構成が変わると効きにくくなりますが、残しておいて構いません。
SSTATE_DIR ?= "/cache/sstate-cache"
Docker image の更新
Dockerfile を修正したら再ビルドします。
cd /work/../docker
UID=$(id -u) GID=$(id -g) docker compose build --no-cache
ただし、通常の Yocto layer 更新だけなら Docker image の再ビルドは不要です。
クリーンビルドの判断
recipe 単位
bitbake -c clean <recipe>
bitbake <recipe>
sstate も消す
bitbake -c cleansstate <recipe>
bitbake <recipe>
build directory を作り直す
release 変更時、設定が大きく変わった時、不可解なエラーが続く時です。
mv build-qemu build-qemu.bak.$(date +%Y%m%d_%H%M%S)
source poky/oe-init-build-env build-qemu
アップデート後の確認
bitbake-layers show-layers
bitbake core-image-minimal
ls -lh tmp/deploy/images/qemux86-64/
runqemu nographic slirp tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.qemuboot.conf