In this configuration, the Yocto build will be done inside a Docker container. This container is based on an image that contains all the required dependencies.
Install the Docker Engine on your Linux based system as explained in the Docker's documentation:
You can get the image in two different ways:
- Pull it from the Wifx Docker registry
- Build it from the lorix-os repository you cloned
We recommand pulling the image from the Wifx Docker registry.
Pull the image with:
$ docker pull wifx/yocto:ubuntu-20.04
Please refer to the Docker image build page.
You can test the image by running it with:
$ docker run -it --rm wifx/yocto:ubuntu-20.04
You should land into the container. It will just display a shell:
yocto@6337712a76a6:~$
Exit the container for now with:
$ exit
The Yocto build process will be done inside the Docker container and thus, files generated inside and shared through a volume should also be readable from outside. An easy solution is to create a user with the same ID inside the container and outside (inside the Docker host).
The current Docker image creates a user namely yocto
with the user ID (uid) 5000. You then need to create a user in your host system with the same uid (user name doesn't matter). In our case, we create this user with the name yocto
too and assign a new password:
$ sudo useradd -u 5000 yocto
$ sudo passwd yocto
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
The build directory will be written by the Docker container user, and therefore is must have the permission to write to it. We can give access to the yocto
user with:
$ sudo chown yocto:yocto poky/build/
As the build output will be created by the yocto
user, the active user will not have access to it. We'd like to be able to read this output, so let's add the current user to the yocto
group:
$ sudo usermod -a -G yocto $(whoami)
See the Docker run page for details.
This volume must be owned by the yocto user in order to be writable from inside the container.
$ sudo mkdir -p ~/lorix-os-cache
$ sudo chown yocto:yocto ~/lorix-os-cache
The above steps should be done only once by host machine. Once setup, you can run the container by reading this guide.