Technologies for decreasing system size

The Linux-tiny patchset

The Linux Tiny patch set is a collection of patches which can be used to make the Linux kernel consume less space. The long-term goal of the Linux-tiny project is to mainline these patches. Several patches have been mainlined over the last few years, and work continues in this area.

Compiler options for reducing kernel size

The second option is new in gcc 3.4, -funit-at-a-time. This apparently makes gcc
do a much better job of inlining and dead code removal. It reduces the
size of both text and data. It depends on another inlining patch that I
think is in the tiny kernel patch (maybe same idea but different details).

The third option, -mregparm=3, seems to be x86 specific, it instructs the
compiler to use registers for the first three function arguments. by John Rigby

Compressed file system

For read-only data, it is useful to utilize a compressed file system.
The following are used heavily in embedded systems:

Use of a smaller libc

dietlibc - another library to produce very small statically compiled executables.

Subset Libc Specification - CELF once considered the possibility of creating a subset libc specification. Some companies have also examined the possibility of modularizing glibc, so that parts of it can be made configurable. Preliminary research indicates that this could be a very difficult thing, since glibc has very messy function interdependencies.

Kernel XIP

By executing the kernel in-place from flash, it is possible to save RAM space.

Size measurement tools and techniques

Kernel size measurement data

Bloatwatch provides a great amount of detail, and the ability to compare the size of kernel versions over time. The range of kernels covered is from 2.6.12-rc2 to 2.6.17-rc1. Unfortunately, the system to

collect kernels and test them broke about the time of 2.6.17, and the system stopped operating at that time.

If you have interest in reviving this tool to make it operational again, please contact User:Tim Bird. CELF has some contract money earmarked for this project.

GCC Code-Size Benchmarking

CSiBE is a code size benchmark for the GCC compiler. The primary purpose of CSiBE is to monitor the size of the code generated by GCC. In addition, compilation time and code performance measurements are also provided.

Case Studies

Motorola reduction of system size (presumably for cell phones) using 2.4 Linux: MotSizeReduction.ppt - this is a placeholder for this Powerpoint as it was too big to upload to the wiki. Email btraynor at gmail.com if you need it immediately.

Other Tidbits on System Size

Memory leak detection for the kernel

Catalin Marinas of ARM has been recently (as of 2.6.17?) been posting a memory leak detector for the Linux kernel. It may get mainlined in the future. Here's a link to the LKML discussions around it: http://lkml.org/lkml/2006/6/11/39

How System Size may affect performance

It has long been theorized that reducing system size could provide a performance benefit
because it could reduce cache misses. There does not appear to be hard data to support
this theory on Linux, but this has been discussed on the kernel mailing list.