Discussion:
Default KMODDIR
John Baldwin
2016-05-03 17:36:28 UTC
Permalink
I'd like to change KMODDIR's default from /boot/kernel to /boot/modules.
Kernel builds already set KMODDIR explicitly in sys/conf/kern.pre.mk, so
the only modules affected would be modules built standalone outside of a
kernel build. There are two cases to consider I think:

1) Someone has installed a custom kernel and finds they need module
'foo' that wasn't in their custom kernel. They might do:

# cd /sys/modules/foo
# make all install
# kldload foo

For myself, if I need this I find myself instead modifying my kernel
config to include the module in MODULES_OVERRIDE and then doing a
'make buildkernel && make reinstallkernel' as this will work after my
next source upgrade.

In this case, foo.ko would now end up in /boot/modules rather than
/boot/kernel. Note that if a user just does 'make load' instead of
'make install' then nothing changes.

2) A module lives outside of the tree (or a vendor wishes to ship a
newer version as a standalone module). All of these modules (including
all of the one in ports) currently have to override KMODDIR explicitly
in the module Makefile.

It is the 2) case I would like to make more seamless by changing the
default. This does change the behavior for 1) if someone is doing
'make install' rather than 'make load' from a module build directory.

Strawman diff:

Index: share/mk/bsd.own.mk
===================================================================
--- share/mk/bsd.own.mk (revision 298711)
+++ share/mk/bsd.own.mk (working copy)
@@ -49,7 +49,7 @@
#
#
# KMODDIR Base path for loadable kernel modules
-# (see kld(4)). [/boot/kernel]
+# (see kld(4)). [/boot/modules]
#
# KMODOWN Kernel and KLD owner. [${BINOWN}]
#
@@ -165,11 +165,7 @@
BINMODE?= 555
NOBINMODE?= 444

-.if defined(MODULES_WITH_WORLD)
KMODDIR?= /boot/modules
-.else
-KMODDIR?= /boot/kernel
-.endif
KMODOWN?= ${BINOWN}
KMODGRP?= ${BINGRP}
KMODMODE?= ${BINMODE}
--
John Baldwin
Glen Barber
2016-05-03 17:41:01 UTC
Permalink
Post by John Baldwin
I'd like to change KMODDIR's default from /boot/kernel to /boot/modules.
Kernel builds already set KMODDIR explicitly in sys/conf/kern.pre.mk, so
the only modules affected would be modules built standalone outside of a
1) Someone has installed a custom kernel and finds they need module
# cd /sys/modules/foo
# make all install
# kldload foo
For myself, if I need this I find myself instead modifying my kernel
config to include the module in MODULES_OVERRIDE and then doing a
'make buildkernel && make reinstallkernel' as this will work after my
next source upgrade.
In this case, foo.ko would now end up in /boot/modules rather than
/boot/kernel. Note that if a user just does 'make load' instead of
'make install' then nothing changes.
2) A module lives outside of the tree (or a vendor wishes to ship a
newer version as a standalone module). All of these modules (including
all of the one in ports) currently have to override KMODDIR explicitly
in the module Makefile.
It is the 2) case I would like to make more seamless by changing the
default. This does change the behavior for 1) if someone is doing
'make install' rather than 'make load' from a module build directory.
Index: share/mk/bsd.own.mk
===================================================================
--- share/mk/bsd.own.mk (revision 298711)
+++ share/mk/bsd.own.mk (working copy)
@@ -49,7 +49,7 @@
#
#
# KMODDIR Base path for loadable kernel modules
-# (see kld(4)). [/boot/kernel]
+# (see kld(4)). [/boot/modules]
#
# KMODOWN Kernel and KLD owner. [${BINOWN}]
#
@@ -165,11 +165,7 @@
BINMODE?= 555
NOBINMODE?= 444
-.if defined(MODULES_WITH_WORLD)
KMODDIR?= /boot/modules
-.else
-KMODDIR?= /boot/kernel
-.endif
KMODOWN?= ${BINOWN}
KMODGRP?= ${BINGRP}
KMODMODE?= ${BINMODE}
This seems like a good idea to me. I tend to do (1) quite often, and
sometimes forget what modules I had temporarily built for testing
something specific, and your proposal would be very helpful in finding
the modules I do not always want or need installed.

Glen
Benjamin Kaduk
2016-05-03 17:42:36 UTC
Permalink
Post by John Baldwin
I'd like to change KMODDIR's default from /boot/kernel to /boot/modules.
As someone claiming to maintain [but not doing a terribly good job at the
moment] and out-of-tree module, this seems like a good idea to me.

