Linux’s origins can be traced back to the commercially available Unix operating, but it wasn’t until Finnish student Linus Torvalds announced a free Linux kernel in 1991 that the open source operating system movement really started to gain traction Today, there are several popular Linux distributions that are designed for use with SBCs, an example being the Debian-based Raspbian distribution for use with the Raspberry Pi.
You will also find Linux in use with desktop computers, and in fact, the vast majority of the world’s datacentre servers use Linux. There isn’t a specific version, or distribution, of Linux for use on embedded single board computers – it’s just that some distributions contain less in the way of specific resources or peripheral support, although it may be easy it add them later.
Another reason for this is that some SBCs are headless, that is to say they do not have a video output, such as HDMI or composite video. Video controller ICs and associated memory add component cost, size and power consumption, so applications such as an IoT sensor can be kept extremely compact, power efficient and low cost without such capabilities.
Most embedded developers will interact with Linux through the command line interface (CLI) rather than using any desktop graphical environment. But before we embark on some of the basic Linux commands, let’s first of all consider why we are using an operating system.
The alternative to using an operating system is usually nesting your application program into a single ‘round-robin’ or ‘super-loop’ structure and programming using a ‘bare metal’ approach. While this can yield an efficient design, it can become rather cumbersome if the application starts to add features, particularly those requiring networking and connectivity.
For those familiar with using an Arduino, this is the approach you experience, where additional libraries and associated drivers need to be added in order to facilitate, for example, an internet connection. While any operating system adds a degree of memory and resource overhead to any design, the capabilities it provides without any additional effort makes it highly desirable.
Some of the standard Linux functionality includes the provision of a file system, network connectivity and task scheduling, to mention just a few of the many essential features. Linux is an extremely scalable and efficient operating system that has hundreds of commands available, a few of which we’ll cover in this article. Linux also makes it extremely easy to interface to the real world, using GPIO, ADC/DAC and serial interfaces such as I2C.