Subject: Re: More config changes, for ro source tree and disjoint build trees
To: None <>
From: Mike Long <>
List: tech-kern
Date: 08/16/1996 19:33:57
>Date: Tue, 13 Aug 1996 21:50:30 +0200 (MET DST)
>From: Ignatios Souvatzis <>
>   Date: Tue, 13 Aug 96 10:54:57 EDT
>   From: Mike Long <>

>   You could solve the LKM #ifdef problem and the supported-options
>   problem at the same time:
>   1) Options for which LKMs exist, and other "supported" options, are
>   declared in /sys/.../files* .  Part of the declaration is a variable
>   name, e.g. compat_freebsd for the COMPAT_FREEBSD option.
>   2) Config generates an options.c file in the kernel build directory
>   which defines a variable for each supported option.  The variable is
>   nonzero if the option is requested in the user's kernel config file:
>   int	compat_freebsd	= 1;
>   If the option is not requested, the flag is set to zero.  Unsupported
>   options (e.g. driver debug options) end up in IDENT as usual.
>   options.c is (obviously) compiled into the kernel.
>   3) Replace #ifdefs for supported options with flag checks:
>   #ifdef COMPAT_FREEBSD		if (compat_freebsd) {
>   ...			->	...
>   #endif				}
>I hope you are aware that options are used at the moment to define
>which of two console fonts are compiled into NetBSD/amiga kernel
>#ifdef KFONT_8X11
>u_int8_t kf8x11data[] = { ...};
>in one place and
>#ifdef KFNOT_8x11
>#define fontdata kf8x11data
>in another. Any better method for similar stuff which 
>which fits with your proposal?

I'm not all that familar with the Amiga port, but I'll give it a
shot.  After looking at Amiga sources and thinking a bit, I see a
problem.  The quick conversion would look something like:

u_int_t *fontdata;

/* in the kernel's main(): */
if (kfont_8x11)
	fontdata = &kf8x11data;

Unfortunately, the linker would dislike my use of &.  What you need is
some way of knowing which font tables have been built into the kernel;
the only way to do that is either #ifdefs, which leave us back where
we started; or a function to replace that & which looks up symbols in
the kernel symbol table.  DDB has such a function, but DDB is
optional.  I don't know how difficult it would be to genericize DDB's
symbol management routines so that the LKM system could use them.

Remember, I did leave you the option of leaving it in IDENT. :-)
Mike Long <>     <URL:>
VLSI Design Engineer         finger for PGP public key
Analog Devices, CPD Division          CCBF225E7D3F7ECB2C8F7ABB15D9BE7B
Norwood, MA 02062 USA       (eq (opinion 'ADI) (opinion 'mike)) -> nil