Adding a new kernel module?

Szilveszter Adam sziszi at bsd.hu
Thu Jan 8 10:48:59 PST 2009


Hello Barney,

On Thu, Jan 08, 2009 at 09:08:07AM -0800, Barney Cordoba wrote:
> I'm testing  a new kernel module that needs to be compiled in, and everything works fine except that make doesn't make the module for the new driver. The driver is under dev
> 
> /sys/dev/foo
> 
> How does the kernel make system decide what modules to build? How can I add a new kernel modules to the build system to get it to build the new module automatically?

This is quite easy. You should make a new directory under sys/modules
with the module name, prepare a Makefile there (you can use one of the
many existing ones in the other module directories as example). This
Makefile should contain all files that your driver uses, and any
specific flags that are used for compilation. Again, you will find many
simple and more complicated examples among the existing modules. After
this, you should add the new subdir to the Makefile in sys/modules (the
order is alphabetical now, but you can add it anywhere). 

I believe that's all.

Hope this helps.
-- 
Regards:

Szilveszter ADAM
Budapest
Hungary


More information about the freebsd-current mailing list