Linux is the operating system of choice for Internet of Things device manufacturers looking to fit their resource-constrained embedded devices with lightweight software systems. As an open-source project, Linux offers a stable, low-cost, secure, and up-to-date platform that can be run on a variety of microprocessor architectures, powering a range of devices from IoT sensors at the low end to powerful supercomputers.
A typical Linux OS integrates tools and packages from numerous developers and organizations (for example, GNU tools and libraries) to create a functional OS for a device, commonly known as a Linux distribution or Linux distro. However, developers may find it time-consuming and tedious to integrate these diverse tools and packages into a comprehensive OS that can support a wide array of functionalities. Fortunately, since the Linux kernel is open source, its source code can be modified and repurposed for redistribution, which has led to the emergence of several standard Linux distros for IoT devices in the market. The key difference between traditional Linux distros for desktops and embedded Linux distros is that the latter only includes drivers and libraries required to run on the target processor, requiring as little as 100KB of space. This makes them suitable even for low-spec single-purpose, single-function IoT devices that often only have 64MB of RAM and 32MB of storage space.
Some of the most popular IoT Linux distros have been described here for you.
Ubuntu Core is the most popular embedded Linux distro, likely because most manufacturers and developers are already familiar with Ubuntu. Ubuntu Core is based on Debian and is essentially an IoT-optimized version of Ubuntu that you can customize to include only the packages and binaries required to power your single-purpose, single-function IoT devices.
Ubuntu Core offers a secure, modular, immutable container-based OS built on snaps. Updates to connected devices occur several times a day automatically and atomically using deltas that can be instantly rolled back if a buggy update is installed or if the update process is interrupted. Ubuntu Core currently supports container runtimes and orchestrators such as snapd, Docker, LXD, AWS Greengrass, Azure IoT Edge, and Kubernetes.
However, Ubuntu Core’s minimum requirements include a 500Mhz single-core processor, 256MB of RAM, and 512MB storage, making it a nonviable option for low-spec IoT devices with severe hardware limitations.
The Yocto Project does not advertise itself as an embedded Linux distro but rather as an open-source collaboration project that can help you create your own custom distro. Yocto offers flexible tools and a space for embedded developers to leverage shared configurations, software stacks, and best practices to customize their Linux-based architecture for embedded devices across the spectrum.
Yocto is based on the OpenEmbedded project and employs a development model dubbed the “Layer Model.” A layer in Yocto is a repository that contains related sets of instructions telling the build system what to do. Layers can override previous settings or instructions, allowing you to repurpose community-built layers for your own embedded systems. By separating a build into modular layers, Yocto also makes it easier for you to reuse code and add future customizations to your distro. Yocto releases are pushed out every six months with exhaustive documentation.
Perhaps the biggest drawback of Yocto is the amount of time developers need to spend on acquainting themselves with the project and learning how to use it before they can create their first build. It can present quite a challenge to developers who are still green around the ears.
Buildroot is like Yocto in that it is not an embedded Linux distro itself but rather a tool for simplifying and automating the process of generating an embedded Linux distro by using cross-compilation. Buildroot can be used to generate a root file system, a Linux kernel image, a bootloader, and a cross-compilation toolchain in any required combination for your embedded device. Buildroot comes with support for several processors and off-the-shelf boards like Raspberry Pi, Cubieboard, and SheevaPlug.
Buildroot can generate extremely lightweight distros for embedded devices at the lowest end. Furthermore, in contrast to Yocto, Buildroot is easy to master and use. The only major drawback is that its minimalist approach makes it hard to customize.
Raspberry Pi OS is a free, Debian-based OS that was initially developed by fans of the Raspberry Pi hardware and the Raspberry Pi Foundation, quickly becoming the official software for Raspberry Pi devices. The Raspberry Pi project’s initial goals were to make computer science education more affordable and accessible. But the device has quickly become popular in diverse fields and among hobbyists as a modular, low-cost, open-design single-board computer, even making its way into the IoT market.
Raspberry Pi OS has been used to power a range of Raspberry Pi-based projects ranging from digital cameras to ventilators for COVID-19 patients. It is slowly finding use in home automation and industrial automation IoT projects.
Unfortunately, since the OS is developed almost exclusively for Raspberry Pi hardware, its use in other consumer hardware devices is severely limited, restricting its spread into the embedded market.
Android Things was one of the first Android-based distros for low-spec IoT devices. But the Android Things project is due to be shut down by January 2022. Initially announced by Google in 2015 as an Android-based distro for low-spec IoT devices, the project offered key functionalities for IoT devices with a minimum of 32 to 64MB of RAM. In addition to providing a base OS for low-powered, memory-constrained IoT devices, Android Things also aimed to enable cloud connectivity with an in-built management console for update delivery and device provisioning, supporting WiFi, Bluetooth, and Weave protocol.
In its initial release in 2018, Android Things powered smart-home devices that supported Google Assistant, especially smart speakers and displays. However, in 2019, Android Things stopped supporting low-spec hardware and instead refocused on smartphone-class devices. In December 2020, it was announced that the project would be shut down and that all project data would be deleted by January 2022. Despite its failure, Android Things remains a significant milestone at maximizing the capabilities of devices with extreme hardware constraints.
Choosing the perfect Linux distro for your embedded project depends on several factors:
The bottom line is that no single distro can meet the requirements of every embedded Linux project. Each project may require a different approach and an IoT Linux distro that matches that approach. Several developers may go “distro hopping” before settling on an ideal distribution, and there are several tools to help you test and choose the best distro.
Featured image: Designed by Katemangostar / Freepik