採用情報 お問い合わせ

BLOG

Yocto Project

2026 年 03 月 06 日

Yocto Project 5.3(Whinlatter) での bitbake-setup

はじめに

Yocto Project 5.3 リリース (Whinlatter)でお知らせした通り、 poky リポジトリの master ブランチの更新作業が停止されました。

このことにより以前のバージョンと Yocto Project のセットアップ方法が変わります。

ここでは bitbake-setup の手順を紹介します。

作業をスムーズにするために Yocto Project のマニュアルの手順とは少し異なる手順を実行します。

従来の手順

従来は poky リポジトリを取得するだけで Yocto Project のビルド環境を使い始めることができました。

$ git clone git://git.yoctoproject.org/poky -b scarthgap
$ source poky/oe-init-build-env
$ bitbake core-image-minimal

bitbake-setup について

bitbake-setupレジストリからコンフィグレーションを取得し、作業場所となるワークスペースセットアップを作成するツールです。

コンフィグレーションには環境を構築するために必要なレイヤなどのリポジトリの URL などが記載されており、 bitbake-setup は必要に応じてネットワーク上などから取得します。

レジストリ

レジストリはコンフィグレーションを持っています。

デフォルトのレジストリは bitbake リポジトリの default-registry ディレクトリに存在し、以下のコンフィグレーションが含まれています。

  • oe-nodistro-master.conf.json
  • oe-nodistro-whinlatter.conf.json
  • poky-master.conf.json
  • poky-whinlatter.conf.json

コンフィグレーション (Generic Configuration)

コンフィグレーションは conf.json の拡張子を持つ JSON 形式のテキストファイルで、以下の情報を含んでいます。

  • レイヤの取得先
  • フラグメント

また、コンフィグレーションには再帰的にコンフィグレーションを含むこともできます。

フラグメント

フラグメントは選択可能な情報で主に以下のものとなります。

  • ディストリビューション (DISTRO) 名
  • マシン (MACHINE) 名

実際には他にも様々な種類のフラグメントが存在します。

ワークスペース

作業場所のルートとなる場所で 1 つ以上のセットアップを持っています。 デフォルトのディレクトリ名は bitbake-builds として作成されます。

セットアップ

bitbake を実行するための作業環境で、以下のものを持っています。

  • ビルド (BitBake build)
  • レイヤ (Sources)
  • コンフィグ (Specific Configuration)
ビルド (BitBake build)

実際に bitbake を実行するビルドディレクトリです。ここに成果物が保存されます。 ディレクトリ名は build です。

レイヤ (Sources)

bitbake が参照するレイヤが配置されています。 ディレクトリ名は layers です。

コンフィグ (Specific Configuration)

bitbake-setup でセットアップを作成する際に選択されたフラグメントや、実際に取得されたレイヤのリビジョンなどの情報を含んでいます。 bitbake-setup が参照するものであり、通常、ユーザーが直接参照することはありません。ディレクトリ名は config です。

bitbake-setup の実行

作業ディレクトリ

作業ディレクトリとして「~/yocto」を使用します。

$ mkdir ~/yocto
$ cd ~/yocto

bitbake リポジトリの取得

bitbake-setup とデフォルトのレジストリは bitbake リポジトリに含まれているので、最初に取得します。

$ git clone -b yocto-5.3 https://git.openembedded.org/bitbake

セットアップの作成

"bitbake-setup init" を実行し、セットアップを作成していきます。特にオプションをつけない場合、選択可能な項目についてプロンプトが表示されるので入力していきます。

ワークスペースの場所

最初にワークスペースを作成する場所を設定します。デフォルトのままで良い場合は "y" を選択します。

$ ./bitbake/bin/bitbake-setup init
Bitbake-setup is using /home/user/yocto/bitbake-builds as top directory.

/home/user/yocto/bitbake-builds looks like a new top directory. If you would like to use a different directory, answer "n" below and either:
        1) Change the default bitbake-setup settings:
                bitbake-setup settings set default top-level-prefix
                bitbake-setup settings set default top-level-name
        2) Pass one or more options on the command line to change the top level directory in that invocation only:
                bitbake-setup --setting default top-dir-prefix...
                bitbake-setup --setting default top-dir-name...

A common site.conf file will be created, please check it is correct before running builds
    /home/user/yocto/bitbake-builds/site.conf

Proceed? (y/N): y
コンフィグレーション (Generic Configuration)

デフォルトのレジストリに存在するコンフィグレーションを選択します。ここでは "3" の "poky-whinlatter" を選択します。

Available configurations:
1. oe-nodistro-master   OpenEmbedded - 'nodistro' basic configuration
2. oe-nodistro-whinlatter       OpenEmbedded - 'nodistro' basic configuration, release 5.3 'whinlatter' (supported until 2026-05-31)
3. poky-whinlatter      Poky - The Yocto Project testing distribution configurations and hardware test platforms, release 5.3 'whinlatter' (supported until 2026-05-31)
4. poky-master  Poky - The Yocto Project testing distribution configurations and hardware test platforms

Please select one of the above configurations by its number: 3
コンフィグレーション ( 再帰 )

poky-whinlatter には再帰的に "poky" と "poky-with-sstate" のコンフィグレーションが定義されています。 ここでは "1" の "poky" を選択します。

