Compiling and Loading

To compile a KLD, you can use the <bsd.kmod.mk> Makefile. Here is the complete Makefile for Example 1-1:

 KMOD=   hello
 SRCS=   hello.c

  .include <bsd.kmod.mk>

Here, KMOD is the KLD’s name and SRCS is the KLD’s source files. Incidentally, I’ll adapt this Makefile to compile every KLD.

Now, assuming Example 1-1 and its Makefile are in ...

Get FreeBSD Device Drivers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.