Date: Tue, 15 Nov 2005 22:20:01 -0500 From: "Yong Ma" <mayong@mail.com> To: freebsd-drivers@freebsd.org Cc: freebsd-hackers@freebsd.org Subject: Re: How to make my new driver be configurable in the kernel configuration file? Message-ID: <20051116032001.7C66D1CE30A@ws1-6.us4.outblaze.com>
next in thread | raw e-mail | index | archive | help
----- Original Message ----- From: "John Baldwin" <jhb@freebsd.org> To: freebsd-drivers@freebsd.org Subject: Re: How to make my new driver be configurable in the kernel config= uration file? Date: Tue, 15 Nov 2005 10:21:59 -0500 >=20 > On Tuesday 15 November 2005 03:59 am, Yong Ma wrote: > > Hi all, > > I wrote and debuged my driver for a new device in KLD mode,now I want to > > plug it into the kernel,so that it can be loaded when the system boots= ,and > > make it be configurable in the kernel configuration file like other dev= ice > > driver as "device XXX",I don't know what to do,could anyone be kind to = help > > me? >=20 > To add your driver you update the src/sys/conf/files* files. If your dri= ver > is machine independent, you can add it to src/sys/conf/files. For exampl= e, > here are the lines in sys/conf/files for the cy(4) driver: >=20 > dev/cy/cy.c optional cy > dev/cy/cy_isa.c optional cy isa > dev/cy/cy_pci.c optional cy pci >=20 > If your driver only works on a single architecture (such as i386) then ad= d it > to the architecture file sys/conf/files.<arch> (e.g. sys/conf/files.i386). > The device names after 'optional' specify which devices must be enabled in > the kernel config for that file to be included. Thus, in the example abo= ve, > src/sys/dev/cy/cy.c is included as long as 'device cy' is in the kernel, = but > src/sys/dev/cy/cy_isa.c is only included if both 'device cy' and 'device = isa' > are in the kernel config file. >=20 > -- > John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ > "Power Users Use the Power to Serve" =3D http://www.FreeBSD.org Thank you! I did as that but came across some problems,these are the jobs a= nd the errors: 1) I copyed the files to the sys/dev/mydevice and added "dev/mydevice/myde= vice.c optinonal mydevice" in the file /usr/src/sys/conf/files.i386,and a= dded a line "device mydevice" in the sys/i386/conf/MYKERNEL(a copy of GENER= IC),but met a error when config MYKERNEL:syntax error (the line I just adde= d). 2) Then,I modified line in files.i386 as "dev/mydevice/mydevice.c standa= rd",configed successfully,but another error occured when make depend(make b= uildkernel KERNCONF=3DMYKERNEL the same): ... ../../../dev/mydevice/mydevice.c:27:20: mydevice.h: No such file or di= rectory ../../../dev/mydevice/mydevice.c:28:44: mydevicekern.h: No such file o= r directory ../../../dev/mydevice/mydevice.c:29:49: mydeviceioctl.h: No such file = or directory mkdep: compile failed *** Error code 1 ... and the source code of mydevice.c is as follows: ... #include "sjy22b.h" #include "sjy22bkern.h"=20=20 #include "sjy22bioctl.h"=20 ... the three headers are just in the sys/dev/mydevice directory,I don't know w= hy this happened. Need your suggestion! Thanks Yong --=20 ___________________________________________________ Play 100s of games for FREE! http://games.mail.com/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051116032001.7C66D1CE30A>