Is the root file file system adequate for your embedded project

Suitability for Your Project It's time to decide whether the supplied root file system is adequate for your project. Although the supplied root file system won't be a perfect match, the question boils down to this: is the root fil...
This article was sent to us by: Carol Pruitt at 01232010

1 Software » Is the root file file system adequate for your embedded project
Bookmark and Share

Suitability for Your Project

It's time to decide whether the supplied root file system is adequate for your project. Although the supplied root file system won't be a perfect match, the question boils down to this: is the root file system close enough to be suitable for a starting point.? If the sources for the root file system aren't present, or what's necessary for the project is wildly different than what the root file system contains, starting from scratch is likely the best route. For example, if the root file system includes all the binaries for handling graphics, and the device doesn't include a UI, these components are wasting space and should be removed. Conversely, if the device's root file system needs to fit a very small flash partition, nearly any root file system that hasn't been optimized for space is too large. However, if the supplied root file system is about the right size and has the software ready for the way the device will be used, there's no reason, other than building character, to build the RFS from whole cloth; the best approach is to create the application, copy it into the file system, and rebuild the root file system binary image. Purists may treat this approach with disdain, but it's an acceptable route for many projects.

Root file systems that use uClibc have another constraint: uClibc makes no effort to be binary compatible with other versions of uClibc. That's not a defect, but rather a space-saving choice made by the developers of the project—binary compatibility requires additional code and therefore increases the size of a project whose stated goal is minimal size. No matter what route you take with the root file system, you must change the startup scripts to make them run faster and require fewer resources. At a minimum, the startup scripts need to be modified to run applications created for the device. The kernel must also be rebuilt for the project, because the one included with the board is likely missing the correct device drivers or has drivers that aren't necessary. In addition, the kernel must be rebuilt with common options to reduce its size and minimize boot time. Because the kernel needs to be rebuilt, you don't need to decide whether it can be used in its present condition.

Cross-Compiler

When you're assessing the support package for the board, don't forget to see whether the vendor included a cross-compiler. A cross-compiler isn't a required component for booting and frequently isn't included with the Linux software that's shipped with the board. Building a cross-compiler or using a native compiler running in an emulator is a much easier prospect than in previous years, but it still represents some effort that must be expended on the project. If the board does ship with a cross-compiler, it's difficult to identify whether it was the compiler used to build the kernel and/or the root file system; but you can check the versions of the C library in the cross-compiler's directory to see if they match. In the cross-compiler's directory, look in the <arch>-linux/lib directory for libc.so.6. The cross-compiler is located in a directory that's formatted like this

<arch>-linux
<arch> is something like armv5l, or mipsel, or even i686. To be sure you've located the correct
   directory, be sure it contains a /bin directory that contains, at least, a compiler, a preprocessor, and a
 linker:
<arch>-linux/bin/<arch>-linux-gcc
   <arch>-linux/bin/<arch>-linux-cpp
   <arch>-linux/bin/<arch>-linux-ld

There may be slight differences in the names of the files, because these are specified at build time and the values are only convention; the builder of the toolchain has a great degree of freedom over what these executables are named and sometimes picks nonstandard labels. When you find something that appears to be a cross-compiler, double-check by requesting the version number:

# ./<arch>-linux/bin/<arch>-linux-gcc –dumpversion
 4.1.0

After you locate the cross-compiler, look for the architecture's lib directory:

# ls –l ./<arch>-linux/<arch>-linux/lib/libc.so*
   -rw-r--r-- 1 root root 386 Oct 20 2006 armv5l-linux/lib/libc.so
   lrwxrwxrwx 1 root root 14 May 7 2007 armv5l-linux/lib/libc.so.6 -> libc-2.4.90.so

Look at what libc.so.6 links to, and verify whether it's the same in the board's lib directory, If they're the same, chances are this compiler was used to build the root file system, although you can't prove it definitively. Because the Linux kernel doesn't have any library dependencies, it indicates the version of GCC used. If that version matches what –dumpversion reports, it's a safe bet that the compiler was used to build the kernel, but this assertion can't be proved beyond any doubt. No cross-compiler? Shouldn't the software include one to build the sources? With GPL software, the supplier of a binary must also supply the source but not necessarily a cross-compiler.

At this point, you should be familiar with the contents of the Linux supplied with the board—both what it supplies and what's missing. Some Linux distributions offer nearly everything necessary for development and even supply a kernel and a root file system that closely approximate what is necessary in the production device; in other cases, the best approach is to start from the beginning. The important part is that you choose the route for your project after understanding what's included with the board.

Legal Disclaimer

Our website is not responsible for the information contained by this article. Articleinput.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.

Related Articles

1. Embedded Linux is used for some very good commercial reasons
Commercial Reasons to Use Embedded Linux In addition to the outstanding technical aspects of Linux that make it advantageous to use for an embedded device, ther...

2. Linux and its memory management system
Memory Management and Linux Linux uses a virtual memory-management system. The concept of virtual memory has been around since the early 1960s and is simple: th...

3. Why is Linux such an incredible piece of sowtware
Embedded Linux Linux is an incredible piece of software. It’s an operating system that’s just as at home running on IBM’s zSeries supercompute...

4. Explanation of the Embedded Linux development process
Embedded Linux is a topic with many interdependencies; this article lays out the big points and purposely lacks detail so you can see the big picture without getting dist...

5. Basics to understanding the structure of an embedded Linux system
Anatomy of an Embedded Linux System At runtime, an embedded Linux system contains the following software components: • Boot loader: What gets the ope...

6. The resemblance between the GCC compiler and the kernel in Linux
The GNU Compiler Collection The GCC compiler, like the kernel, is designed for portability. Like all open source programs, GCC is available in source form, and ...

7. Automake and Autoconf discover the state of the target environment
Automake/Autoconf Open source software is designed to be distributed in source code form so that it can be compiled for the target platform. When target platfor...