For development activity, the default STLinux file system contains a comprehensive set of tools, libraries and other useful files, which, as a whole, can occupy a large amount of disk space. However, when installing STLinux on an embedded system with limited resources, it is important to remove all non-essential files from the installation in order to make the best use of the limited available storage.
This section explains how identify the essential components of the installation. Any component that is not identified as being essential (such as unused shared libraries) can then be removed from the installation, reducing the size of the file system.
If binaries are statically linked to their libraries, this will cause the production of very large binary files. In fact, different binaries could to be linked to the same library. So, multiple copies of the library will be included in the installation. It is, therefore, much more efficient to use dynamic linking to link a binary to its libraries. This reduces the size of binaries to the very minimum and ensures that only one copy of each library is shared between all the binaries that use it. Also, if a given library is upgraded, then only that single library needs to be replaced, rather than having to relink all the binaries that use that library.
The ldd tool find the dependencies between binaries and their dynamically linked libraries and between one library and another. For each binary file named on the command line, ldd identifies all the libraries linked to that binary. Any libraries that are not named can be discarded.
The STLinux distribution provides an ST40-dedicated version of ldd. This can be found in:
/opt/STM/STLinux-X.X/host/bin/ldd host# ./do_min_fs.py --helpNote: it is assumed the sh4 starting binary files are placed only in canonical STLinux directories. (/opt/.../sh4/target/bin, /opt/.../sh4/target/sbin, /opt/.../sh4/target/usr/bin, /opt/.../sh4/target/usr/local/bin and /opt/.../sh4/target/usr/sbin)
The script must be executed as "root" into the host PC in which a full ST Linux SH4 target distribution has previously been installed.