5. 4.4 ビルド
ビルドする準備が整いましたので、実際にビルドしてみましょう。ビルドするにはbitbake にビルドした
いレシピ名を指定します。今回はcore-image-minimal イメージをビルドしますので、以下のように実行
します。今回のビルド環境では完了までに約30 分ほどかかります。
$ bitbake core-image-minimal
5 Linux イメージを起動する
ビルドが完了したら、Linux OS イメージを起動してみましょう。起動するには以下のコマンドを実行し
ます。
$ runqemu qemuarm nographic
Note: nographic オプションについて
nographic を付けない場合、別のウィンドウが開いてその中でLinux が立ち上があります。今回のハンズオンでは
リモート環境で実施している都合でウィンドウを開くことができないためこのオプションを使用します。
実行するとsudo のパスワードを求められるので、パスワードyoctohandson を入力してください。
Continuing with the following parameters:
KERNEL: [/home/ubuntu/yocto/build_qemuarm/tmp/deploy/images/qemuarm/zImage-qemuarm.bin]
ROOTFS:
[/home/ubuntu/yocto/build_qemuarm/tmp/deploy/images/qemuarm/core-image-minimal-
qemuarm-20140926010952.rootfs.ext3]
FSTYPE: [ext3]
Setting up tap interface under sudo
[sudo] password for ubuntu:
.....
random: dd urandom read with 86 bits of entropy available
random: nonblocking pool is initialized
Poky (Yocto Project Reference Distro) 1.6.1 qemuarm /dev/ttyAMA0
qemuarm login:
起動できましたでしょうか。起動できたらログインしていろいろ触ってみましょう。ログインユーザは
root、パスワードは必要ありません。
終了するには以下のコマンドを実行します。
注意: shutdown 時の注意
5
6. 必ずQEMU 上で実行してください。
# shutdown -h now
QEMU が終わらない場合はCtrl+A x (Ctrl とA を同時に押した後、x を押す)を押すと、QEMU
が終了します。
6 カスタムイメージレシピを作成する
core-image-minimal をベースにカスタムイメージを作ってみましょう。core-image-minimal のレシ
ピはpoky/meta/recipes-core/images/core-image-minimal.bb にあります。このファイルを直接編
集してカスタムイメージを作ってもよいのですが、これでは変更内容をpoky 内で管理することになります。
正しい方法は変更内容を管理するレイヤーを作成し、このレイヤーでレシピの変更内容等を管理することで
す。そのためにはまずレイヤーを作る必要があります。
6.1 カスタム用レイヤーを作成する
カスタム用レイヤーを作成する場合、エディタ等で設定ファイルを一から作成することもできるのですが、
今回はレイヤーの雛形を作成してくれるyocto-layer スクリプトを使ってみます。これはpoky で提供され
ています。
1. ~yocto ディレクトリに移動する
$ cd ~yocto
2. yocto-layer を実行する
yocto-layer にcreate オプションと作成したいレイヤーの名前を指定して実行します。今回は
handson という名前のレイヤーを作成します。途中で質問されますが、全てエンターキーを押してく
ださい。完了するとレイヤー名にmeta-というプレフィックスが付加されたディレクトリが作成され
ます。
$ yocto-layer create handson
Please enter the layer priority you'd like to use for the layer: [default: 6]
Would you like to have an example recipe created? (y/n) [default: n]
Would you like to have an example bbappend file created? (y/n) [default: n]
New layer created in meta-handson.
Don't forget to add it to your BBLAYERS (for details see meta-handson$$README).
3. meta-handson ディレクトリがあるか確認する
$ ls
build_qemuarm meta-handson poky
6