Reducing the Size of the Root File System - Linux Embedded systems

This is the best place to start optimization because it has the greatest potential for wasted space. Starting from zero also forces you to think through the addition of each new component and understand why you’re adding it to the system. In the starting-from-zero approach, you also see that what was once done as a shell script becomes part of the application, to avoid the overhead of the shell executable and script.

Start from Zero

This includes references to several different distribution building tools like OpenEmbedded and Buildroot. These are great tools for creating a Linux distribution, but they don’t create a minimal Linux distribution. The best way to make a small distribution is to start with nothing and work upward from zero rather than try to whittle down an existing root file system and hope nothing breaks. You can create the minimal contents for a root file system by doing the following:

The application resides in the root of the file system and must continue running or the system will halt, because at least one process must kept running in a Linux system. This root file system can be built as an initramFS and therefore assembled with the kernel and included in the kernel image file deployed on the device.The application is placed in the root directory of the target machine and is statically linked, so it doesn’t require any additional files. This root file system adds about 3KB on top of the application, meaning the flash drive of a few megabytes looks like a huge amount of space by comparison.

Applications operating at this level are usually quite simple; they may read a value from a measurement or wait for the user to scan a bar code and perform a query. Whatever the application, it’s small enough that is can easily fit into the remaining few MB of space in flash.

When you use this approach, the kernel’s init= parameter must be set to the application or the application must be named linuxrc so that it’s run when the system starts; remember, the init program can be anything the kernel can execute This system is so small, in fact, that as a side effect it also boots very quickly, assuming the application code is reasonably efficient. As a rule, systems that have been built up from zero boot quickly because the drive to be small reduces the system to the essentials, jettisoning even a shell for scripting. This minimal file system usually prompts people to say things like, “I thought I needed….” Table below clears up many of those questions and explains why a certain component is missing.

Minimum-Requirements for a root filesystem


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Linux Embedded systems Topics