Add support for "local" modules. By default, these modules are located
in LOCALBASE/sys/modules (where LOCALBASE defaults to /usr/local).
Individual modules can be built along with a kernel by defining
LOCAL_MODULES to the list of modules. Each is assumed to be a subdirectory
containing a valid Makefile. If LOCAL_MODULES is not specified, all of
the modules present in LOCALBASE/sys/modules are built and installed along
with the kernel.
This means that a port that installs a kernel module can choose to install
its source along with a suitable Makefile to /usr/local/sys/modules/<foo>.
Future kernel builds will then include that kernel module using the
kernel configuration's opt_*.h headers and install it into /boot/kernel
along with other kernel-specific modules.
This is not trying to solve the issue of folks running GENERIC release
kernels, but is instead aimed at folks who build their own kernels.
For those folks this ensures that kernel modules from ports will always
be using the right KBI, etc. This includes folks running any KBI-breaking
kernel configs (such as PAE).
This is an initial strawman. I know there are other ideas kicking around,
but I think that /boot/modules is stuck with hosting "generic" modules
that are supposed to work with different possible kernels. I think if
we adopt this approach for any kernels that aren't GENERIC, we can
relegate /boot/modules to just holding pre-built objects that work with
GENERIC. We might also consider always compiling kernel modules as a
post-install step when possible even for GENERIC release kernels, but
that is outside the scope of this change. (One issue with always
recompiling is that not all systems have a kernel source tree installed.)