You are not logged in.

#1 2011-05-31 03:10:38

xiaq
Member
From: somewhere in China...
Registered: 2011-03-06
Posts: 88

Relationship between firmware, driver and kernel module?

I have got my rtl8192se wireless card up and working, and was trying to set up when I ran into the first problem stated at https://wiki.archlinux.org/index.php/WP … leshooting.

Trying to figure out how the driver works, three words often came up: firmware, driver and kernel module. I know a bit of them: firmware usually refers to the software residing in the ROM of some hardware device; driver is the layer between the kernel and the hardware; while kernel module is a piece of kernel that can be loaded dynamically, and not necessarily related to a specific hardware device (like firmware and driver). But what confuses me is the relationship between the three concepts when dealing with hardware devices. Could anyone shed some light on this?

And another more specific question: I found a package named "rtl8192se_firmware" in AUR, and I have installed it before. But shouldn't firmware reside in the hardware? What's the "firmware software" thing, exactly?

Offline

#2 2011-05-31 03:55:15

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 13,793

Re: Relationship between firmware, driver and kernel module?

In my mind, "Driver" and "Kernel Module" are synonymous.  In reality, a Driver should probably be considered to be a Kernel Module that is directly responsible for controlling hardware.  Other kernel modules provide information on how to manage file systems, encryption, loop back file systems, etc...  Whereas "driver"  kernel modules handle network interfaces, usb devices, keyboards, etc... These would be the special case of a kernel module called driver.

Firmware is software that is uploaded to a microprocessor or programmable logic on the hardware device itself.  Examples of hardware that use firmware are HP printers that receive their code from the USB port at power up, wireless network interfaces that upload firmware at start up, routers that can update themselves from the internet, etc...   In general, the ability to upload firmware to a device is a plus.  it allows for product improvements to be added after the initial sale.  These include fixing bugs in the product, responding to security issues, or responding to changes in the regulatory environment; Examples: FCC opening or restricting allowable bandwidths, power consumption, safety.

So, being very general: A driver is a kernel module that talks to hardware; firmware is software that runs on the hardware that talks to the driver.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
You assume people are rational and influenced by evidence.  You must not work with the public much. -- Trilby
----
How to Ask Questions the Smart Way

Offline

#3 2011-05-31 04:14:41

xiaq
Member
From: somewhere in China...
Registered: 2011-03-06
Posts: 88

Re: Relationship between firmware, driver and kernel module?

Thanks for the explanation. But still questions:

What about the software package rtl8192se-firmware? Does the .bin files get uploaded to my wireless card every time the system boots? That doesn't sound like the case. Firmware should be in the hardware's ROM, but this package is clearly software living on the hard drive. What's the relationship between this package and the firmware?

% pacman -Ql rtl8192se-firmware
rtl8192se-firmware /lib/
rtl8192se-firmware /lib/firmware/
rtl8192se-firmware /lib/firmware/RTL8192SE/
rtl8192se-firmware /lib/firmware/RTL8192SE/rtl8192sfw.bin
rtl8192se-firmware /lib/firmware/RTL8192SE/rtl8192sfw492.bin
rtl8192se-firmware /lib/firmware/RTL8192SE/rtl8192sfw74.bin
rtl8192se-firmware /usr/
rtl8192se-firmware /usr/share/
rtl8192se-firmware /usr/share/licenses/
rtl8192se-firmware /usr/share/licenses/rtl8192se-firmware/
rtl8192se-firmware /usr/share/licenses/rtl8192se-firmware/LICENSE

And... quoted from "man lspci":

       -k     Show kernel drivers handling each device and also kernel modules capa‐
              ble of handling it.  Turned on by default when -v is given in the nor‐
              mal mode of output.  (Currently works only on Linux with kernel 2.6 or
              newer.)

Running "lspci -s05:00 -k" (05:00 being the bus of the rtl8192 card) shows that there is a difference indeed:

% lspci -s05:00 -k
05:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8191SEvB Wireless LAN Controller (rev 10)
        Subsystem: Realtek Semiconductor Co., Ltd. Device e020
        Kernel driver in use: rtl819xSE
        Kernel modules: r8192se_pci

Investigating /lib/modules shows:

% find /lib/modules -name '*819*'
/lib/modules/2.6.38-ARCH/kernel/drivers/staging/rtl8192u
/lib/modules/2.6.38-ARCH/kernel/drivers/staging/rtl8192u/r8192u_usb.ko.gz
/lib/modules/2.6.38-ARCH/kernel/drivers/staging/rtl8192e
/lib/modules/2.6.38-ARCH/kernel/drivers/staging/rtl8192e/r8192e_pci.ko.gz
/lib/modules/2.6.38-ARCH/kernel/drivers/media/video/bt819.ko.gz
/lib/modules/2.6.38-ARCH/kernel/drivers/net/wireless/r8192se_pci.ko
/lib/modules/2.6.38-ARCH/kernel/drivers/net/wireless/rtlwifi/rtl8192ce
/lib/modules/2.6.38-ARCH/kernel/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko.gz

There is no "rtl819xSE". Does the module "provides" the driver?

Offline

#4 2011-05-31 05:38:06

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 13,793

Re: Relationship between firmware, driver and kernel module?

Firmware does not have to live in ROM.  Devices can be RAM based with a small ROM based boot loader to load the firmware at start up.  The device could also be FPGA based that is configured to start from a data stream that does not come from a configuration ROM


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
You assume people are rational and influenced by evidence.  You must not work with the public much. -- Trilby
----
How to Ask Questions the Smart Way

Offline

#5 2011-05-31 06:29:29

xiaq
Member
From: somewhere in China...
Registered: 2011-03-06
Posts: 88

Re: Relationship between firmware, driver and kernel module?

ewaller wrote:

Firmware does not have to live in ROM.  Devices can be RAM based with a small ROM based boot loader to load the firmware at start up.  The device could also be FPGA based that is configured to start from a data stream that does not come from a configuration ROM

Thanks a lot for the clarification. What about the relationship between module and driver, then? Since in my case the names of the module ("r8192se_pci") and driver ("rtl819xSE") differ, I doubt whether there is a simple one-to-one relationship between modules (I'm aware that some modules don't provide drivers; I'm only talking about those that do) and drivers. Is it possible that a kernel module may provide several drivers, or several modules together provide a driver?

Offline

#6 2011-06-01 02:56:40

ConnorBehan
Trusted User (TU)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,356
Website

Re: Relationship between firmware, driver and kernel module?

Good question! It appears that driver names do not have to be module names. To use my ethernet port I load the module e100 and "lspci -k" tells me that the driver in use is also called e100. But for my soundcard, the kernel module is snd-cs46xx whereas the driver in use has the pretty name "Sound Fusion CS46xx"!

I think the list of modules has nothing to do with whether they are in use. If there are several in the list, some could be modules that simply claim to have support for that hardware. For example aty128fb appears as a kernel module for my r128 graphics card, but it's not the driver in use since I'm not running a framebuffer console on it. And for some reason the DRM driver is not in that list.


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

#7 2011-06-01 11:22:45

lukaszan
Member
Registered: 2011-05-05
Posts: 117

Re: Relationship between firmware, driver and kernel module?

Driver and Module are not synonymous. Driver doesn't have to be a Module, and vice versa.

As someone said, Driver is a piece of code responsoble for talking to a device. It can be either built in the kernel, or compiled as a Module and loaded at runtime, hence the difference in the name. Module name is for the kernel and it can (but doesn't have to) provide a Driver (with whatever the name).

Thanx for bringing that subject up anyway. I always wondered what firmware was...

Offline

Board footer

Powered by FluxBB