Available bitbake configurations:
1. poky Poky - The Yocto Project testing distribution
2. poky-with-sstate     Poky - The Yocto Project testing distribution with internet sstate acceleration. Use with caution as it requires a completely robust local network with sufficient bandwidth.

Please select one of the above bitbake configurations by its number: 1
マシン

poky のコンフィグレーションでは 5 つのマシンが選択可能となっています。 ここでは "2" の "machine/qemuriscv64" を選択します。

Target machines:
1. machine/qemux86-64
2. machine/qemuarm64
3. machine/qemuriscv64
4. machine/genericarm64
5. machine/genericx86-64

Please select one of the above options by its number: 3

こちらはフラグメントとなります。

ディストリビューション

同様に 3 つのディストリビューションが選択可能となっています。

Distribution configuration variants:
1. distro/poky
2. distro/poky-altcfg
3. distro/poky-tiny

Please select one of the above options by its number: 1

こちらはフラグメントとなります。

セットアップ名

ここでは作成するセットアップのディレクトリ名を決定します。デフォルトのままで良ければそのままエンターキーを押します。

また、「Run〜」の行はプロンプトを選択する代わりに同様の設定のセットアップを作成するためのコマンドラインを表示しています。次回以降はこのコマンドラインを実行することで、プロンプトによる選択を省略することができます。

Run 'bitbake-setup init --non-interactive poky-whinlatter poky distro/poky machine/qemuriscv64' to select this configuration non-interactively.

Enter setup directory name: [poky-whinlatter]
最終確認

この内容でセットアップを作成してよければ "y" を入力します。

Initializing a setup directory in
    /home/user/yocto/bitbake-builds/poky-whinlatter
Continue? (y/N): y
実行完了

処理が完了すると、以下のように作成されたセットアップの詳細な情報を表示します。

Fetching layer/tool repositories into /home/user/yocto/bitbake-builds/poky-whinlatter/layers
    bitbake
    openembedded-core
    meta-yocto
    yocto-docs

Setting up bitbake configuration in
    /home/user/yocto/bitbake-builds/poky-whinlatter/build

This bitbake configuration provides:
    Poky - The Yocto Project testing distribution

Usage instructions and additional information are in
     /home/user/yocto/bitbake-builds/poky-whinlatter/build/README

To run builds, source the environment using
    . /home/user/yocto/bitbake-builds/poky-whinlatter/build/init-build-env

Run 'bitbake-config-build enable-fragment' to enable additional fragments or replace built-in ones (e.g. machine/or distro/to change MACHINE or DISTRO).

The bitbake configuration files (local.conf, bblayers.conf and more) can be found in
    /home/user/yocto/bitbake-builds/poky-whinlatter/build/conf
用語について

以下の用語については、表現が似ており分かりづらいため、今後見直しが予定されているようです。

  • Generic Configuration
  • Specific Configuration
  • nested Configuration

bitbake 実行

初期化スクリプトの実行

従来の手順では oe-init-build-env を実行しますが、bitbake-setup の環境ではビルドディレクトリに作成される init-build-env を実行し、bitbake を実行するための環境を設定します。

$ source ~/yocto/bitbake-builds/poky-whinlatter/build/init-build-env

スクリプト実行後はビルドディレクトリに自動的に移動されます。

フラグメントの設定変更

従来の手順では MACHINE や DISTRO は build/conf/local.conf に記述することで任意の値を設定していましたが、フラグメントに関連付けられている変数については、local.conf で記述しても変更反映されないので注意が必要となります。

フラグメントの設定を変更するには bitbake-config-build コマンドを使用する必要があります。

$ bitbake-config-build enable-fragment machine/qemuarm64
NOTE: Starting bitbake server...
Fragment machine/qemuarm64 added to /home/mickey/yocto/bitbake-builds/poky-whinlatter/build/conf/toolcfg.conf.

フラグメントの設定は conf/toolcfg.conf OE_FRAGMENTS 変数に保存されます。

# Automated config file controlled by tools
#
# Run 'bitbake-config-build enable-fragment' to enable additional fragments
# or replace built-in ones (e.g. machine/or distro/to change MACHINE or DISTRO).

OE_FRAGMENTS += "distro/poky machine/qemuarm64"

ビルド実行

bitbake を実行しイメージをビルドします。

$ bitbake core-image-minimal

これ以降は従来の手順と同じになります。

まとめ

ここまで bitbake-setup によるセットアップの手順を紹介してきました。 ツールの使用方法としてはあまり難しい点は無いかと思いますが、 フラグメントの値は local.conf に記述しても適用されないので注意が必要です。

この記事の著者
三ツ木 祐介 ( みつきん )

2020 年サイバートラスト入社。組み込み Linux に関わる業務に従事している。Yocto Project 公式実践講座 (LFD461-JP)講師。 個人ブログ「みつきんのメモ」にて Yocto Project 関連の情報を発信。 2015 年から CQ 出版のインターフェース誌に寄稿を開始、2022 年 9 月号より「Yocto Project ではじめる組み込み Linux 開発入門」を連載中。

本記事に関連するリンク
CentOS 7 延長サポートサービス
デジタルトランスフォーメーションのための電子認証基盤 iTrust
iTrust SSL/TLS サーバー証明書