Subject: Re: Small kernel...
To: =?iso-8859-1?Q?Thorbj=F6rn?= Jemander <>
From: Greg A. Woods <>
List: netbsd-users
Date: 09/20/2001 01:35:21
[ On Thursday, September 20, 2001 at 06:57:18 (+0200), =?iso-8859-1?Q?Thorbj=F6rn?= Jemander wrote: ]
> Subject: Small kernel...
> I'm looking at netbsd for (possibly) using it in an embedded system,
> and just want to know how small you can get the kernel, with some
> effort.
> How modular is it, and how much can you remove?

Here are the ones that I have.  Note the last one in particular.

	$ cd /var/obj/NetBSD/arch/i386/compile
	$ size */netbsd
	text    data    bss     dec     hex     filename
	4392345 77468   304044  4773857 48d7e1  GENERIC/netbsd
	4505818 77500   304140  4887458 4a93a2  GENERIC_DIAGNOSTIC/netbsd
	4506531 79772   291116  4877419 4a6c6b  GENERIC_LAPTOP/netbsd
	1840275 51244   170572  2062091 1f770b  GENERIC_TINY/netbsd
	3410913 2141048 202084  5754045 57ccbd  INSTALL/netbsd
	2204703 2132496 199108  4536307 4537f3  INSTALL_LAPTOP/netbsd
	1004181 1376196 102580  2482957 25e30d  INSTALL_SMALL/netbsd
	940987  1376292 102612  2419891 24ecb3  INSTALL_TINY/netbsd

If you take away the memory disk from INSTALL_TINY you'll end up with
something like this:

	text    data    bss     dec     hex     filename
	940987  24612   102612  1068211 104cb3  REAL_TINY/netbsd

> Is it posible to get below 300k? 100k? 30k?!

Nope, I seriously doubt it, at least not with networking still present.

Even if you removed all the networking code it'd still be quite big I
think....  hmmm that shouldn't take too long to compile, if it works....
(only six minutes to build on my PII/300 server with no 'make depend')

Here's the result of an i386 build without any networking or drivers
except for com, fdc, wdc, and the old pccons:

	text    data    bss     dec     hex     filename
	520498  18012   62804   601314  92ce2   MINISCULE/netbsd

Getting it any smaller than that would be a real challenge I think, and
that's about twice as big as your first 300k goal!  ;-)

Damn, I wonder what's in all that!  Heck I even removed ptys!  Maybe one
of the other filesystems would be smaller....  Here's the config:

include "arch/i386/conf/std.i386"
makeoptions     COPTS="-Os"     # Optimise for space. Implies -O2
maxusers        2               # estimated number of users
options         BUFPAGES=16     # small machines can't afford cache!
options         MAX_KMAPENT=512 # this should be enough for us....
options         I386_CPU
options         I486_CPU
options         MATH_EMULATE
options         RTC_OFFSET=0
file-system     FFS
options         VNODE_OP_NOINLINE # Save space by not inlining vnode op calls
config          netbsd  root on ? type ?
mainbus0 at root
isa*    at mainbus?
npx0    at isa? port 0xf0 irq 13
pc0     at isa? port 0x60 irq 1         # pccons is much smaller than wscons!
com0    at isa? port 0x3f8 irq 4
com1    at isa? port 0x2f8 irq 3
com2    at isa? port 0x3e8 irq 5
wdc0    at isa? port 0x1f0 irq 14 flags 0x00
wdc1    at isa? port 0x170 irq 15 flags 0x00
wd*     at wdc? channel ? drive ? flags 0x0000
fdc0    at isa? port 0x3f0 irq 6 drq 2
fd*     at fdc? drive ?

							Greg A. Woods

+1 416 218-0098      VE3TCP      <>     <>
Planix, Inc. <>;   Secrets of the Weird <>