System Minimization
should be:
make CC=gcc CFLAGS="-Os"
This is important, because some rules will invoke CC for things other than compilation, and the parameters will not make sense and result in an error.
After selecting the C library, all of the code in the root filesystem needs to be compiled with the new compiler, so that code can take advantage of the newer, smaller C library. At this point, it's worth evaluating whether static versus shared libraries are the right choice for the target. Shared libraries work best if the device will have arbitrary code running and if that code isn't known at the time of deployment; for example, the device may expose an API and allow end users or field engineers to write modules. In this case, having the libraries on the device would afford the greatest flexibility for those implementing new features.
Shared libraries also would be a good choice if the system contained many separate programs instead of one or two programs. In this case, having one copy of the shared code would be smaller than the same code duplicated in several files.
Systems with a few programs merit closer consideration. When only a few programs are in use, the best thing to do is create a system each way and compare the resulting size. In most cases, the smaller system is the one with no shared libraries. As an added benefit, systems without shared libraries load and start running programs faster (as there's no linking step), so users benefit from an efficiency perspective as well.
Although there's no magic tool for making a system smaller, there is no shortage of tools to help make a system as small as possible. Furthermore, making Linux “small” is more than reducing the size of the kernel; the root filesystem needs to be examined critically and paired down, as this component usually consumes more space than the kernel. This article concentrated on the executable image size; reducing the memory requirements of the program once it is running constitutes a separate project.
Resources
Linux-tiny Patches: www.selenic.com/linux-tiny. A series of small patches to the kernel to reduce the image size and runtime resources. Many of these patches already have made their way into the kernel.
GNU C Library: www.gnu.org/software/libc. The GNU C Standard Library is the canonical implementation of the C library. The need for this to run on nearly every platform with backward compatibility resulted in a Lib C that's bigger than most.
uClibc: www.uclibc.org. A well supported smaller implementation of Lib C.
Newlib: sourceware.org/newlib. Red Hat's small C library.
dietlibc: www.fefe.de/dietlibc. The smallest C library of the bunch. It works well with an existing cross-compiler, as the install creates a “wrapper” program for GCC, invoking it with the right parameters to make building with dietlibc very easy.
Gene Sally has been working with all facets of embedded Linux for the last seven years and is co-host of LinuxLink Radio, the most popular embedded Linux podcast. Gene can be reached at gene.sally@timesys.com.
- « first
- ‹ previous
- 1
- 2
- 3
- 4
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- RSS Feeds
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- Dart: a New Web Programming Experience
- Developer Poll
- What's the tweeting protocol?
- May 2013 Issue of Linux Journal: Raspberry Pi




3 hours 34 min ago
4 hours 21 min ago
5 hours 55 min ago
7 hours 31 min ago
9 hours 29 min ago
9 hours 46 min ago
10 hours 16 min ago
10 hours 17 min ago
10 hours 18 min ago
13 hours 18 min ago