I am currently writing a FreeBSD device driver and find myself lugging around the entire
src. As you can imagine, this is quite large, especially if you are using any sort of version tracking system. So following the example here, I extracted out:
However, when I ran
make(1) in the
/home/user/src/rtwn/sys/modules/rtwn, I received an error saying:
make: don't know how to make r92c_attach.c. Stop
This error message is extremely non-descriptive of the actual issue. After reviewing the aforementioned functioning
Makefiles, I identified that the
SYSDIR were not set correctly.
SRCTOP is the equivalent of
/usr/src. If your src directory differs from /usr/src, such as
$HOME/src/freebsd12src, you would set SYSDIR to
SYSDIR is similar. Ordinarily it would be
/usr/src/sys, but now it might be
This can be resolved two ways:
- Command-line over-ride. I am doing this:
For me, that would be:
make SRCTOP=$HOME/src/freebsd12src/ SYSDIR=$HOME/src/freebsd12/sys/ -C sys/modules/rtwn load.
- Permanent method: Edit the Makefile in question, in my case sys/modules/rtwn/Makefile.
And of course, you have to have at least one correct src directory in order to compile a kernel object. This is pretty simple, but it confused me for a while. Hope this helps! Keep writing that BSD code!