how to compile and install a new driver

Steve Franks stevefranks at
Tue Nov 27 14:29:02 PST 2007

On Nov 27, 2007 3:11 PM, Roland Smith <rsmith at> wrote:
> On Tue, Nov 27, 2007 at 01:48:28PM -0700, Steve Franks wrote:
> > Hi,
> >
> > I found this thread
> >
> > to a driver I need for my system.
> >
> > (1) The file extension
> > ( is .diff, not .c, so
> > what exactly do I do with it to compile it?
> First, use gunzip to extract it. This will leave a file ucp-0.01.diff.
> Next, su to root and cd to /usr/src/sys.
> To apply the patch, do 'patch </location/of/ucp-0.01.diff'
> Note that the patch doesn't apply cleanly (/usr/src/sys/dev/usb/usbdevs)
> on 7.0-BETA2. If that's also the case on the version you're using,
> you'll have to look at /usr/src/sys/dev/usb/usbdevs.orig and
> /usr/src/sys/dev/usb/usbdevs.rej to fix it manually.

I'm on 6.2 at the moment.

> Next, build and install a kernel according to the handbook. ('make
> kernel' in /usr/src)
> > (2) Assuming I can get it to compile, which I've never done, what do I
> > do with the object/driver file?
> The 'make kernel' command will install the module automagically.
> On the next boot, you should be able to load the ucp driver module with
> kldload(8).

So is the kernel the collection of all .ko modules then?  I always
thought it was some monolithic binary somewhere.  If not, is it
possible to build just usbdevs alone?  I'm a little skittish about
fubaring the kernel on my family's main server.  My name will be mud
if I bring it down for a significant period, and it's my only BSD box
at the moment - our data is backed up, but I don't have a tape drive I
can just pull / and /usr off in 5 minutes if I kill it.  I know this
is not relavant to the discussion, but my point is, I don't know
enough to know what's relatively safe and what isn't.

> > This driver is long overdue, the part has been in usb devices for
> > several years, and support is in OpenBSD and Linux already (so I'm
> > told by google).  I'll happily document the process if someone holds
> > my hand.
> If it works, submit a PR.

A url/handbook page for that, perhaps?  I understand the concept of a
PR, but not fbsd's specific system (or where to find it).

> Roland
> --
> R.F.Smith                         
> [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
> pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)

More information about the freebsd-questions mailing list