From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 16 16:38:08 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 B3AAD16A41F; Wed, 16 Nov 2005 16:38:08 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A40343D4C; Wed, 16 Nov 2005 16:38:08 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.3/8.13.3) with ESMTP id jAGGa8rb053516; Wed, 16 Nov 2005 09:36:08 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 16 Nov 2005 09:36:11 -0700 (MST) Message-Id: <20051116.093611.06948893.imp@bsdimp.com> To: jhb@freebsd.org From: "M. Warner Losh" In-Reply-To: <200511161128.26191.jhb@freebsd.org> References: <20051116103310.20B9A164A49@ws1-4.us4.outblaze.com> <200511161128.26191.jhb@freebsd.org> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Wed, 16 Nov 2005 09:36:08 -0700 (MST) Cc: freebsd-hackers@freebsd.org, freebsd-drivers@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:38:09 -0000 In message: <200511161128.26191.jhb@freebsd.org> John Baldwin writes: : On Wednesday 16 November 2005 05:33 am, Yong Ma wrote: : > ----- Original Message ----- : > From: "Warner Losh" : > To: jhb@freebsd.org : > Subject: Re: How to make my new driver be configurable in the kernel : > configuration file? Date: Tue, 15 Nov 2005 09:19:09 -0700 (MST) : > : > > From: John Baldwin : > > Subject: Re: How to make my new driver be configurable in the : > > kernel configuration file? : > > Date: Tue, 15 Nov 2005 10:21:59 -0500 : > > : > > > 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 device driver as "device XXX",I don't know what to : > > > > do,could anyone be kind to help me? : > > > : > > > To add your driver you update the src/sys/conf/files* files. If : > > > your driver is machine independent, you can add it to : > > > src/sys/conf/files. For example, here are the lines in : > > > 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) : > > > then add it to the architecture file sys/conf/files. (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 above, 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. : > > : > > You can augment the system files with the files directive if you don't : > > want to edit sys/conf/files.foo: : > > : > > files "/foo/bar/baz" : > > : > > and put something like the above in that. : > > : > > Warner : > > : > > _______________________________________________ : > > 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 : > jobs and the errors: : > : > 1) I copyed the files to the sys/dev/mydevice and added : > "dev/mydevice/mydevice.c optinonal mydevice" in the file : > /usr/src/sys/conf/files.i386,and added a line "device mydevice" in : > the sys/i386/conf/MYKERNEL(a copy of GENERIC),but met a error when : > config MYKERNEL:syntax error (the line I just added). : > : > 2) Then,I modified line in files.i386 as "dev/mydevice/mydevice.c : > standard",configed successfully,but another error occured when make : > depend(make buildkernel KERNCONF=MYKERNEL the same): : > ... : > ../../../dev/mydevice/mydevice.c:27:20: mydevice.h: No such : > file or directory : > ../../../dev/mydevice/mydevice.c:28:44: mydevicekern.h: No such : > file or 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" : > #include "sjy22bioctl.h" : > ... : > the three headers are just in the sys/dev/mydevice directory,I don't : > know why this happened. : > Need your suggestion! : : You'll need to include them as "dev/mydevice/mydevice.h" rather than : "mydevice.h" Usually that's spelled '#include ' since it is relative to one of the -I paths. In practice, however, it rarely makes a difference. Warner