How does wifi module get it's firmware?
May 21, 2008 —
BarryK
The usual place for firmware is /lib/firmware, and when a wireless module loads, if it needs some firmware it grabs it from that location, or in some cases elsewhere.
However, what I am unclear on is the precise reasoning the module goes through to locate and load that firmware.
Up until now, Puppy has the 'hotplug' package, as the original reason given was that it is needed for modules to be able to load their firmware.
However, I have been looking at this package and I really cannot see why that is so.
Surely, when a module loads, it knows the default location where it's firmware is, and it just goes ahead and loads it? Or is that thinking to idealistic?
Comments
Simple as CATUsername: Ted Dog
http://linux-hotplug.sourceforge.net/?selected=setup I looked into this piece of linux magic glue when getting my DVB drivers working, it needed to load its firmware code, and your default 2.16 kernel was not loading it correctly. It appears the real magic is a simple cat or echo command that shoves the firmware into the correct /proc or /sys slot. Once I forced the correct file into the correct slot all worked well. It appears the firmware for most devices is referenced in those cryptic text files under /lib/modules and the kernel will attempt to due that for you first, then drop into /sbin/hotplug if an error was returned, so a wiser programs can load tricky firmware.
Simple as CP
Username: Ted Dog
"Here is the magic...from /etc/hotplug/firmware.agent echo 1 > $SYSFS/$DEVPATH/loading cp "$FIRMWARE_DIR/$FIRMWARE" $SYSFS/$DEVPATH/data echo 0 > $SYSFS/$DEVPATH/loading First echo preps the devices standard firmware 'loading' function to accept the firmware. the cp copies the possible firmware to the devices standard data object. the last echo notifies the device its done loading its firmware.
Simple as CP
Username: Ted Dog
"Here is the magic...from /etc/hotplug/firmware.agent echo 1 > $SYSFS/$DEVPATH/loading cp "$FIRMWARE_DIR/$FIRMWARE" $SYSFS/$DEVPATH/data echo 0 > $SYSFS/$DEVPATH/loading First echo preps the devices standard firmware 'loading' function to accept the firmware. the cp copies the possible firmware to the devices standard data object. the last echo notifies the device its done loading its firmware.
Re: hotplug
Username: BarryK
"[i]the kernel will attempt to due that for you first, then drop into /sbin/hotplug if an error was returned[/i] Ah, so perhaps it will happen automatically anyway, without the hotlug scripts (or udev), in most cases? The kernel has CONGIG_FW_LOADER=y.
Firmware loading: becoming clear
Username: BarryK
"Ok, I'm getting somewhere. Rob Landley, the same guy who provided the skeleton C program that I have used for reading kernel uevents, has also explained how firmware loading works: http://lwn.net/Articles/242046/ I appreciate Rob's efforts to document this. He has been trying to get answers from the kernel uevent/udev developers -- see his comment about his email being blocked. Anyway, I think that I know what to do now. Will do some testing tonight.
Tags: puppy