KMODDIR needs to be fixed [was: Re: [QAT] r332657: 4x leftovers]

René Ladan rene at freebsd.org
Mon Nov 4 09:23:10 UTC 2013


On 04-11-2013 08:46, Bernhard Fröhlich wrote:
>
>
> Am 04.11.2013 02:20 schrieb "Ports-QAT" <qat at redports.org
> <mailto:qat at redports.org>>:
> >
> > Explicitly set KMODDIR to /boot/modules to avoid picking up /boot/kernel
> > as KMODDIR from /usr/share/mk/bsd.own.mk <http://bsd.own.mk>
> included by the distribution
> > Makefile.
>
Which would have to be repeated for every port using kmod ... instead I
suggest this:

@@ -23,6 +23,9 @@
 
 SSP_UNSAFE=    kernel module does not support SSP
 
+.if ${KMODDIR} == "/boot/kernel"
+KMODDIR=       /boot/modules
+.endif
 KMODDIR?=      /boot/modules
 PLIST_SUB+=    KMODDIR="${KMODDIR:C,^/,,}"
 MAKE_ENV+=     KMODDIR="${KMODDIR}" SYSDIR="${SRC_BASE}/sys"

> Yeah I have noticed the same problem with vbox some months ago when I
> tried to support overriding KMODDIR. This would be needed by some
> jails that have a read only /boot.
> I think we should fix this properly now that we have you new
> USES=kernsrc. We can either introduce a new variable PORTSKMODDIR or
> we hack/fix bsd.own.mk <http://bsd.own.mk>.
>
The above patch wouldn't fix the "leftover" /boot/kernel directory, but
it does fix upgrading the kernel while ports have files installed into
the default location. Installing into /boot/kernel would break ports
when the kernel gets upgraded because the current kernel directory gets
renamed to /boot/kernel.old

For PORTSKMODDIR all ports using kmod need to be updated?

Hacking bsd.own.mk feels wrong, it only defines variables. There is
already a MODULES_WITH_WORLD knob which sets the default modules
directory to /boot/modules, but the include order prevents setting that
in Uses/kmod.mk (hence the explicit override above). The other
disadvantage is that this would create another dependency on the OS version.

René



More information about the freebsd-ports mailing list