Using Dockerized Build Environment
Clone TanoWrt repository to your home directory (this document uses ~/tanowrt
for example):
user@host:/ $ cd ~
user@host:~ $ git clone --recursive https://gitlab.com/tano-systems/meta-tanowrt.git 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 --network="host" -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 ~/oe-downloads
directory for storing downloads
on the host, your docker run command should be like this:
user@host:~/tanowrt $ docker run --rm -it --network="host" \
-v ~/tanowrt:/tanowrt \
-v ~/oe-downloads:/tanowrt/build/downloads \
ubuntu:tanowrt-build /bin/bash
Important
The downloads directory (~/oe-downloads
) must be exists
and accessible for user running docker container.
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
Complete Example
Finally, here is the complete command to run the docker container for the TanoWrt build:
user@host:~/tanowrt $ docker run --rm -it --network="host" \
-v ~/tanowrt:/tanowrt \
-v ~/oe-downloads:/tanowrt/build/downloads \
-v ~/oe-sstate-cache:/tanowrt/build/sstate-cache \
ubuntu:tanowrt-build /bin/bash
Using this command the local sstate-cache directory and the local directory for storing downloaded data will be mounted to the docker container.
Important
The shared state cache (~/oe-sstate-cache
) and downloads (~/oe-downloads
)
directories must be exists and accessible for user running docker container.