Solved Make driver in FreeBSD 13.0 - svn sources

Hello!

I'm new on FreeBSD, i'm trying to create the "skeleton" driver and run it.

I just create the "skeleton.c" and the "Makefile". When i run "make" it appear:
Unable to locate the kernel source tree. Set SYSDIR to override.
After google it, i found this thread: Thread 49779.
But i can't find the source of the 13.0 version, it doesn't seem to be here: https://svn0.eu.freebsd.org/base/releng/

How can I download the sources to compile a kernel module?

Thanks!
Best Regards.

Solution: (thanks to all!)

  1. Install git: pkg install git-lite
  2. checkout the 13.0 source: git clone -b releng/13.0 --depth 1 https://git.freebsd.org/src.git /usr/src
 
Last edited:
Thank you otis! Now "make" produces the output: skeleton.ko.

Now I want to load the skeleton example, so i tried to load it into the kernel by typing:
kldload -v ./skeleton.ko

But I receive:
Code:
KLD skeleton.ko depends on kernel - not available or version mismatch 
linker_load_file: ./skeleton.ko - unsupported file type
kldload: an error occurred while loading module ./skeleton.ko. Please check dmesg(8) for more tedails.
dmesg have the message:
Code:
KLD skeleton.ko: depends on kernel - not available or version mismatch
linker_load_file: ./skeleton.koo - unsupported file type

Is something changed in version 13? Should I move "skeleton.ko" in a specific path?

Thanks!
Best Regards.
 

SirDice

Administrator
Staff member
Administrator
Moderator
You've built your kernel module with the wrong version of the source tree. I'm betting you checked out main which is 14.0-CURRENT, you need to checkout the releng/13.0 branch for 13.0-RELEASE.
 
Top