Permit local kernel modules to be built as part of a kernel build.
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). There are still some kinks to be worked out with cross-building (we probably shouldn't include local modules in cross-built kernels by default), but this is a sufficient starting point. Reviewed by: imp MFC after: 3 months Relnotes: yes Differential Revision: https://reviews.freebsd.org/D16966
This commit is contained in:
parent
25c9cca757
commit
cd785c1b34
@ -35,15 +35,34 @@ KERN_DEBUGDIR?= ${DEBUGDIR}
|
||||
|
||||
.MAIN: all
|
||||
|
||||
.if !defined(NO_MODULES)
|
||||
# Default prefix used for modules installed from ports
|
||||
LOCALBASE?= /usr/local
|
||||
|
||||
LOCAL_MODULES_DIR?= ${LOCALBASE}/sys/modules
|
||||
|
||||
# Default to installing all modules installed by ports unless overridden
|
||||
# by the user.
|
||||
.if !defined(LOCAL_MODULES)
|
||||
LOCAL_MODULES!= ls ${LOCAL_MODULES_DIR}
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.for target in all clean cleandepend cleandir clobber depend install \
|
||||
${_obj} reinstall tags
|
||||
${target}: kernel-${target}
|
||||
.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules)
|
||||
.if !defined(NO_MODULES)
|
||||
${target}: modules-${target}
|
||||
modules-${target}:
|
||||
.if !defined(MODULES_WITH_WORLD) && exists($S/modules)
|
||||
cd $S/modules; ${MKMODULESENV} ${MAKE} \
|
||||
${target:S/^reinstall$/install/:S/^clobber$/cleandir/}
|
||||
.endif
|
||||
.for module in ${LOCAL_MODULES}
|
||||
cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} ${MAKE} \
|
||||
${target:S/^reinstall$/install/:S/^clobber$/cleandir/}
|
||||
.endfor
|
||||
.endif
|
||||
.endfor
|
||||
|
||||
# Handle ports (as defined by the user) that build kernel modules
|
||||
@ -51,8 +70,6 @@ modules-${target}:
|
||||
#
|
||||
# The ports tree needs some environment variables defined to match the new kernel
|
||||
#
|
||||
# Ports search for some dependencies in PATH, so add the location of the installed files
|
||||
LOCALBASE?= /usr/local
|
||||
# SRC_BASE is how the ports tree refers to the location of the base source files
|
||||
.if !defined(SRC_BASE)
|
||||
SRC_BASE= ${SYSDIR:H:tA}
|
||||
@ -64,6 +81,9 @@ OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
|
||||
${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h
|
||||
.endif
|
||||
# Keep the related ports builds in the obj directory so that they are only rebuilt once per kernel build
|
||||
#
|
||||
# Ports search for some dependencies in PATH, so add the location of the
|
||||
# installed files
|
||||
WRKDIRPREFIX?= ${.OBJDIR}
|
||||
PORTSMODULESENV=\
|
||||
env \
|
||||
@ -110,7 +130,7 @@ kernel-clobber:
|
||||
|
||||
kernel-obj:
|
||||
|
||||
.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules)
|
||||
.if !defined(NO_MODULES)
|
||||
modules: modules-all
|
||||
|
||||
.if !defined(NO_MODULES_OBJ)
|
||||
|
Loading…
Reference in New Issue
Block a user