Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Oct 1999 10:36:51 +0200
From:      Jeroen Ruigrok/Asmodai <asmodai@wxs.nl>
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>
In-Reply-To: <85256803.0076AFC5.00@d54mta07.raleigh.ibm.com>
References:  <85256803.0076AFC5.00@d54mta07.raleigh.ibm.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <http://home.wxs.nl/~asmodai>;
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991008103651.R11071>