Date: Tue, 27 Nov 2007 18:29:33 -0500 From: Chuck Robey <chuckr@chuckr.org> To: Warren Block <wblock@wonkity.com> Cc: Steve Franks <stevefranks@ieee.org>, User Questions <freebsd-questions@freebsd.org> Subject: Re: how to compile and install a new driver Message-ID: <474CA85D.6080501@chuckr.org> In-Reply-To: <20071127151259.H27150@wonkity.com> References: <539c60b90711271248o6eb0b9fw757e40fbcdfdb3c2@mail.gmail.com> <20071127151259.H27150@wonkity.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Warren Block wrote: > On Tue, 27 Nov 2007, Steve Franks wrote: > >> 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? > > It's a file produced by diff(1), which shows the differences between > files. Normally, the difference is between the old files and what > someone has changed or added. Also called a patch file, since you use > patch(1) to apply it. patch(1) goes through the diff file and makes all > the changes shown. > Nice description, but you'd better include enough info so that they could make FreeBSD-stype diffs: diff has the unfortunate default of making an output that is compatible with ed(1). This supplies extremely little information to use, in case the file you're trying to patch with that diff has changed, and is also damned hard for mere humans to understand. There are two other options you can give to diff that change the format: -c gives "context" diffs, and -u gives "unified" diffs, and the -u is the option that is standard with FreeBSD. How you do this is to copy the file you intend to change BEFORE you edit the chantes in to "somefile.orig", and then, when you perform the diff, you must give the .orig file first, else you will produce a file that tries to remove the patch instead of applying the patch, like this: diff -u somefile.c.orig somefile.c >patchfile diffs have a standard header on them, and (although it seems that this isn't a FreeBSD standard) you can easily enter in freeform comments before your patch's header, describing the reasons for this patch to be applied (whatever condition this patch fixes). To tell you the truth, that idea of sticking comments at the top of patch files, I got from the crosscompiler site, and it's a great idea, it's how they set up their patches, and we should use it. > In this case, the diff file has changes to several files. > > Looks like it applies to /usr/src/sys. After untarring the file, and as > root: > > # cd /usr/src/sys > # patch < ucp-0.01.diff > > *If* the patch applies successfully, then you can compile. Easiest > would probably be to just rebuild the kernel. Slow, but you know it'll > get everything. > >> (2) Assuming I can get it to compile, which I've never done, what do I >> do with the object/driver file? > > Probably like other ucom(4) devices: > > kldload ucp > > and then access the serial port through /dev/cuaU0. > >> 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. > > That is a good case for a PR. Particularly when you've got a patch, at > least as a starting point. > > -Warren Block * Rapid City, South Dakota USA > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?474CA85D.6080501>