Docker image for Yocto 3.1 (Dunfell) based on Ubuntu 18.04 (bionic) with support to VNC and package repository webserver. It also includes the layers to build Linux for Raspberry Pi 3.
This docker file is build on top of docker-ubuntu-vnc-desktop which provides pre-built docker with VNC support. This Dockerfile uses dorowu/ubuntu-desktop-lxde-vnc:bionic-lxqt
.
$ docker pull amamory/docker-yocto-vnc
Then you can skip the next section.
$ git clone https://github.com/amamory/yocto_docker_vnc
$ cd yocto_docker
$ ./build-image.sh
When running the image, the user has to pass a directory where the yocto cache and the resulting image will be saved in the host computer. This way, it is possible to do an incremental design, running the image multiple time without starting over again.
$ ./start_container.sh <cache-directory> <image-directory>
$ firefox http://localhost:6080/
The directory /opt/mnt
in the container has the Yocto cache. This directory is shared with the host. The directory /home/build/rpi
in the container is also shared with the host so that the user can easily copy the resulting Linux image.
$ cd rpi
$ source ${YOCTO_SRC_PATH}/poky/oe-init-build-env
$ pwd
rpi/build
Tweak the files conf/bblayers.conf
and conf/local.conf
to configure your RPi Linux Image. You might want to reuse the configuration files left in the /home/build/template
directory. These files are already configured with a minimal system and pointing to the correct mounting places.
Execute the following command to see the installed Yocto images.
$ find ${YOCTO_SRC_PATH} -type f -path '*images/*' -name '*.bb'
One usual Yocto images is core-image-base
.
$ bitbake core-image-base
This environment can be easily changed to build Linux image to other Raspbery Pi models. Please check the directory ${YOCTO_SRC_PATH}/meta-raspberrypi/conf/machine
for the supported RPi models.
Running VNC can sometimes be a too slow. In this case, we can attach multiple terminals to the docker container already running. Run the following steps:
$ docker ps
deadbeef amamory/docker-yocto-vnc ...
$ docker exec -u build -it deadbeef bash
In this example deadbeef
is the hexa string referent to the container ID. The first command shoes the ID we use in the second command. Note that you can repeat the last command as much as you like to open multiple terminals attached to the same container.
Before starting to te yocto hacking, remember to change to the docker user, with the command su build
.
This docker image can also serve as a package repository for the embedded devices. The packages (ipk, rpm, or deb) generated by Yocto are located, for instance, in /mnt/yocto/tmp/deploy/rpm
, called the package deploy directory.
First, in the build directory run:
$ bitbake package-index
This command creates the Package
index files in the package deploy directory. Next, open a terminal in the package deploy directory and run:
$ python -m SimpleHTTPServer & 2>/dev/null
This executes the webserver, pointing it to the current directory. The docker HTTP port is mapped to port 8000 in the host computer. Thus, in the host computer, you will be able to run firefox http://localhost:8000/
having access to the packages generated by Yocto in the docker image. The next step is to setup the embedded computer...
Assuming the embedded computer is already deployed and it is in the same network as the docker image, it is possible to also have access to the package repository. Follow these steps to configure the embedded computer:
Create a directory for repos.
$ mkdir -p /etc/yum.repos.d
Add repo with name end with .repo
. For example, we add a oe-packages.repo
under /etc/yum.repo.d/
directory.
[oe-packages]
name=oe-packages
baseurl=http://<server-machine-ip>:8000
enabled=1
gpgcheck=0
Replace <server-machine-ip>
with your server machine ip, like baseurl=http://<docker image IP address>:8000
in my case.
Once you have informed DNF where to find the package databases, you need to fetch them:
$ dnf makecache
oe-packages 3.9 MB/s | 2.3 MB 00:00
After that you can install package you want.
$ dnf install <package-name>
DNF is now able to find, install, and upgrade packages from the specified repository or repositories.
- Include package repository webserver or like this. Feature under test...
Similar initiatives: