Custom build on Ubuntu 20.04.2

Hi,

I used to have a working setup to build a custom Balena image with Ubuntu 18.04.
In this build I had a custom device tree and some patches.
This image was based on ESR v2020.07.2.

A while ago I updated my computer to Ubuntu 20.04, and now I’m hitting some dependency issues when trying to build my work.
When compiling the resin-image, I get an error in hostapp_ext4 where it said my GLIBC version wasn’t compatible.

Looking into the version history of yocto, I noticed Ubuntu 20.04 support was added later, so I tried to rebase my work onto ESR v2021, changing the relevant configurations from Warrior to Dunfell and removing a few patches that had already been fixed upstream.

This time, compiling gave me a different error, saying the correct libgit2 version could not be found.
Looking in /usr/lib, I found version 28 instead of 27.
In both cases, it seems like the versions on my system were different from the expected versions.

So now I have 2 questions:

  1. Is there a way to have yocto pull the correct versions of dependencies for building a layer/image?

  2. Is it possible to make a docker container for building the image, so dependency versions don’t get messed again up when updating my system?

Hi there, I have pinged our OS maintainers to see if they are aware of any containerized environments for this, and will get back to you, thanks.

Hi,

Thank you for your reply.

In the meantime I’ve been trying to develop my own docker container using different base images from debian (buster-slim) and ubuntu (20.04, focal).
It needed a little tricking in order to make the nested docker work, but progress is being made :slight_smile:

To keep the testing surface as small as possible, I’ve tried to build v2021.01.0 (fresh git clone) with no customization yet for the raspberrypi3 and fincm3.
In these specific cases the build halts on errors when trying to build the healthcheck component of supervisor.

Sadly this is all quite time consuming as the build will often only fail after a couple of hours of building.
This doesn’t affect my project (yet), but it does affect the feedback I can give here.

To be a little more precise regarding my last comment.

During the install step of docker-disk, I get an error saying the balena-healthcheck-image.tar does not exist.

I have attached build logs.
barys.log (1.0 KB)
console-latest.log (4.7 KB)
docker_disk_install.log (1.6 KB)

In this specific case, I tried to revert back to balena v2020.07.2 using a docker container based on Ubuntu Xenial (16.04).
Xenial should be the minimal version supported by yocto judging from here.

I have also attached the used Dockerfile (renamed to .log because I can’t upload it otherwise)
Dockerfile.log (1.7 KB)

The actual container was made using the following commands

export DOCKER_GID=$(getent group docker | cut -d: -f3)
docker build --build-arg DOCKER_GID=$DOCKER_GID --tag balena_build_ubuntu_xenial docker
docker run -it -v /data/thijs/werk/nir/balena/git/docker_data:/docker_data -v /data/thijs/werk/nir/balena/git/balena-raspberrypi:/balena-raspbberypi -v /var/run/docker.sock:/var/run/docker.sock balena_build_ubuntu_xenial /bin/bash

Hey there, you can try this Dockerfile for reference when building your own balena-yocto docker image. It has the required dependencies to build balenaOS including the docker client tools.

I’ve used it before and it works well, so you can probably use it for reference when building your own.

We also suggest you build against the latest balenaOS source versions where possible!

Thank you for your reply @klutchell.
Using this guide, I’ve managed to build the basic v2020.07.2 fincm3 image, so now I can continue my journey to build my custom version and then update everything to the latest release :slight_smile:

I’m still kinda confused why my own Docker resulted in missing packages, but I suspect this has something to do with the nested Docker.