Solved Failure to configure kernel with statically link modules

I can successfully build a custom kernel (12.1 for a complete OPNsense build) and run it.

However, I'd like to create a monolithic kernel with the desired modules statically linked in. If I comment out the module names out of the loader.conf file, for instance:
if_tun_load="YES"
and put them in the KERNCONF file:
device if_tun
then the kernel configuration stage errors out with messages like
config: Error: device "if_tun" is unknown
With some modules, like carp, pf, and pflog, it doesn't have a problem. With others, like if_tun, if_lagg and if_tap, it throws errors.

So what files does the build for dynamic modules find that the build for static modules can't find? What do I need to do so that the kernel configuration succeeds?
 
On mine, I tried kldload if_tun, and got the message that it was already loaded in the kernel. I didn't mess with that option for compiling my kernel, nor preload it.

It might be tuntap in KERNCONF.

man if_tun gets me tun(4), which shows device tuntap. Then again, if_tun.ko and if_tuntap.ko are under /boot/kernel/.


Otherwise, when you kldload a module, it has to be seen which other modules show up as well for configuring in the kernel.
 
Thanks sidetone. That was it. For some modules the static and dynamic names are not the same! The man pages do indeed show the proper names for the two types. In my case there were 7 that didn't configure into the kernel because their static names differed from the dynamic names.
 
/usr/src/UPDATING:
Code:
20190507:
        The tap(4) driver has been folded into tun(4), and the module has been
        renamed to tuntap.  You should update any kld_list="if_tap" or
        kld_list="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or
        if_tun_load="YES" entries in /boot/loader.conf to load the if_tuntap
        module instead, and "device tap" or "device tun" entries in kernel
        config files to select the tuntap device instead.
 
In my kernel configuration file I replaced the "device tun" and "device tap" lines with "device tuntap". After doing that, the kernel configuration fails with
config: Error: device :tuntap" is unknown
I'm guessing that's because I'm running 12.1, which doesn't incorporate the change indicated in SirDice's post. The /usr/src/UPDATING file on my machine has no entry for 20190507.
 
Back
Top