sexta-feira, 11 de abril de 2014

What is Embedded Linux


Embedded Linux Systems is the application and usage of Linux kernel to a eletronic board whose main element is a System-on-a-chip (SoC). The Linux kernel in conjunction with a range of other software is written in FLASH memory or other storage media present on board. This combination constitutes a complete and functional operating system. 

The same Linux that runs on a supercomputer can run on a simple board! What makes this possible is the wide range of architectures and processors that Linux supports. But not all these architectures are actually used in embedded configurations. The most commonly used in embedded systems is ARM, PowerPC and MIPS. 

Many kernel sub-communities maintain their own kernel, with usually newer but less stable features. In some cases, manufacturers maintain derived versions of the official Linux in order to provide support to your specific hardware. But, official Linux kernel is hosted in:

Architecture of an Embedded Linux System

The basic components of embedded Linux are:
  1. Bootloader
  2. Kernel
  3. Rootfs
  4. Toolchain
A Bootloader resides in protected program memory on a SoC or storage media on board. It is usually the first software to run after power up or reset and is specific for each board. It is responsible for loading the kernel into main memory system. It can receive configuration parameters via file or command line. And you can also pass parameters and commands to the kernel through Bootloader.
The Kernel is Linux itself. As you should know the Kernel is responsible for managing all internal peripherals to SoC and outside it, the main and secondary memory system, besides offering access mechanisms hardware for software on user space(system calls). It coordinates all the processes so there are no conflicts or disputes over system resources. And many other tasks. The figure below shows the process of booting a Linux Embedded system and the basic elements that compose it:

Rootfs(root file system) is a set of softwares and libraries organized in a predefined hierarchy. Is closely related to the idea that we have about Distributions based on GNU/Linux. For this reason we have rootfs done by Distros like Debian, Ubuntu, Fedora, Arch and so on. Under Debian there is ports to ARMEL, ARMHF, MIPS, PowerPC, Sparc. 
Rootfs can be built with some sort of file system targeted to memory Nand like cramfs, JFFS2, squashfs and many others. Nowadays you can also use file systems designed for HDD like ext2, ext3 and ext4.


A toolchain is a set of software development tools. A cross toolchain (like arm-linux-gcc) run on a host system of a specific architecture (such as x86) but produce binary code (executables) to run on a different architecture (e.g. ARM). This is called cross compilation and is the typical way of building embedded software. 

Toolchain can be considered the central element of an embedded Linux. From it, all the other three elements will be generated. So, if you choose a armhf cross toolchain, bootloader, kernel and all software have to be compiled for armhf. You can compile your own toolchain or to download an existing. Debian toolchains are a good choice because they are stable and compact. On the other hand build your own toolchain is a complex task and sometimes can be frustrating. You can find the Debian toolchains here:

There are three concepts associated with toolchains which you will see constantly:

  • the build machine, on which the toolchain is built
  • the host machine, on which the toolchain is executed
  • the target machine, target for which the toolchain generates executables

  • Typically we use something like a x86 build machine, a x86 host machine and some target(ARM, PowerPC, MIPS). The build/host machine could be Windows or Mac OS, however it is more recommended to use Linux as Workstation. The reason is simple: to gain experience with Linux, there really is no substitute for actually using a Linux system for your own development. My personal recommendation is: use Linux!

    Builder Systems

    There are software that can build of automated manner a whole embedded Linux system. Using the same scheme of construction of Linux, through a .config file. The most systems allows building using the toolchain indicated by you or build everything from scratch, including the toolchain. Good choices to builder systems are BuildrootYoctoproject and PtxdistYou can also manually build a embedded linux system from scratch, but it takes a long time. The book Building Embedded Linux Systems explains step by step how to build the entire system from scratch.

    Boards with embedded Linux

    In 2013 one avalance of new boards appeared on the market. Many with attractive prices. Before it was difficult to buy a board due to high prices. There were few boards with affordable prices. For example, Friendly ARM. 

    Nowadays there are many options and settings of boards. Among the cheapest and with great cost benefit are OLinuXino, Cubieboard, BeagleBone Black, Raspberry pi, Wandboard... They are made by independent companies from different parts of the world. Of the new boards that have emerged recently, Beaglebone Black spread very fast. 

    The choice will depend on project requirements and its available budget. The boards whose target audience is the hobbyists are generally cheaper. You can buy them under $100. Boards with greater availability of peripherals and more RAM memory are usually more expensive.

    Programming languages

    The availability of ports done by distributions like Debian, Fedora, Arch, becomes programming possible in any available language in Linux Desktop. Language C, C++, java, perl, python. Many projects have been made ​​in python. However most of it is still done in C language.


    Linux has expanded greatly in the world of electronics in recent years. Largely due to Android. Not only that, but also for its maturity and improvements to ports used in embedded systems like ARM, MIPS and PowerPC. It seems that the developers of the kernel is giving more attention to embedded systems and new features have been added.

    Today Linux is used in many electronics devices, even where it was not used before. Examples like TVs, refrigerators, smartphones, tv satellite receivers, automation car and so on. It is likely that there is further growth.


    Nenhum comentário:

    Postar um comentário