How to determine kernel module dependencies?

Hi gang!

Having discovered that setting up an NFS server inside a jail is quite the hassle I quickly decided against pursuing this (this is work related, thus I need to cut my time a bit short) and instead rely on Samba (smbfs) to provide filesystem access across the network. Ran into a little hiccup here as well (nmbd being initially unable to utilize the broadcast address) but right now all is solved and I can easily access my jail from another server using smbclient.

So far, so good.

Now I'm building smbfs.ko and initially noticed that it didn't got loaded during boot.

For the record; I did remember to add this to /boot/loader.conf:

Code:
smbfs_load="YES"

A quick study, and my first steps inside the loader prompt, learned me that it required a support module called libiconv.ko. So I rebuild the kernel, now including this module, and tried again. Now it turned out to require libmchain.ko as well.

I'm still at it, but in the mean time I also wonder how I could be able to determine these dependencies up front?

Edit: null edit
 
I found it.

Obviously you'll need to go over the source code for the module you're building, in my example that would be /usr/src/sys/fs/smbfs. Look for a call named MODULE_DEPEND(), this will give you a very good hint.

So, in my case I noticed the following in /usr/src/sys/fs/smbfs/smbfs_vfsops.c:

Code:
MODULE_DEPEND(smbfs, netsmb, NSMB_VERSION, NSMB_VERSION, NSMB_VERSION);
MODULE_DEPEND(smbfs, libiconv, 1, 1, 2);
MODULE_DEPEND(smbfs, libmchain, 1, 1, 1);
Note that we're not there yet!

I could trace both libiconv and libmchain back to their respective location in /usr/src/sys/modules, thus making these liable targets. But couldn't find netsmb so determined that this isn't a valid kernel module.

(that was the 'cool' version; the real story is that I tried adding it, got an error and then started looking and deducting ;)).
 
Back
Top