LoginSignup
8
9

More than 3 years have passed since last update.

Yocto を docker コンテナでビルドする

Posted at

この記事は

タイトル通り、 Yocto を docker コンテナ内でビルドします。

Dockerfile

Ubuntu 16.04 をベースとして、

に書かれているパッケージを追加します。
また、locale の設定も必要でした。


FROM ubuntu:16.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get dist-upgrade -y && apt-get autoremove --purge -y \
 && apt-get install -y \
     gawk wget git-core diffstat unzip texinfo gcc-multilib \
     build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
     xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
     xterm \ 
     locales \
 && rm -rf /var/lib/apt/lists/*

# Locales
RUN dpkg-reconfigure locales \
 && locale-gen en_US.UTF-8 \
 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LC_ALL   en_US.UTF-8
ENV LANG     en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

コンテナをビルド


$ docker build -t yocto:latest .

Yocto をビルド

Yocto Project Quick Build の手順でビルドします。

いろいろやり方はあるのでしょうが、ここでは

  • ホストのユーザ ID とディスクを使う
  • コンテナは1回のビルドで使い捨てる

方針にしてみます。

ソースコード取得

ホスト上で git で取得します。


$ git clone git://git.yoctoproject.org/poky
$ cd poky
$ git fetch --tags
$ git checkout tags/yocto-2.7 -b my-yocto-2.7

(上記 Yocto Project Quick Build のとおり)

ビルド

$ docker run --rm \
    -u $(id -u):$(id -g) \
    -v $(pwd):$(pwd) \
    -w $(pwd) \
    yocto:latest \
  /bin/bash -c 'source oe-init-build-env &&  bitbake core-image-sato'

環境によりますが、私の環境では 3時間ほどでビルドできました。

8
9
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
8
9