Solved How to force device to be a module when make kernel

chrbr

Aspiring Daemon

Reaction score: 243
Messages: 676

Dear community,
I have a custom kernel for which I like to have wlan just in rare cases. In the kernel configuration I have
Code:
 % grep wlan MYKERNEL
device       wlan           # 802.11 support
device       wlan_wep       # 802.11 WEP support
device       wlan_ccmp       # 802.11 CCMP support
device       wlan_tkip       # 802.11 TKIP support
device       wlan_amrr       # AMRR transmit rate control algorithm
All they appear directly in the kernel as shown by
Code:
% kldstat -v
Id Refs Address            Size     Name
 1   35 0xffffffff80200000 fd9108   kernel (/boot/kernel/kernel)
        Contains modules:
                Id Name
                241 if_lo
...
                248 wlan_wep
                247 wlan_tkip
                246 wlan_ccmp
                245 wlan_amrr
                251 wlan_sta
                250 wlan_ratectl_none
                249 wlan
with additional items. Is it possible to relocate the wlan things to modules which are not directly added to the kernel but can be loaded at demand manually?

Kind regards,
Christoph
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,879
Messages: 31,151

Everything is always built as a module, so there's no need to force anything. The only thing the kernel config does is to take some of the modules and link them into the kernel. If you want them to be modules, leave them out of the kernel config.
 

kpa

Beastie's Twin

Reaction score: 1,810
Messages: 6,318

Some of those modules are autoloaded if they are not statically linked into the kernel, the autoloading is usually triggered by a devd(8) event.
 
OP
OP
chrbr

chrbr

Aspiring Daemon

Reaction score: 243
Messages: 676

Dear SirDice, dear kpa,
thank you for the clarification. Since it is so simple I do not wonder anymore why my search did not found any answer of any similar question. Now I also have hopefully a better understanding in the meaning of the two options
Code:
MODULES_OVERRIDE = linux acpi
WITHOUT_MODULES = linux acpi sound
as described in https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-building.html. Before your answer I thought is is almost similar as deactivating an option out in the kernel configuration file. Now I think that only this configuration really takes them out of the build process.

Thank you again for all your kind help,
Christoph
 
Top