As of Linux kernel 5 and above, you can compile a generic module and then load it with multiple instances. This section guides on on how to perform such loading.
You first need to create a .conf
file and then place it into /etc/modprobe.d
. Inside this script, you describe your custom modules. You can do the following works.
You can create multiple module instances using the alias
and options
definition. By default they are:
alias
- nickname your module against a kernel module.options
- adding parameters to an alias/module that defines its specialty.Here is the syntax:
# This is a comment
alias <yourModName> moduleName
options <yourModName> param1=value1 param2=value2 ...
Here is an example of creating audio loopback named mysoft-aloop
:
# mysoft audio loopback to create 4 channels audio output
alias mysoft-aloop snd-aloop
options mysoft-aloop index=2 pcm_substreams=4 id=mysoft-aloop
You can also blacklist a module, preventing it from loading. However, module can still be loaded if it is a dependency or loaded manually. To fully blacklist a module, you need to use install
keyword to override the loading results and ultimately denied the module codes from actually loaded.
Here is the syntax:
blacklist <someBadModName>
install <yourModName> /bin/true
Here is an example of blacklisting a test module named test-samura
:
blacklist test-samura
install test-samura /bin/true
That's all for configuring modules in operating system.