On Debian and derivatives (Ubuntu, Mint, elementary, …), modules listed in /etc/modules
(one per line, and you can specify arguments) are loaded at boot time.
On systemd-based systems, modules listed in /etc/modules-load.d/*.conf
(one per line) are loaded at boot time.
However you don't normally need to load a module explicitly. For most hardware, Linux will automatically detect the hardware and load the appropriate module. Linux finds the right module through a database stored in /lib/modules/VERSION/modules.alias
which is populated from declarations in the module's source code. This answer explains the full process.
Put the .ko
file that you compiled somewhere under /lib/modules/VERSION/
(you need to do that anyway to get modprobe
to find it) and run depmod -a
as root. This will update the modules.aliases
database. After that, the module will be loaded automatically during startup, when the kernel detects the hardware (or rather when the module loading process starts, since the hardware is detected early during boot time).
If your hardware is also supported by a module that's provided by your distribution, but the distribution's driver is buggy, then I don't think there's an easy way to force one of the modules to be used. In this case, you should add the module you compiled to /etc/modules
and blacklist the standard module by adding a line blacklist MODULE_NAME
to /etc/modprobe.conf
.