From owner-freebsd-drivers@FreeBSD.ORG Sat Sep 17 18:03:01 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3F40B16A41F for ; Sat, 17 Sep 2005 18:03:01 +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 D52DA43D48 for ; Sat, 17 Sep 2005 18:03:00 +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 j8HI0HVY092389; Sat, 17 Sep 2005 12:00:17 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 17 Sep 2005 12:00:27 -0600 (MDT) Message-Id: <20050917.120027.32524785.imp@bsdimp.com> To: ttw@cobbled.net From: "M. Warner Losh" In-Reply-To: <20050917173941.GJ6440@eyore.cobbled.net> References: <20050917173941.GJ6440@eyore.cobbled.net> 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]); Sat, 17 Sep 2005 12:00:17 -0600 (MDT) Cc: freebsd-drivers@freebsd.org Subject: Re: basic driver build environment X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 18:03:01 -0000 In message: <20050917173941.GJ6440@eyore.cobbled.net> n0g0013 writes: : trying to write a PCI driver and finding it awkward to build it : outside the source tree. : : will i have to wire in the new driver "sys" source tree to get a : clean edit/build environment? : : currently i'm doing two things : : 1. merging my current kernel build directory with my : new driver directory and building there. it produces a : module but leaves a hell of a mess. the module reboots the : system currently (no crash -- just reboot) but that may be : something else. : : 2. getting a copy of CVS so i can wire into tree when i : understand how : : if anyone could guide me on : : a. cleaner config for building modules in random : directory (thought '-I' to make would work but it doesn't) : : b. how to actually wire in a new driver to the "sys" : source tree (once i have a copy) : : i'd appreciate it. When I'm developing a new module, I do the following: setenv SYSDIR /path/to/freebsd/src/sys make The Makefile looks like # Maybe have a .PATH here KMOD= foo SRCS= foo_a foo_b .include At work, we wrap setting SYSDIR in an include file, since our build system knows about it. As for building a kernel with the driver in it, I'll leave that to others. We haven't built modules into the kernel on FreeBSD since 2.2.8. Warner