From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 16 16:03:41 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C743016A41F for ; Wed, 16 Nov 2005 16:03:41 +0000 (GMT) (envelope-from mayong@mail.com) Received: from webmail-outgoing.us4.outblaze.com (webmail-outgoing2.us4.outblaze.com [205.158.62.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 17EDE43D45 for ; Wed, 16 Nov 2005 16:03:41 +0000 (GMT) (envelope-from mayong@mail.com) Received: from unknown (unknown [192.168.9.180]) by webmail-outgoing.us4.outblaze.com (Postfix) with QMQP id B09AA1800232 for ; Wed, 16 Nov 2005 16:03:40 +0000 (GMT) X-OB-Received: from unknown (205.158.62.50) by wfilter.us4.outblaze.com; 16 Nov 2005 10:33:10 -0000 Received: by ws1-4.us4.outblaze.com (Postfix, from userid 1001) id 20B9A164A49; Wed, 16 Nov 2005 10:33:10 +0000 (GMT) Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 From: "Yong Ma" To: freebsd-drivers@freebsd.org Date: Wed, 16 Nov 2005 05:33:09 -0500 Received: from [159.226.5.225] by ws1-4.us4.outblaze.com with http for mayong@mail.com; Wed, 16 Nov 2005 05:33:09 -0500 X-Originating-Ip: 159.226.5.225 X-Originating-Server: ws1-4.us4.outblaze.com Message-Id: <20051116103310.20B9A164A49@ws1-4.us4.outblaze.com> Cc: freebsd-hackers@freebsd.org Subject: Re: How to make my new driver be configurable in the kernel configuration file? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2005 16:03:42 -0000 ----- Original Message ----- From: "Warner Losh" To: jhb@freebsd.org Subject: Re: How to make my new driver be configurable in the kernel config= uration file? Date: Tue, 15 Nov 2005 09:19:09 -0700 (MST) >=20 > From: John Baldwin > Subject: Re: How to make my new driver be configurable in the=20 > kernel configuration 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 boo= ts,and > > > make it be configurable in the kernel configuration file like other d= evice > > > driver as "device XXX",I don't know what to do,could anyone be kind t= o help > > > me? > > > > To add your driver you update the src/sys/conf/files* files. If=20 > > your driver is machine independent, you can add it to=20 > > src/sys/conf/files. For example, here are the lines in=20 > > sys/conf/files for the cy(4) driver: > > > > dev/cy/cy.c optional cy > > dev/cy/cy_isa.c optional cy isa > > dev/cy/cy_pci.c optional cy pci > > > > If your driver only works on a single architecture (such as i386)=20 > > then add it to the architecture file sys/conf/files. (e.g.=20 > > sys/conf/files.i386). The device names after 'optional' specify=20 > > which devices must be enabled in the kernel config for that file=20 > > to be included. Thus, in the example above, src/sys/dev/cy/cy.c=20 > > is included as long as 'device cy' is in the kernel, but=20 > > src/sys/dev/cy/cy_isa.c is only included if both 'device cy' and=20 > > 'device isa' are in the kernel config file. >=20 > You can augment the system files with the files directive if you don't > want to edit sys/conf/files.foo: >=20 > files "/foo/bar/baz" >=20 > and put something like the above in that. >=20 > Warner >=20 > _______________________________________________ > freebsd-drivers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers > To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org" Thank you! I did as that but came across some problems,these are the=20 jobs and the errors: 1) I copyed the files to the sys/dev/mydevice and added=20 "dev/mydevice/mydevice.c optinonal mydevice" in the file=20 /usr/src/sys/conf/files.i386,and added a line "device mydevice" in=20 the sys/i386/conf/MYKERNEL(a copy of GENERIC),but met a error when=20 config MYKERNEL:syntax error (the line I just added). 2) Then,I modified line in files.i386 as "dev/mydevice/mydevice.c=20=20= =20 standard",configed successfully,but another error occured when make=20 depend(make buildkernel KERNCONF=3DMYKERNEL the same): ... ../../../dev/mydevice/mydevice.c:27:20: mydevice.h: No such=20 file or directory ../../../dev/mydevice/mydevice.c:28:44: mydevicekern.h: No such=20 file or directory ../../../dev/mydevice/mydevice.c:29:49: mydeviceioctl.h: No=20 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" #include "sjy22bioctl.h" ... the three headers are just in the sys/dev/mydevice directory,I don't=20 know why this happened. Need your suggestion! Thanks Yong --=20 ___________________________________________________ Play 100s of games for FREE! http://games.mail.com/