Skip to contentSkip to conversation

Minimizing the Kernel

DISCUSSION Scott Robert Ladd 4 participants 4 messages Sep 24, 2003

lore
Share & tools
lore
#0 lore raw

I want to created the smallest, fastest kernel that supports all the necessary features of a given system.

Obviously, the answer is very system dependent, requiring a keen knowledge of the relationships between hardware and Linux components.

Unless I'm missing something (always a possibility), the kernel configurations do not provide a clear idea of component size. In other words, if I include "burfulgunk port support" in my kernel build, I'd like to have a rough idea of the component's size. I might not need to support the "burfulgunk", especially if it's a large component (for, say, a legacy port.)

I'm well aware that code sizes differ between platforms; I'm looking for general information, as a guideline to generating a small kernel.

Signature · 3 lines
Scott Robert Ladd
Coyote Gulch Productions (http://www.coyotegulch.com)
Software Invention for High-Performance Computing
#1 lore raw

Well for starters dont use gcc 3 or above.. code size has increased dramatically with thoose versions. sure they give you more optimization , but if your looking for a small kernel use anything below 3..

Matt H.

Quoted 15 lines · Scott Robert Ladd

I want to created the smallest, fastest kernel that supports all the necessary features of a given system.

Obviously, the answer is very system dependent, requiring a keen knowledge of the relationships between hardware and Linux components.

Unless I'm missing something (always a possibility), the kernel configurations do not provide a clear idea of component size. In other words, if I include "burfulgunk port support" in my kernel build, I'd like to have a rough idea of the component's size. I might not need to support the "burfulgunk", especially if it's a large component (for, say, a legacy port.)

I'm well aware that code sizes differ between platforms; I'm looking for general information, as a guideline to generating a small kernel.

#2 lore raw
Quoted 2 lines

Well for starters dont use gcc 3 or above.. code size has increased dramatically with thoose versions. sure they give you more optimization

Hmm, has anyone tried -Os with gcc3+ ?
Maybe that'd be good for size optimization?

Regards,
Maciej

#3 lore raw
Quoted 4 lines · Maciej Soltysiak
Quoted 2 lines

Well for starters dont use gcc 3 or above.. code size has increased dramatically with thoose versions. sure they give you more optimization

Hmm, has anyone tried -Os with gcc3+ ?
Maybe that'd be good for size optimization?

I've usually been compiling with -Os on gcc3 for a while, works for me.

% size */vmlinux
text data bss dec hex filename

3034134  620847  224824 3879805  3b337d linux-2.6.0-test4-mm6/vmlinux
3476451  621246  227512 4325209  41ff59 linux-2.6.0-test5-mm2/vmlinux
3034632  622210  226360 3883202  3b40c2 linux-2.6.0-test5-mm3/vmlinux
3037706  623409  226360 3887475  3b5173 linux-2.6.0-test5-mm4/vmlinux

-mm6, -mm3, and -mm4 were compiled with -Os, -mm2 with -O2. All with gcc 3.3.1 from RedHat Rawhide. Given how close -mm6, -mm3, and -mm4 are in size, the 12% or so size saving is almost certainly the efects of -Os rather than changes in the size of the code. I could rebuild any of them to get an exact number, but it would take a while on this laptop....