-Ben
olli hauer
2016-05-03 17:56:04 UTC
Permalink
Post by John Baldwin
I'd like to change KMODDIR's default from /boot/kernel to /boot/modules.
Kernel builds already set KMODDIR explicitly in sys/conf/kern.pre.mk, so
the only modules affected would be modules built standalone outside of a
1) Someone has installed a custom kernel and finds they need module
# cd /sys/modules/foo
# make all install
# kldload foo
For myself, if I need this I find myself instead modifying my kernel
config to include the module in MODULES_OVERRIDE and then doing a
'make buildkernel && make reinstallkernel' as this will work after my
next source upgrade.
In this case, foo.ko would now end up in /boot/modules rather than
/boot/kernel. Note that if a user just does 'make load' instead of
'make install' then nothing changes.
2) A module lives outside of the tree (or a vendor wishes to ship a
newer version as a standalone module). All of these modules (including
all of the one in ports) currently have to override KMODDIR explicitly
in the module Makefile.
It is the 2) case I would like to make more seamless by changing the
default. This does change the behavior for 1) if someone is doing
'make install' rather than 'make load' from a module build directory.
...

Not totally sure about, but isn't /boot/modules used by third party drivers like original VMware and others?

Will be there any impacts for this third party modules during kernel upgrades, like renaming modules to module.old?
--
olli
John Baldwin
2016-05-03 18:16:48 UTC
Permalink
Post by olli hauer
Post by John Baldwin
I'd like to change KMODDIR's default from /boot/kernel to /boot/modules.
Kernel builds already set KMODDIR explicitly in sys/conf/kern.pre.mk, so
the only modules affected would be modules built standalone outside of a
1) Someone has installed a custom kernel and finds they need module
# cd /sys/modules/foo
# make all install
# kldload foo
For myself, if I need this I find myself instead modifying my kernel
config to include the module in MODULES_OVERRIDE and then doing a
'make buildkernel && make reinstallkernel' as this will work after my
next source upgrade.
In this case, foo.ko would now end up in /boot/modules rather than
/boot/kernel. Note that if a user just does 'make load' instead of
'make install' then nothing changes.
2) A module lives outside of the tree (or a vendor wishes to ship a
newer version as a standalone module). All of these modules (including
all of the one in ports) currently have to override KMODDIR explicitly
in the module Makefile.
It is the 2) case I would like to make more seamless by changing the
default. This does change the behavior for 1) if someone is doing
'make install' rather than 'make load' from a module build directory.
...
Not totally sure about, but isn't /boot/modules used by third party drivers like original VMware and others?
Will be there any impacts for this third party modules during kernel upgrades, like renaming modules to module.old?
No, kernel upgrades don't touch /boot/modules at all. Right now third
party drivers have to explicitly set KMODDIR. This would mean they no
longer have to do that as building a module "standalone" would now DTRT
out of the box when installing.
--
John Baldwin
olli hauer
2016-05-03 18:37:53 UTC
Permalink
Post by John Baldwin
Post by olli hauer
Post by John Baldwin
I'd like to change KMODDIR's default from /boot/kernel to /boot/modules.
Kernel builds already set KMODDIR explicitly in sys/conf/kern.pre.mk, so
the only modules affected would be modules built standalone outside of a
1) Someone has installed a custom kernel and finds they need module
# cd /sys/modules/foo
# make all install
# kldload foo
For myself, if I need this I find myself instead modifying my kernel
config to include the module in MODULES_OVERRIDE and then doing a
'make buildkernel && make reinstallkernel' as this will work after my
next source upgrade.
In this case, foo.ko would now end up in /boot/modules rather than
/boot/kernel. Note that if a user just does 'make load' instead of
'make install' then nothing changes.
2) A module lives outside of the tree (or a vendor wishes to ship a
newer version as a standalone module). All of these modules (including
all of the one in ports) currently have to override KMODDIR explicitly
in the module Makefile.
It is the 2) case I would like to make more seamless by changing the
default. This does change the behavior for 1) if someone is doing
'make install' rather than 'make load' from a module build directory.
...
Not totally sure about, but isn't /boot/modules used by third party drivers like original VMware and others?
Will be there any impacts for this third party modules during kernel upgrades, like renaming modules to module.old?
No, kernel upgrades don't touch /boot/modules at all. Right now third
party drivers have to explicitly set KMODDIR. This would mean they no
longer have to do that as building a module "standalone" would now DTRT
out of the box when installing.
Thanks for clarification!
--
olli
Loading...