From owner-freebsd-current@FreeBSD.ORG Wed Aug 30 23:36:56 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C6A5C16A4DD for ; Wed, 30 Aug 2006 23:36:56 +0000 (UTC) (envelope-from davidch@broadcom.com) Received: from MMS3.broadcom.com (mms3.broadcom.com [216.31.210.19]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CAC643D49 for ; Wed, 30 Aug 2006 23:36:56 +0000 (GMT) (envelope-from davidch@broadcom.com) Received: from 10.10.64.154 by MMS3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.2.2)); Wed, 30 Aug 2006 16:36:46 -0700 X-Server-Uuid: 450F6D01-B290-425C-84F8-E170B39A25C9 Received: by mail-irva-10.broadcom.com (Postfix, from userid 47) id 507782AF; Wed, 30 Aug 2006 16:36:46 -0700 (PDT) Received: from mail-irva-8.broadcom.com (mail-irva-8 [10.10.64.221]) by mail-irva-10.broadcom.com (Postfix) with ESMTP id 2EE112AE; Wed, 30 Aug 2006 16:36:46 -0700 (PDT) Received: from mail-irva-12.broadcom.com (mail-irva-12.broadcom.com [10.10.64.146]) by mail-irva-8.broadcom.com (MOS 3.7.5a-GA) with ESMTP id EEB11184; Wed, 30 Aug 2006 16:36:45 -0700 (PDT) Received: from NT-IRVA-0750.brcm.ad.broadcom.com (nt-irva-0750 [10.8.194.64]) by mail-irva-12.broadcom.com (Postfix) with ESMTP id AA5AB69CA4; Wed, 30 Aug 2006 16:36:45 -0700 (PDT) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Date: Wed, 30 Aug 2006 16:36:45 -0700 Message-ID: <09BFF2FA5EAB4A45B6655E151BBDD90301E2F2C1@NT-IRVA-0750.brcm.ad.broadcom.com> In-Reply-To: <989384AE-60BB-4A37-B240-02DE1CEE4E4C@lassitu.de> Thread-Topic: Simplified Steps for Building a Loadable module on -CURRENT Thread-Index: AcbMg1+9BlmtM2brQ1ahBjfHtVVJIQACBTdA From: "David Christensen" To: "Stefan Bethke" X-TMWD-Spam-Summary: TS=20060830233650; SEV=2.0.2; DFV=A2006083012; IFV=2.0.4,4.0-8; RPD=4.00.0004; ENG=IBF; RPDID=303030312E30413031303230352E34344636314643392E303032462D412D; CAT=NONE; CON=NONE X-MMS-Spam-Filter-ID: A2006083012_4.00.0004_4.0-8 X-WSS-ID: 68E8FE8422G3284327-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org Subject: RE: Simplified Steps for Building a Loadable module on -CURRENT X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Aug 2006 23:36:57 -0000 > > I've been able to successfully build drivers in the past as > > loadable modules but I'm getting some kernel panics with -CURRENT > > when installing a module using kldload now where things used to > > work before. >=20 > You did nuke /usr/obj, performed a full kernel build (cd /usr/src; =20 > make buildkernel installkernel), and the module in question that was =20 > installed alongside your new kernel is *not* panicking the system? Yes >=20 > Then what's the panic message, and how exactly are you building your =20 > module? >=20 The message wasn't readable on the serial console. The text was jumbled and I could only make out bits and pieces of it. > > Assume I'm a complete FreeBSD noob for a moment > > (which really isn't that far from the truth) and I want to build > > a driver as a loadable module for testing. After moving to > > the appropriate directory in the source tree (/usr/src/sys/dev/XXX), > > what steps do I need to follow to build the driver as a module? >=20 > That would be /usr/src/sys/modules/ >=20 > So far, just running make there has worked for me just fine. >=20 Ah, there's the simple piece I was missing! I had previously created my own Makefile and placed it in the /usr/src/sys/dev/XXX directory. > > Assume for the moment that I have already commented the driver out > > of my kernel configuration file > > (/usr/src/sys//conf/GENERIC) > > and rebuilt and installed that kernel. >=20 > If the driver has been compiled into the kernel, kldload will error =20 > out with EEXISTS. If the system panics, you should provide specifics. >=20 So I should do the following: 1) Comment out the driver I want to test in the kernel configuration file. For example, modify /usr/src/sys/amd64/conf/MYCONFIG. 2) Rebuild and install the kernel (cd /usr/src; make kernel KERNCONF=3DMYCONFIG) 3) Reboot the system to start using the new kernel 4) Edit the driver in /usr/src/sys/dev/XXX as necessary 5) Build the kernel module (cd /usr/src/sys/modules/XXX; make) 6) Load the kernel module (kldload ./if_XXX) and cross my fingers.