Blog  /  Embedded Linux Tutorial- All you need to Know

Embedded Linux Tutorial- All you need to Know

The smartphone device you use is an example of an embedded system, probably running on embedded Linux. It performs specific operations, unlike a general-purpose PC with no particular function. Check out this embedded Linux tutorial, whereby we'll explain why the software component is the best for embedded systems.  

What is Embedded Linux?

 

Linux OS

Fig 1: Linux OS

 

An embedded system is a computer system designated for performing specific operations. Therefore, most consumer electronics devices are embedded systems.

Embedded Linux is a form of Linux kernel that is useful in application programs of embedded systems.  For example, Android, the popular smartphone application development software, runs on kernel code. Thus, the application software is an embedded Linux system.

Additionally, a kernel object represents the core of an OS that is key in running target hardware. It specifically includes its CPU and memory.

Why Choose Linux for Embedded Systems?

Linux Kernel is often the most common application software in many consumer electronics devices. Here are some of the reasons behind its popularity.

Open Source

Linux Kernel is popular because it’s an open-source OS

Fig 2: Linux Kernel is popular because it’s an open-source OS

 

Primarily, Linux software is an open-source kernel code. Therefore, it is easy to customize the source code according to one's specific needs. Also, you are free to remove or add components of the Kernel object while creating a Linux image for the target hardware.

Therefore, respective owners are free to make a kernel image for Linux consumer electronics devices with limited memory.

Reusability

Working with open-source application programs makes the design of embedded objects relatively easier. Primarily, this is because Linux has extensive community support dedicated to different application development.

Hence, they avail numerous application software like I2C, graphics libraries, SPI libraries, TCP/IP stack, etc. Therefore, irrespective of the type of filesystem you're dealing with, the Linux community got you sorted. It frees up time to primarily concentrate on the main application development.

Low Cost/ Free

Linux OS community develops most apps

Fig 3: Linux OS community develops most apps

 

With Linux, you can skip the application development step as most applications are readily available. Thus, all you need is application selection, depending on your target hardware.

Since all the custom applications are freely available, application development on the Linux OS is low cost. Consequently, this lowers the price of the embedded device. Hardware Support/ Ext

ensure Compatibility

Linux offers support to an extensive array of processor architectures that include the following:

Primarily, the OS functions on an MMS architecture microprocessor but also operates under non-MMS architecture, albeit with limitations.

Classification of embedded Linux system

 
Embedded Linux Systems are primarily classified in terms of size. 

Fig 4: Embedded Linux Systems are primarily classified in terms of size.

The classification criterion for the embedded systems is primarily based on the system structure. Still, you can classify on the consideration of size and time limits. Here are the three main classifications based on size.

Small systems

They feature a low-powered CPU and boot ROMs not exceeding 4MB. Additionally, such a system has a RAM of 8MB to 16MBs.

Medium size system

Its CPU is medium powered and has a 32MB initial RAM Filesystem. Furthermore, it features a removable memory card.

Large size systems

Most will have a powerful CPU or, in some cases, many CPUs. The RAM is also larger than for the medium size system. Finally, it has a permanent storage system.

Minimum Hardware Requirement to use Linux on Embedded Processors

 
Embedded Linux Systems are primarily classified in terms of size. 

Fig 5: A programmer coding in Linux

 

Primarily, the Linux Kernel object supports processor architectures such as the following:

  1. ARM.
  2. SH.
  3. MIPS- Handy in networking operations such as in routers and hotspots.
  4. PPC or PowerPC.
  5. X86- It's essential in industrial functions and multimedia applications.

Also, not that running Linux application software on a target embedded processor will need an initial RAM Filesystem of at least 32MBs. Furthermore, a successful startup process will require a storage memory filesystem of 4MBs.

For the storage requirements, you can opt for the NOR raw Flash, SD, or MMC cards.  

Embedded Linux Architecture

 

The block diagram below represents the architecture for an embedded Linux software component.

Embedded Linux Architecture

Fig 6: Embedded Linux Architecture

 

The build process of the embedded system happens on the host PC, and cross-compilation tools are essential in this procedure. Primarily, the target hardware lacks the requisite tools for generating a binary image to run the embedded class of hardware.

Therefore, cross-compilation primarily involves compiling a code (initialization file) on one server system. Next, the code from the host system is run on another server system.  

Main Components of Embedded Linux Systems

 

Root file system

 

A programmer working on Linux

Fig 7: A programmer working on Linux

 

A Root filesystem is imperative in organizing data in the form of files and directories within the storage devices of the development boards. Essentially, in Linux, everything is a root file.

Also, the loadable kernel modules will require a root filesystem in the boot process. The root filesystem is a configuration files repository that is handy in making the embedded device's execution environment.

Besides, it is cardinal in the Init Process/ Standard initialization process of running a program on Linux.  

Kernel

 

It's the primary application software of the embedded system. The application software is primarily layered into two parts: the kernel space memory and the user space.

Its functions comprise;

  • File management.
  • Process management and scheduling.
  • Facilitating networking.
  • Interprocess communication.
  • I/O management.
  • Interfacing hardware via device drivers.
  • Memory management.

 

Device tree

 

A programmer working on Linux

Fig 8: Device Tree Illustration

 

The device tree is a channel of the embedded Linux Kernel system, essential in identifying the presence of additional devices. Therefore, a device tree represents a tree data structure that aids the identification of additional devices that are not easily discoverable.

Note that some additional devices are discoverable while others are non-discoverable by default. Examples of non-discoverable on-chip peripheral devices include the ethernet interface, UART, I2C, and SP.

On the other hand, a component such as a USB device is discoverable by default.

Bootloader

The code/ initialization file runs after the first power application on the embedded class of hardware. Its functions include:

  • Target hardware initialization and the application binary loading,
  • Facilitating the external RAM connection to the SOC and main operating system code execution.

Cross-development toolchain

It features tools such as C libraries, GCC compiler, and GNU debugger. These toolchain tools are cardinal in making the source code for the target board devices.

Note that the cross-compilation toolchains are only utilizable in embedded Linux. Primarily this is because most target peripheral devices lack the requisite toolchain support resources.

Hence, to complete the cross-compilation, an ethernet interface will be necessary to transfer the source code to the target additional devices. Where an ethernet MAC interface is unavailable, you can use any other available serial communication interface.

Other Key components include System Programs and Applications.

Conclusion

Our embedded Linux tutorial has covered all the cardinal insights on this topic. But if there are grey areas or queries you'd want to pitch, reach out, and we'll respond immediately.