[Wlug] kernel driver vs module
John Stoffel
john at stoffel.org
Mon Jul 10 13:17:14 EDT 2006
Mike> I understand a kernel driver, is a driver that Linus, et al,
Mike> have coded into the kernel, so if i have a peice of hardware,
Mike> and I compile a kernel with that device's driver turned on, then
Mike> my device will work.
Mike> If i build that kernel driver as a module, the driver remains
Mike> outside the kernel, but still availible for use. As a module I
Mike> can rmmod or insmod when i need to use the device.
You're mixing up two different things. Almost all drivers which are
shipped with the linux kernel can be compiled in one of two ways: into
the kernel, or as a module which can be loaded/unloaded at run-time.
So if you have a driver and compile it into the kernel, you should see
some output from 'dmesg' showing you what was deteced on bootup of the
kernel.
Mike> My foggy'ness comes from a few things.
Mike> 1. if the driver is built into the kernel, will it show up in lsmod?
No, because lsmod only shows loaded modules, not modules which are
available for loading. It also doesn't show up drivers which are
compiled into the kernel directly.
Mike> 2. if the driver does not show up in lsmod, how do i know if
Mike> its loaded?
Check the output of the 'dmesg' command after a full reboot with your
driver. You should at least see something about that driver, whether
or not it detects any devices.
Mike> 3. weather it's a built in driver or a module, how do i
Mike> associate the driver (or module) with a particular device?
It depends on the driver, but generally they go by PCI device ID to
determine which hardware they can access.
Mike> 4. if the device does not have a driver in the kernel, I cannot
Mike> build a custom kernel to include it, nor can I build it as a
Mike> module from the kernel source. So:
This makes no sense here. Of course you can build a custom kernel
with a driver shipped outside of the normal linux kernel.
Mike> 5. if I get the driver from the vendor, it will build a module
Mike> for me, based on my kernel-source or kernel-headers??? Then
Mike> what? again, see #3: how do i associate the module with my
Mike> device?
If you are given vendor provided driver, you can have several issues
to address here. One, it needs to match your running kernel image if
it's a completely binary only module. Not a great idea in my book.
If there is a binary core, but an source code wrapper section, then
you'll need to compile the module against the installed kernel's
headers. Not hard, the vendor should go into all these details.
Mike> This is a general linux quandry, but this time i have a debian
Mike> stable install and have inserted a QLogic HBA. lsmod does show
Mike> qla2xxx, but it doesn't seem to be functioning as it isn't
Mike> logging into the fiber switch.
Check the output of 'dmesg' and see what it says. You might need to
check the logs on the switch as well to make sure that you're allowing
the system holding the adapter is bringing it online and that the
switch is seeing it try to login.
Feel free to post details and such here, the more the better!
John
More information about the Wlug
mailing list