1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Yoctoコンテナ内でのビルド方法

1
Posted at

最初は qemux86-64 + core-image-minimal で確認します。Raspberry Pi 4 に進む前に、Docker + Yocto + QEMU の基本経路を切り分けます。

Poky を取得

コンテナ内で実行します。

cd /work
git clone https://git.yoctoproject.org/poky
cd poky
git checkout scarthgap

git clonesudo が必要な場合は異常です。[[04_コンテナ構築のトラブルシューティング]] を参照してください。

build-qemu を初期化

cd /work
source poky/oe-init-build-env build-qemu

初回は以下のようなログが出ます。

You had no conf/local.conf file.
You had no conf/bblayers.conf file.
Shell environment set up for builds.
You can now run 'bitbake <target>'

これはエラーではありません。build-qemu/conf/local.confbuild-qemu/conf/bblayers.conf が自動生成されたという意味です。

local.conf の設定

/work/build-qemu/conf/local.conf を編集します。

nano conf/local.conf

最低限、以下を設定します。

MACHINE ??= "qemux86-64"

DL_DIR ?= "/cache/downloads"
SSTATE_DIR ?= "/cache/sstate-cache"

BB_NUMBER_THREADS ?= "4"
PARALLEL_MAKE ?= "-j4"

BB_SIGNATURE_HANDLER = "OEEquivHash"
BB_HASHSERVE = "auto"

EXTRA_IMAGE_FEATURES += "debug-tweaks ssh-server-openssh"

メモリが 32GB 以上ある場合は、並列数を 8 程度に上げてもよいです。

BB_NUMBER_THREADS ?= "8"
PARALLEL_MAKE ?= "-j8"

ビルド

bitbake core-image-minimal

初回は時間がかかります。llvm-nativeglibclinux-yocto などの compile は重いです。

成功ログ

成功すると、最後に次のようなログが出ます。

NOTE: Tasks Summary: Attempted 3941 tasks of which 0 didn't need to be rerun and all succeeded.

WARNING が数件出ても、最後に all succeeded が出ていればビルド成功です。

成果物確認

ls -lh /work/build-qemu/tmp/deploy/images/qemux86-64/

代表的な成果物です。

bzImage
core-image-minimal-qemux86-64.rootfs.ext4
core-image-minimal-qemux86-64.rootfs.tar.bz2
core-image-minimal-qemux86-64.rootfs.qemuboot.conf
core-image-minimal-qemux86-64.rootfs.manifest
modules-qemux86-64.tgz

2 回目以降の確認

2 回目以降は cache が効きます。

Sstate summary: Wanted ... Local ... Missed ...

Local が増えていれば、SSTATE_DIR が効いています。毎回 Local 0 の場合は設定か volume mount を確認します。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?