basic driver build environment
M. Warner Losh
imp at bsdimp.com
Sat Sep 17 11:03:01 PDT 2005
In message: <20050917173941.GJ6440 at eyore.cobbled.net>
n0g0013 <ttw at cobbled.net> writes:
: trying to write a PCI driver and finding it awkward to build it
: outside the source tree.
:
: will i have to wire in the new driver "sys" source tree to get a
: clean edit/build environment?
:
: currently i'm doing two things
:
: 1. merging my current kernel build directory with my
: new driver directory and building there. it produces a
: module but leaves a hell of a mess. the module reboots the
: system currently (no crash -- just reboot) but that may be
: something else.
:
: 2. getting a copy of CVS so i can wire into tree when i
: understand how
:
: if anyone could guide me on
:
: a. cleaner config for building modules in random
: directory (thought '-I' to make would work but it doesn't)
:
: b. how to actually wire in a new driver to the "sys"
: source tree (once i have a copy)
:
: i'd appreciate it.
When I'm developing a new module, I do the following:
setenv SYSDIR /path/to/freebsd/src/sys
make
The Makefile looks like
# Maybe have a .PATH here
KMOD= foo
SRCS= foo_a foo_b
.include <bsd.kmod.mk>
At work, we wrap setting SYSDIR in an include file, since our build
system knows about it.
As for building a kernel with the driver in it, I'll leave that to
others. We haven't built modules into the kernel on FreeBSD since
2.2.8.
Warner
More information about the freebsd-drivers
mailing list