how to compile and install a new driver

Roland Smith rsmith at
Tue Nov 27 15:49:31 PST 2007

On Tue, Nov 27, 2007 at 03:28:53PM -0700, Steve Franks wrote:
> > 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? 

A lot (but not all) of the device drivers and sybsystems are available
as modules. If you look into the example kernel configuration files
(GENERIC, NOTES), everything that starts with 'options' has to be
compiled into the kernel. Lines starting with 'device' in GENERIC are
built into the kernel. All other drivers are by default available as
modules. (but you can disable them from building, if you want)

> I always
> thought it was some monolithic binary somewhere. 

That depends on your definition of monolithic. The FreeBSD kernel is
modular but not a microkernel.

> If not, is it
> possible to build just usbdevs alone?

Yes, it should be possible. But I've never done it. It is not advised
to build stuff in the source tree. The 'make kernel' process builds a
shadow tree for the object files under /usr/obj, but I don't know how to
do that for a single module.

> I'm a little skittish about fubaring the kernel on my family's main
> server. 

Well, if you're using the GENERIC kernel now, and you build a new
GENERIC kernel, it should Just Work. Life can get interesting when you
start building your own kernel config. :-)

But when I switched from 6-STABLE to 7-BETA, I got decent warnings to
adapt my kernel config instead of a broken kernel, so that's ok.

And FYI, the previous kernel is saved in /boot/kernel.old/kernel. So you can
always boot that.

> 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. 

First and foremost: get level 0 dumps of all important partitions before
you start your adventure! I cannot stress this enough! USB external
harddisks are great for that purpose. 

> 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.

Read the Handbook and /usr/src/UPDATING. Ask around here if there's
something you don't get.

> > > 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).

man send-pr
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list