Subject: Re: Silly Kernel/Compiler Question
To: None <spectrum@rlion.com>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: port-mac68k
Date: 04/16/1996 10:27:56
> 
> Ok, ive now got several kernels to juggle around with to figure out
> which one is best to use... Question: IF i compile something with one
> kernel, will it run under the others? or do i need to recompile (or
> should I recompile) for each kernel that i want to use...
> 
> And does the active kernel name *have* to be /netbsd ? I was just
> telling the booter to boot the kernel i wanted to use
> "/netbsd.111895.GENERIC.fpe" for instance...

The answer to these questions is inter-related.

The kernel can be named anything for booting. It can even live on a
MacOS partition. The booter doesn't care.

The few programs which will need recompiling when you switch kernels
do care. The are (parial list; full one probably in the FAQ) ps,
netstat, ifconfig. I'm missing a few.

These programs have to look at what the kernel's doing to do their jobs.
they need to know where to look in the kernel to find what they want. So
they look in the kernel's on-disk file, find the symbol table (the name to
location mapping directory), figure out where they need to look, and
then look there in the live kernel. By default, they look in /netbsd
for the symbol table.

These programs are built with static libraries, they are self-contained
programs. One of these libraries (libkvm, the Kernel Virtual Memory
library) is the one which does the kernel name look-up, and it looks at
the current kernel source when it's being built (I think). So if things
change too much, it will not work.  So if there's a big change, libkvm
needs rebuilding. Then the programs with static libs (which include
the wrong libkvm) need relinking.

Confused? Probably. That explanation isn't the best (though accurate).

1) If the program in question doesn't use libkvm, then it won't need
recompiling when you change kernels. In fact, it will run on a mac68k,
sun3, amiga, and atari (all running netbsd)! Most programs will fit in
this category.

The only exception would be if things MASSIVELY change. Not likely.

2) programs which use libkvm will be a bit touchier. Certain kernel
changes will necessitate a new libkvm, and then these programs (ps.
ifconfig, netstat to name a few) will need recompiling. Also,
you'll need to install a new libkvm. Programs which dynamically load
libkvm will not need recompiling; they just load the current libkvm.

3) Small kernel changes will just require that /netbsd point to the
right kernel. A symlink will do (ln -s /netbsd.kernel.you.like /netbsd).

I'm not certain of the line between needing a new libkvm & not. If you
just update source for a driver (like a scsi fix, or a serial driver
fix), then you don't need a new libkvm. If you add a new driver or
two, then you probably need a new libkvm.

Take care,

Bill