Which distribution is better to use for embedded systems. This issue is relevant today.
There are three relevant approaches for solving this problem:
- Use a ready-made distribution for your single-board computer (Armbian, Openwrt, etc.)
- Build and configure your distribution using build systems (Buildroot / Yocto, etc.).
- Use your bundle bootloader (u-boot) + kernel (kernel) + rootfs (busybox).
If anyone else knows, please write in the comments.
UPDATE
An OpenWRT project is both a build system (itβs not a buildroot) and a project that provides ready-made assembled images for your target board.
Ready-made distributions
I believe using a ready-made distribution is the easiest and easiest way. You can download the finished image or build your own. Assembling your Armbain image is not always flexible, because you cannot select any version of the Linux kernel, but use only the ones provided.
The main advantage of ready-made distributions should also be answered - their stability.
For starters, I would recommend these distributions.
Armbian is a popular Linux distribution available for a wide variety of ARM devices: Orange Pi, Banana Pi, Odroid, etc ... It is based on Ubuntu and / or Debian.
www.armbian.com
OpenWrt is an embedded operating system based on the Linux kernel and designed primarily for home routers. Key components include the Linux kernel, util-linux, uClibc or musl, and BusyBox. The size of all components is optimized due to the fact that most home routers have very limited memory.
I'd add on my own, well suited for boards with wi-fi on board (for example, Orange Pi Zero).
openwrt.org
Assembly systems
The main advantage of assembly systems is that you can build minimal and flexible Linux for embedded systems.
Buildroot
Buildroot is a distribution build system for embedded systems. It supports a bunch of boards and the result of its work is the assembled bootloader, kernel and image
file system.
What it allows to build buildroot for your system:
- system image;
- This system allows you to select the kernel version - any.
- You can add any patches and install any programs.
- flexible configuration of utilities (e.g. busyBox, bash, etc.)
It should be noted that all additional sources are pulled from the network.
Distinguishing such an assembly, for example, from the Armbian assembly:
- the distribution is not built on the basis of (Debian or Ubuntu), but a custom flexible Linux.
- minimum assembly size.
- selection of any kernel version.
buildroot.org
3. Using your bundle:
For this we need:
- Cross compiler (e.g. Linaro);
- Bootloader (e.g. U-boot);
- Kernel;
- RootFs (e.g. Busybox).
So let's go.
So we will collect locally on our machine we need a cross compiler, for example linaro. The cross compiler will help on the x86 architecture to assemble our distribution for the target ARM platform.
www.linaro.org
Next, you need to build a bootloader.
Bootloader (U-Boot) - The most popular bootloader for ARM, is U-boot. The main task of bootloader is to boot the Linux Kernel kernel. You can also use, for example, barebox or another.
www.denx.de/wiki/U-Boot
Further. We need to build the kernel, at the output we should get the kernel image and device tree for our target platform.
www.kernel.org
RootFs is the root file system that Kernel will mount after booting. I recommend using Busybox.
busybox.net
Conclusion
I am not saying that there are bad or good approaches. Each has its own advantages and disadvantages. It depends on your task and what result you need to get.