Compared to proprietary embedded operating systems, Linux is low cost; it allows for multiple suppliers of software, development and support; it has a stable kernel; and it facilitates the ability to read, modify and redistribute the source code. For these reasons and more, Linux has become the go-to option for embedded systems.
But when it comes to deploying Linux into a device, there are numerous options. When building for desktop and enterprise-grade devices, developers usually opt for a distribution such as Ubuntu to best mimic the deployment environment, with added help from tools like VirtualBox and Docker. This setup is an awkward fit for embedded systems programming, though. The development environment is very different, and the build output needs to comprise an entire software image for the target device: the kernel, device drivers, libraries, application software, maybe even the bootloader.
Approaching Linux Distro for embedded development, many people start with a desktop distribution, such as Debian or Red Hat, and strip out unnecessary components until the installed image is a fit for the target device. This is a natural way to go as many Linux devs are desktop Linux users, and can access their usual array of runtime packages. One option is actually to attach a display and keyboard to a target device, and develop directly like that. This approach can be tricky, though. Desktop distributions are not meant for low-resource systems, and manually adding and deleting packages can be a difficult and error-prone job.
One very popular non-desktop option for Linux distro for embedded systems is Yocto, also known as Openembedded. Yocto is supported by an army of open source enthusiasts, some big-name tech advocates, and lots of semiconductor and board manufacturers. A Yocto project build wraps together target run-time binaries, package feed, and Target SDK. It is easily expanded through layers, which add functionality and features. Yocto’s modular architecture makes it very flexible, and provides a well-defined layer priority and override capability. New releases appear every six months and the documentation is always thorough.* Perhaps the only downside with Yocto is that it can be tricky to get to grips with for the newbie.
Buildroot aims to be a more lightweight version of Yocto. Buildroot does not support on-target package management, and disables all optional compile-time settings for all packages. You cannot install new packages into a running system. This leaves a small system; so small that many people call Buildroot simply a firmware generator (as the images are mostly fixed at build time). A Buildroot project build wraps together the root filesystem image and any other auxiliary files needed to deploy Linux; the kernel, boot-loader, and kernel modules; and the toolchain used to build all the target binaries. The main advantage of Buildroot is that it is fairly easy to learn, especially as it uses normal Makefiles and the Kconfig language. The main downside is that Buildroot’s minimal nature makes customization difficult.
OpenWRT/LEDE is aimed at producing binary images for network-accessible package repositories. It is chiefly used for custom firmware for consumer routers. If you need replacement firmware for a commercial device, especially if your embedded design is networking-focused, OpenWRT/LEDE should be your go-to. However, it imposes significant and inflexible policy decisions on your design. If you need significant customization, we recommend Buildroot or Yocto instead.
* More on benefits: https://www.embitel.com/blog/embedded-blog/why-yocto-is-a-framework-of-choice-for-creation-of-embedded-linux-distributions