Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 09 Jan 2013 06:44:42 -0500
From:      Michael Powell <nightrecon@hotmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: installing a new device driver
Message-ID:  <kcjl78$5mk$1@ger.gmane.org>
References:  <1357726153.65344.YahooMailNeo@web160101.mail.bf1.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jack Mc Lauren wrote:

> Hi all
> Sorry I ask so much cause I'm a new user to freeBSD :)
> 
> Hear's the deal. How can I install a new device driver on my OS ? Please
> explain in details because of the reason I mentioned earlier :)
> 

First, please understand that FreeBSD is a mostly, self-contained operating 
system. Generally speaking the difference is in where the driver itself comes 
from. There are exceptions, as there are indeed some vendors who provide 
driver code to the project as third-party add ins, but much driver code is 
written by and contained within the project itself. This means that you will 
not go willy-nilly surfing all over the web downloading drivers to install.

If you have the source code for the OS installed (it was an option during 
install) you might want to look at a kernel configuration file for a basic 
idea on how drivers 'relate' in FreeBSD. On an i386 system there will be a 
path /usr/src/sys/i386/conf/, and on a 64 bit install  the kernel config 
file will be located under /usr/src/sys/amd64/conf. On a brand new machine 
with no custom kernel you will see a file under these location(s) called 
simply GENERIC. This is the kernel configuration file for the OS as 
distributed and until one generates and compiles their own custom kernel it 
will be what you are running.

Notice lines within the file that begin with 'options' and 'device'. The 
lines you see that start with 'device' are device driver(s) that are built 
into the kernel itself. There is such a wide variety in the GERNERIC kernel 
because it ships as designed to be ready to operate on a plethora of 
differenet hardware. Many people will build a custom kernel that strips out 
all of these that they do not need.

So what if you strip out something that you do need does that mean that you 
have to build a new kernel all over again? Quite possibly not, as FreeBSD 
also has something called 'kernel modules' as well. If you look in 
/boot/kernel you will notice a lot of files that end in a ".so" extension. 
These are kernel modules (think 'drivers' here - it is pretty much the same 
idea). You can load and unload these kernel modules while a system is 
running using kldload and kldunload commands. The command kldstat will 
inform you about ones that are loaded and active.

The thing you need to know is you can't kldload a kernel module if that 
corresponding function is already built-in and present in the running 
kernel. Example: a kernel config file with 'device em' means the driver is 
already compiled into the kernel and you will receive an error should you 
attempt to kldload the if_em.ko kernel module.

Just to expand a little for some quick grokage....    :-)

-Mike
	





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?kcjl78$5mk$1>