View Single Post
  #1   (View Single Post)  
Old 24th August 2009
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default Change for rc.lkm

An lkm is a loadable kernel module. These usually reside in /usr/lkm. For exmaple, the lkm pf.o must be loaded to use packet filter with the GENERIC kernel (without recompiling).

Generally, lkm's are loaded with modload(8). If you want modules automatically loaded at boot-time, they should be listed in /etc/lkm.conf. In lkm.conf(5) you specify for each module various parameters, such as modload options -d and -v, any postinstall script, and when in the boot process it should load.

Finally, the boot-time script /etc/rc.lkm checks lkm.conf and loads the modules requested there. Now to the point of all this . modload has an important flag -A kernel, which is used to resolve module references. The default kernel is "/netbsd", but if you're running a different kernel image and don't use the -A flag this could lead to a crash.

The problem is, I don't see a way to pass the "-A kernel" into the existing structure described above. In fact, ISTM it ought to be built-in by changing rc.lkm in a small way: replace

Code:
modload $flags $path
with something like

Code:
modload -A /$(/sbin/sysctl -n machdep.booted_kernel) $flags $path
This would put the running kernel filename into the modload command for each lkm to be loaded by rc.lkm.

Does this seem ok, or did I miss something?
Reply With Quote