Using Dockerized Build Environment

Clone TanoWrt repository with submodules to your home directory (this document uses ~/tanowrt for example):

user@host:/ $ cd ~
user@host:~ $ git clone --recursive https://github.com/tano-systems/meta-tanowrt tanowrt
user@host:~ $ cd ~/tanowrt

Build docker image:

user@host:~/tanowrt $ cd .ci
user@host:~/tanowrt/.ci $ docker build -t ubuntu:tanowrt-build \
                                       --build-arg host_uid=$(id -u) \
                                       --build-arg host_gid=$(id -g) \
                                       -f Dockerfile .

Tip

By default, a user build is created in the built docker image. You can change the user name by adding the following parameter to the docker build command:

--build-arg username=<username>

Run created docker image and mount cloned TanoWrt repository to it:

user@host:~/tanowrt $ docker run --rm -it -v ~/tanowrt:/tanowrt ubuntu:tanowrt-build /bin/bash
build@abbc5ae583ff:~$

Now TanoWrt repository at ~/tanowrt on host is mounted to the /tanowrt directory in docker. Now you can use kas utility to building TanoWrt and all other available build commands described in the Building TanoWrt section.

For example, build TanoWrt default images for the qemux86-64-screen machine:

build@abbc5ae583ff:~$ cd /tanowrt
build@abbc5ae583ff:/tanowrt$ kas build kas/targets/qemux86-64-screen.yml

The built images are available both in the /tanowrt/build/tanowrt-glibc/deploy/images/qemux86-64-screen directory in the docker and in ~/tanowrt/build/tanowrt-glibc/deploy/images/qemux86-64-screen in the host system.

Specifying the Downloads Directory

If you have a separate directory for storing downloads by the build process you can use it in the docker by adding following parameter to docker run command:

-v <path-to-downloads-on-host>:/tanowrt/build/downloads

For example, if you have a /opt/my-downloads directory for storing downloads on the host, your docker run command should be like this:

user@host:~/tanowrt $ docker run --rm -it -v ~/tanowrt:/tanowrt \
                                          -v /opt/my-downloads:/tanowrt/build/downloads \
                                           ubuntu:tanowrt-build /bin/bash

Note

The downloads directory can be mounted in another location than /tanowrt/build/downloads, but in this case, you must explicitly specify the path to this directory in the local configuration in the DL_DIR variable.

build@abbc5ae583ff:~$ echo 'DL_DIR = "<path-to-downloads-dir>"' >> /tanowrt/local.conf

Specifying the Shared State Cache Directory

If you have a separate directory for storing shared state cache by the build process you can use it in the docker by adding following parameter to docker run command:

-v <path-to-sstate-cache>:/tanowrt/build/sstate-cache

For example, if you have a /opt/sstate-cache directory for storing shared state cache on the host, your docker run command should be like this:

user@host:~/tanowrt $ docker run --rm -it -v ~/tanowrt:/tanowrt \
                                          -v /opt/sstate-cache:/tanowrt/build/sstate-cache \
                                           ubuntu:tanowrt-build /bin/bash

Note

The shared state cache directory can be mounted in another location than /tanowrt/build/sstate-cache, but in this case, you must explicitly specify the path to this directory in the local configuration in the SSTATE_DIR variable:

build@abbc5ae583ff:~$ echo 'SSTATE_DIR = "<path-to-sstate-cache-dir>"' >> /tanowrt/local.conf