how to compile and install a new driver

Steve Franks stevefranks at ieee.org
Mon Dec 24 13:02:44 PST 2007


On Nov 27, 2007 3:11 PM, Roland Smith <rsmith at xs4all.nl> wrote:
> On Tue, Nov 27, 2007 at 01:48:28PM -0700, Steve Franks wrote:
> > Hi,
> >
> > I found this thread
> > http://lists.freebsd.org/pipermail/freebsd-stable/2006-August/027445.html
> > to a driver I need for my system.
> >
> > (1) The file extension
> > (http://www.dons.net.au/~darius/ucp-0.01.diff.gz) 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.
>
> 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).
>
> > 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.
It doesn't.  From the directory structure and filenames, "ucp" appears
to be nearly identical to "ucom", and the src/sys/modules/ucp/Makefile
is identical to the one for ucom (except it points to ucp.c instead of
ucom.c, of course), but I still get:

cd /usr/src/sys/modules;
MAKEOBJDIRPREFIX=/usr/obj/usr/src/sys/GENERIC/modules
KMODDIR=/boot/kernel MODULES_OVERRIDE="ucp" DEBUG_FLAGS="-g"
MACHINE=amd64 KERNBUILDDIR="/usr/obj/usr/src/sys/GENERIC" make  depend
"/usr/src/share/mk/bsd.subdir.mk", line 84: warning: duplicate script
for target "files" ignored
"/usr/src/share/mk/bsd.subdir.mk", line 84: warning: duplicate script
for target "includes" ignored
@ -> /usr/src/sys
machine -> /usr/src/sys/amd64/include
make: don't know how to make ucp.c. Stop
*** Error code 2

Stop in /usr/obj/usr/src/sys/GENERIC.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.

Thanks,
Steve


More information about the freebsd-questions mailing list