KLD Load - depends on kernel - not avail. or version mismatch

I'm developing a device driver kld module to be hooked up to the FreeBSD system. Using a very simple default "hello" driver found below, I'm trying to kld load the module. However I'm getting the error:

Code:
KLD hello.ko: depends on kernel - not available or version mismatch
linker_load_file: Unsupported file type

Code:
#include <sys/paramh.>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/systm.h>

static int hello_modevent(module_t mod __unused, int event, void *arg __unused)
{
          int error = 0;

          switch(event) {
          case MOD_LOAD:
                  uprintf("Hello,World!\n");
                  break;
          case MOD_UNLOAD:
                  uprintf("Good-bye, cruel World!\n");
                  break;
          default:
                  error = EOPNOTSUPP;
                  break;
          }
       
          return(error);
}

static moduledata_t hello_mod = {
          "hello",
          hello_modevent,
          NULL
};

DECLARE_MODULE(hello,hello_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);

Browsing online I have found hints that it might be related to the file header param.h not being the same version as the kern.osreldate, and sure enough the __FreeBSD_version in the param.h was 1100101 while the kern.osreldate was 1100500. I tried changing this value in param.h but to no avail.

Further info:
uname -a:
Code:
11.0-PRERELEASE FreeBSD 11.0-PRERELEASE #14 R304256M root@FreeBSD_Test:/usr/obj/usr/home/driver1/source/11/sys/GENERIC amd64
(The directory /source/11 contains the source files from which I often compile and install a modified kernel).

As for dmesg, the error displayed is the exact same two lines specified above, with no further details.

What should I do at this point? Where to go from here?
 
Build the module against the exact same version of the source as your system.
 
Apparently the source you have is not the same version as your system.
 
Not just the kernel, make sure the rest of the world is updated too. That part will, for example, install the correct include files.
 
Back
Top