Skip to main content

Your submission was sent successfully! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates from Canonical and upcoming events where you can meet our team.Close

Thank you for contacting us. A member of our team will be in touch shortly. Close

  1. Blog
  2. Article

Edoardo Barbieri
on 27 May 2022

Embedded Linux development on Ubuntu – Part II


Welcome to Part II of this three-part mini-series on embedded Linux development on Ubuntu. In Part I, we set the stage for the remainder of the series and gave an overview of snaps, the packaging format at the heart of embedded devices running Ubuntu.

Snaps are a secure, confined, dependency-free, cross-platform Linux packaging format. Software publishers often want to manage their application components using containers. Whereas one can achieve this with various runtimes, the Snap ecosystem provides a security-focused approach to containerisation with strict privilege and capability separation between containers. If you missed it, head over to Part I to review the role of snaps in embedded Linux development.  

If you are already familiar with snaps and do not wish to refresh your memory, keep reading. 

Developers can build containerised, isolated snap applications on their machine using Snapcraft, access them from anywhere and farm from the global, public Snap Store. Snapcraft and the Snap Store are the focus of this blog post.

Ubuntu Core is embedded Linux 2.0. Building upon Linux traditions, Ubuntu Core provides a sharp focus on predictability, reliability and security while at the same time enabling developer freedom and control.

Without much further ado, let’s dive straight in.

Snapcraft for embedded Linux development

Snapcraft is the framework and command-line packaging tool used to simplify embedded Linux development. Snapcraft builds and publishes snaps by orchestrating disparate components and build systems into one cohesive distributable package. Snapcraft helps you assemble a whole project in a single tree out of many pieces, including source or existing debs. 

When doing embedded Linux development via Snapcraft, you can bundle components and build systems directly into your application for a fully orchestrated package. Snapcraft is extensible and able to understand other build systems and software. Continuous development and integration of new plugins like Java, Python, Catkin (ROS), Go, CMake, qmake and make, enable developers to leverage the latest technologies for their software. 

Furthermore, Snapcraft improves embedded Linux development by easily integrating into existing CI systems. After receiving a PR on GitHub, you can test it with e.g. Travis or another CI system, and the code lands on your GitHub master. Seamless integration with Travis, Jenkins, GitLab and TeamCity can generate automatic snap builds on every Git commit.  

Snap the format for embedded Linux development

Snapcraft levels the embedded Linux development playing field: any developer can build a snap by putting their software into a YAML file.

The YAML format to define applications is simple and declarative. It is a compressed filesystem with a single metadata file describing the security profile and desired snap integrations. The snap format uses only three stanzas to declare the metadata, confinement, and build definition, ensuring the security of the system a snap is running on and enabling the software to behave as expected.

Such a structure facilitates developers to extend a snap by adding shell commands and plugins for popular build systems and languages in the YAML. Developers can further bundle all dependencies inside the snap for predictable behaviour and make artefacts like databases more accessible and secure. 

Snap Store for embedded Linux development

In Part I, we overviewed the pain points of finding new software for embedded Linux devices. 

The key takeaway was that discovering new software on Linux is difficult, as publishers need to be on the hunt for PPAs and GitHub repositories with daily builds of all kinds of new software.

Snaps ease the process via the Snap Store, a central repository where developers publish their apps and users discover new software. It’s a universal app store for any Linux distribution to upload, browse, install, distribute and deploy applications in the cloud, on desktop or to IoT devices.  The free enterprise-level capabilities of the Store solve the traditional software distribution challenges on Linux.

Managing software and updates across a huge number of devices can be challenging, especially if subsets of hardware require different applications to run on them. Delivering automatic updates and handling software across machines is one of the key features of the IoT App Store. This custom, enterprise store allows you to cherry-pick the optimal combination of applications you want your devices to use, including software published in the global Snap Store and custom software developed internally for a specific use case.

Community-backed snaps for every use case

Besides being a repository of snaps backed by the biggest, growing Linux developer community, the Snap Store has additional features. For one,  developers can push updates to their apps at their cadence and not wait for distribution maintainers to catch up. Also, the store can host multiple versions of the same snap on different risk levels, with users picking the one they prefer.

Snaps use channels to represent software maturity, enabling end-users to subscribe and switch between a track/risk/branch scheme. Embedded Linux devices can track software across their chosen channel and will automatically update to the latest revision of that software. The release channels strengthen embedded Linux development by promoting a standardised way of tracking deployments and enforcing rigorous iterative testing and stable releases. 

