Subject: Kernel config file caveat
To: None <gadams@avernus.com>
From: Gordon W. Ross <gwr@mc.com>
List: port-sun3
Date: 04/20/1995 12:07:25
> From: Geoff Adams <gadams@avernus.com>
> Date: Thu, 20 Apr 1995 02:52:34 -0400

> I've just determined that it's dangerous not to set the option GENERIC
> if you do 'config netbsd swap generic' in your kernel config file.
> This seems broken by my set of assumptions, which are that for generic
> kernels you specify 'options GENERIC,' and for a kernel for a machine
> named, say, spatula, you specify 'options SPATULA.'
[...]
> So, the problem, as I understand it, is that if we use swapgeneric.c,
> instead of a created swap%s.c, we need to call the function
> swapgeneric() within it.  How can we know at comnpile time whether to
> call that function?  At the moment, the solution seems to be to use
> #ifdef GENERIC, and make the requirement that the user specify
> 
> options         GENERIC
> 
> if and only if swap is set up like
> 
> config          netbsd swap generic

Right.  The current implementation requires "option GENERIC" iff the
swap config line uses generic.  (As you pointed out, swapgeneric.c
should initialize the mountroot variable so it won't fault. 8-)

Does this implementation prevent you from doing what you want?
I'm not sure I understand what configuration you are trying for.

> Thinking about it some more, I've come up with the question:  What
> happens if you've set your root/swap/dump device to be sd0 in the
> kernel config file, and you then boot from what ends up at autoconf
> time to be, say, sd2?  And, of course, the PROM can hand us off a
> boot device name that doesn't match our concept of the world,
> because we might map SCSI IDs to sd#s differently.

The current implementation assumes that you really mean it if you
specify something other than generic, and will never change it.

> Is there any way that makes sense to move the code in swapgeneric(),
> which grabs the root/swap/dump devices from the PROM or from user
> input, into the autoconf.c?  That could solve some of these problems.

Is there a problem with using the GENERIC configuration?
It lets you have root and swap anywhere you want, in any
combination (including "root on nfs" and "swap on sd0b").

Gordon