Setting SYSDIR

Poking at the mt7620 wifi driver today, but I don't have a FreeBSD source tree in /usr/src. Trying to build spits out this message:

$ make
make: "/usr/share/mk/bsd.kmod.mk" line 12: Unable to locate the kernel source tree. Set SYSDIR to override.

Searching around, I could find others with this problem, mostly they had had forgotten to checkout a source tree into /usr/src . With a source tree in /home/user/code/freebsd I needed to set SYSDIR.

SYSDIR must point to the sys subdir in the FreeBSD source rather than the location of the whole tree(i.e. /usr/src). I modified my module Makefile list so:

SRCS=bus_if.h device_if.h opt_usb.h usbdevs.h if_run.c
KMOD=run_mt
SYSDIR=/home/user/code/freebsd/sys

.include <bsd.kmod.mk>

Reading: Babylon's Ashes, Cryptonomicon