IMG_4924.jpg
firas.jpg
Firas Cheaib

Building Yocto with ADLINK's Ampere Altra Developer Platform

In the past month, 56k.Cloud has had the opportunity to dabble in the Yocto Project. It aims and provides a way to produce entirely reproducible builds for custom Linux-based systems regardless of the hardware configuration.

Why use Yocto?

Embedded development is challenging because engineers must work around all sorts of different hardware configuration. For companies wanting to diversify their hardware solutions for IoT projects, this can be a difficult task. Something as simple as installing Docker depends on the kernel modules available on the device. This is not something that either developers or hardware manufacturers want to deal with. To alleviate these issues, we need efforts to ensure that a certain Linux distribution, or certain pieces of software can function identically across hardware configurations. For instance, ARM has spearheaded such efforts with the Arm SystemReady program. Additionally, the Yocto Project provides a relatively accessible way for developers to create their own images and make use of layers made available by others, including ARM.

The learning curve is quite steep, but the general concepts are easy to grasp:

  • Yocto uses the OpenEmbedded build system
  • OpenEmbedded provides a tool, BitBake which parses the Metadata (recipes, configuration files)
  • Recipes are files (with a .bb extension) which contain instructions on the piece of software to build. This includes where to fetch the source files, which patches to apply.
  • Configuration files (with a .conf extension) contain definitions of variables which set compiler options, machine configuration, etc
  • Layers are repos containing metadata. Publishing layers is the main way of contributing to the Yocto community. OpenEmbedded maintains a list of available layers which is quite extensive.

Build time... is slow

The bitbake tool spends a lot of time ensuring the consistency of the build. As you can expect, this can take a long time, even for the simplest build. Subjecting an old Linux laptop to the exercise, we found build times nearing almost 7 hours. For people in the Cloud-Native world, accustomed to CI/CD pipelines yielding results within 20 minutes, this was painful. Not to mention that the build could ultimately fail, although it is possible to ensure Bitbake fails the build as soon as one instruction does without building the rest of the layers.

In light of this, we decided to bring out the big guns. In our Winterthur office, we had generously received developer platforms from ADLINK (Ampere® Altra®). We therefore transferred over one of them to our Sion headquarters and tried with that.

With 60 and some CPU Cores to spare, we were now seeing build times come down to a couple of hours. Still lengthy, but manageable and in line with something we could have as part of an automated process. Needless to say, this can also be improved with more CPU. Importantly, we were seeing results of the builds within the work day instead of having to run overnight every time.

Next steps

AWS provides its own OpenEmbedded layer with the ability to define the IoT endpoints and other parameters beforehand. This would be a great way to bring devices online for customers without having to configure them at runtime. We look forward to working on further projects making use of these tools. If this is something you are interested in exploring, feel free to schedule a time to chat with us

Firas Cheaib

Firas Cheaib

Software Engineer

"Firas crafts secure and robust IoT solutions for industries, seamlessly integrating manufacturing with cloud efficiency."