With Build from GitHub, a snap is rebuilt whenever a change is merged into the main branch of its respective GitHub repository. When a build successfully completes, it’s automatically released to a snap’s edge channel.

Continuous software delivery with snaps

Developers can use tracks to publish multiple supported snap releases under the same snap name (for instance, a released snap may be on the “latest” track for external users and an ”insider” for an internal QA team). 

Risk levels represent a progressive potential trade-off between stability and new features. The Store modernises embedded Linux development by promoting snaps between Edge, Beta, Candidate and Stable channels, facilitating continuous software delivery. For instance, publishers can request users to participate in beta testing and, once the beta programme is over, move consumers back to stable, while users can pick which maturity level is most appealing to them.

And finally, branches are optional and hold temporary releases intended to help with bug-fixing. 

Final considerations for embedded Linux development

Snapcraft is a powerful and easy to use command-line tool for building snaps. It helps embedded Linux developers reach a wider audience by building and publishing snaps on the Snap Store

Snapcraft raises the bar for embedded Linux development by using channels, tracks and branches to control updates and releases, and secures it by building and debugging snaps within a confined environment. Snapcraft also simplifies embedded Linux development in that it uses a single declarative YAML file to define a snap. Developers who previously created packages for Linux distros will find it is similar to rpm spec files, Debian/control files or Arch Linux pkgbuild files, but one difference: it is much simpler.

Furthermore, the build and publish life cycle can be automated by integrating Snapcraft into an existing CI/CD pipeline. If your embedded Linux project does not already have a CI/CD process, you can connect your GitHub projects directly to our free build service. It will build a new snap on every commit and publish them to the edge channel in the Snap Store.

Now that you have a better understanding of snaps, Snapcraft and the Snap Store, jump to the last blog of this series to learn about the final, revolutionary step in the world of Linux. In the concluding chapter, we will connect all the concepts mentioned throughout this series and introduce Ubuntu Core. The combination of a hardened OS, snap packages and Store, gives developers a platform for secure, open-source embedded software development and deployment.

Are you evaluating Ubuntu Linux for your embedded device?

Get in touch

Further reading for embedded Linux development

Why is Linux the OS of choice for embedded systems? Check out the official guide to Linux for embedded applications in whitepaper or webinar form.

Interested in a detailed comparison of Yocto and Ubuntu Core? Watch the Yocto or Ubuntu Core for your embedded Linux project? webinar.

Did you hear the news? Real-time Ubuntu 22.04 LTS Ubuntu is now available. Check out the latest webinar on real-time Linux to find out more.

Do you have a question, feedback, or news worth sharing? Join the conversation on IoT Discourse to discuss everything related to the Internet of Things and tightly connected, embedded devices.

Related posts


Canonical
22 May 2024

Advantech RSB-3810, a new Single Board Computer powered by MediaTek Genio 1200, is now certified on Ubuntu 22.04 LTS

Internet of Things Article

Discover this new hardware solution designed for IoT and edge applications Canonical has partnered with MediaTek to optimise Ubuntu for IoT innovations and announced the first Ubuntu images optimised for MediaTek’s Genio 1200 System on Chip (SoC) in 2023. The solution is designed to deliver AI innovation in diverse markets. Devices built ...


Canonical
12 September 2023

이제 인텔 SoC에서 일반적으로 사용 가능한 최적화된 실시간 우분투

IoT Article

Canonical이 TSN 및 인텔 TCC를 지원하는 인텔 코어 프로세서에서 실시간 우분투를 제공 2023년 7월 26일, 런던: Canonical은 오늘 인텔 코어 프로세서에 최적화된 실시간 우분투를 이용할 수 있음을 발표했습니다. 이 솔루션을 통해 기업은 통신회사 워크로드에서 생명을 구하는 의료 장비 및 공장용 자동화 시스템에 이르기까지 광범위한 사용 사례에 인텔 실리콘에 최적화된 리눅스의 성능을 이용할 수 있습니다. Canonical의 ...


Canonical
2 December 2024

Canonical announces public beta of optimized Ubuntu image for Qualcomm IoT platforms

Canonical announcements Article

Today Canonical, the publisher of Ubuntu, and Qualcomm® Technologies announce the official beta launch of the very first optimized image of  Ubuntu for Qualcomm® IoT Platforms. Through this beta program, developers will be able to download and use Ubuntu 22.04 LTS for the Qualcomm® RB3 Gen 2 Vision kit, which runs on the Qualcomm® QCS6490 ...