Subject: Re: writing a device driver
To: None <gat7634@hotmail.com>
From: maximum entropy <entropy@tappedin.com>
List: tech-kern
Date: 04/15/2002 23:27:31
>From: "Gary Thorpe" <gat7634@hotmail.com>
>Date: Mon, 15 Apr 2002 23:06:26 -0400
>
>I have begun writing a new devie driver for the netbsd kernel. I am at a 
>stage where I want to compile in the current code I have to see whether or 
>not the probe and attach functions work before going further.
>
>I added my files to the kernel source and modified the file 
>/usr/src/MYTREE/conf/files, /usr/src/MYTREE/arch/i386/i386/conf.c, and 
>/usr/src/MYTREE/dev/isa/files.isa to add lines for the machine independent 
>code, added the device to the port-specific cdevsw table, and added lines 
>for ISA bus attach code (MYTREE is a recursive copy of the kernel source 
>tree, since I do not want to mess with the tree for working kernels for my 
>machine). When I attempt to build a kernel, I get the following message:
>
>ioconf.o: undefined reference for xxx_ca (where xxx is the name of the new 
>device)

You need to define this in your driver.  It will probably look
something like this:

struct cfattach xxx_ca = {
       sizeof(struct xxx_softc), xxxprobe, xxxattach
};

This structure then gets placed in the cfdata array by config(8), so
the kernel will know how to probe and attach your driver.

Cheers,
entropy

--
entropy -- it's not just a good idea, it's the second law.