Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Sep 2005 12:00:27 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        ttw@cobbled.net
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: basic driver build environment
Message-ID:  <20050917.120027.32524785.imp@bsdimp.com>
In-Reply-To: <20050917173941.GJ6440@eyore.cobbled.net>
References:  <20050917173941.GJ6440@eyore.cobbled.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20050917173941.GJ6440@eyore.cobbled.net>
            n0g0013 <ttw@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050917.120027.32524785.imp>