[H-GEN] Reducing kernel memory footprint?
Chris Baird
cbaird at turing.une.edu.au
Mon Dec 6 11:36:27 EST 1999
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Please observe the list's charter. ]
Martin,
> It may be possible to configure gcc to run its various stages (cpp, cc1,
> cc2, as, ld) in sequence: I think by default it tries to run them at the
> same time with pipes connecting them.
That's "-pipe". It's in Linux makefiles as a default now, as anyone
who've compiled with recent compiler tools on a 8M machine will
testify.
> Another interesting thing would be to call the stages directly, rather
> than through the gcc driver: run gcc -V (or should that be -v?) and put
> that into your script. Of course you should be running from a shell
> script or direct from emacs, not from Make.
With memory this small it actually doesn't add much bypassing make--
loading in anything will see other programs paged out completely to
vm, as if they weren't there to begin with.
> Also, when compiling the kernel and large binaries you should look at
> the -f alignment options, which let you get a crude space-speed tradeoff
> on platforms like x86 that can do unaligned access.
I've gone through all them, including the undocumented ones. :) For a
i386, the best combination so far has been "-O2 -malign-loops=0
-malign-jumps=0 -malign-functions=0". I've even recompiled gcc
(2.5.8->2.95.2, couldn't get 1.40 to work) trying to get a smaller
cc1, but the differences between the versions was negligible...
Anyway, I spent most of today going through kernel source and ripping
out all the crap (APM/PCI/Pentium/SMP/noni386/...) Currently the
footprint's at 880kB, and the source fits onto a single _720kB_
floppy. :)
--
Chris,,
[1] as someone coming from a NetBSD cradle, seeing code like:
#ifdef CONFIG_PCI
mumble
#endif
#ifdef CONFIG_APM
mumble
#include <mumble.h>
for (tmp = 0; tmp < set_proc_mumble(); tmp += mumble) {
#endif
mumble
#ifdef mumble
}
}
#endif
#else
#include <mumblefoo.h>
...deep inside Torvalds' sacred code, made me wish that cpp abuse was
a felony. :P
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.
More information about the General
mailing list