From owner-freebsd-questions Fri Oct 8 1:36: 3 1999 Delivered-To: freebsd-questions@freebsd.org Received: from smtp03.wxs.nl (smtp03.wxs.nl [195.121.6.37]) by hub.freebsd.org (Postfix) with ESMTP id C148615414 for ; Fri, 8 Oct 1999 01:35:59 -0700 (PDT) (envelope-from asmodai@wxs.nl) Received: from daemon.ninth-circle.org ([195.121.196.53]) by smtp03.wxs.nl (Netscape Messaging Server 3.61) with ESMTP id AAA4F; Fri, 8 Oct 1999 10:35:56 +0200 Received: (from asmodai@localhost) by daemon.ninth-circle.org (8.9.3/8.9.3) id KAA22008; Fri, 8 Oct 1999 10:36:52 +0200 (CEST) (envelope-from asmodai) Date: Fri, 8 Oct 1999 10:36:51 +0200 From: Jeroen Ruigrok/Asmodai To: ravikm@us.ibm.com Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Loadable drivers in FreeBSD and NetBSD Message-ID: <19991008103651.R11071@daemon.ninth-circle.org> References: <85256803.0076AFC5.00@d54mta07.raleigh.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3i In-Reply-To: <85256803.0076AFC5.00@d54mta07.raleigh.ibm.com> Organisation: Ninth-Circle Enterprises Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On [19991008 00:00], ravikm@us.ibm.com (ravikm@us.ibm.com) wrote: >We are trying to see if we can convert the drivers in our NetBSD >implementation into loadable drivers so that we can reduce the size of >the kernel. I know that in Linux, we can achieve this by adding the >entry and exit points - init_module() and cleanup_module(), and adding >the MODULE flag to the compiles for the driver code. Then we should be >able to add and remove them dynamically using the commands "insmod" and >"rmmod". Linux drivers overcomplicate the problem by requiring module code in every single driver, thus bloating and obfuscating the code. >How does it work on the NetBSD and FreeBSD. Do we need to add the same >routines in the drivers and compile them with the MODULE flag? Also, >would the kernel then not have these drivers statically linked? >Is the dynamic loadability feature supported in the NetBSD 1.4/1.5 kernels? Thank god, not at all =) We write a driver, add DRIVER_MODULE() to the main .c of a driver and then add the appropriate stuff to /usr/src/sys/modules At least that's what I do for the NIC driver I am writing. I cannot answer the NetBSD questions. Please re-ask those on the appropriate NetBSD list, since I have no idea. >Can these drivers be hot-loaded at runtime, or do they need to be >explicitly loaded using some commands such as "insmod" or so. They can be hot-loaded at boottime, but they can also be loaded in the fly by kldload and kldunload. -- Jeroen Ruigrok van der Werven/Asmodai asmodai(at)wxs.nl The BSD Programmer's Documentation Project Network/Security Specialist BSD: Technical excellence at its best Whispering winds in moonlit wood, a totem oak once golden stood... To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message