Condensing and re-coding programs to save space

Jody Bruchon <[email protected]> Mon, 27 Feb 2017 14:53:43 -0500
Newsgroups org.kernel.vger.linux-8086
Message-ID <[email protected]>
The recent flare-up of networking development has led to a lot of 
additional small programs on the full disk images and that forced me to 
eliminate other programs from being installed automatically to avoid 
image build failures. I'd like to suggest some things that can be done 
to reduce the amount of space these are taking up.

Since all programs are statically linked to C library components, it 
would be helpful to condense similar programs into a single binary where 
possible, have the Makefile's install section create relative symlinks, 
and change the program's behavior based on the name used to invoke it. 
The code to do this obviously has its own overhead as well, so it's only 
practical if there are enough binaries to justify the trouble. You can 
find useful stuff for this in the "busyelks" project I had been trying 
out and left in the code.

It may also make sense to condense the new non-standard programs like 
the "echo tests" into one binary and choose the specific functionality 
with a command parameter instead.

Another thing is the use of write() instead of [vf]printf(). If a 
program can completely avoid the use of the printf() family of functions 
and use write() instead, it'll make the program significantly smaller on 
disk and in memory. If you must use printf() even once then this isn't 
going to be helpful. If you can get away with write() everywhere 
instead, the program will shrink and we'll be able to fit more on disk.

I'm sure more suggestions could be made and they would be most welcome.

-Jody