[SOLVED] RT2x00 2.6.24 Kernel module can not load firmware

Live forum: http://rt2x00.serialmonkey.com/viewtopic.php?t=4594

malachy

02-02-2008 08:16:18

Hey All,
I compiled a 2.6.24 kernel tonight to try out the new driver there, and it is having problems finding/loading the firmware. I have the RT61 firmware files, but where should they be located for the driver to find them?

System Info

Kernel 2.6.24
Gentoo Linux IA32
RaLink RT2561/RT61 802.11g PCI

IvD

02-02-2008 11:57:00

/lib/firmware/

malachy

02-02-2008 18:32:35

That's interesting because that is where I have it.

IvD

02-02-2008 18:49:33

Do you have a hotplug daemon running (udev, hotplug), check the configuration of those tools to see if they can provide the firmware.

malachy

04-02-2008 08:13:40

Well...I am still having issues with the new driver. I tried compiling the latest CVS, but got a slew of errors from it so I am still working with the driver from the 2.6.24 kernel. It appears to be at least be finding the firmware at this point, but still fails to load it. After the driver is loaded, running ifconfig or iwconfig takes several minutes, iwconfig shows the idle device as wlan0. Running ifconfig wlan0 up waits for several minutes, exits with no errors, but a subsequent ifconfig shows no wlan0 listed. Here are the module errors I am getting

phy0 -> rt2x00lib_request_firmware Error - Failed to request Firmware.
phy1 Selected rate control algorithm 'simple'
phy1 -> rt2x00lib_request_firmware Error - Failed to request Firmware.
phy1 -> rt2x00lib_request_firmware Error - Failed to request Firmware.
phy2 -> rt61pci_validate_eeprom EEPROM recovery - NIC 0xff80
phy2 -> rt61pci_validate_eeprom EEPROM recovery - RSSI OFFSET BG 0x0000
phy2 -> rt61pci_validate_eeprom EEPROM recovery - RSSI OFFSET BG 0x0000
phy2 -> rt2x00_set_chip Info - Chipset detected - rt 0301, rf 0003, rev 0002561c.
phy2 Selected rate control algorithm 'simple'
phy2 -> rt2x00lib_request_firmware Info - Loading firmware file 'rt2561s.bin'.
phy2 -> rt2x00lib_request_firmware Error - Failed to request Firmware.
phy2 -> rt2x00lib_request_firmware Info - Loading firmware file 'rt2561s.bin'.
phy2 -> rt2x00lib_request_firmware Error - Failed to request Firmware.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 0 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 1 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 2 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 3 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 4 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 0 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 1 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 2 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 3 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 4 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 0 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 1 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 2 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 3 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00mac_conf_tx Info - Configured TX ring 4 - CWmin 4, CWmax 10, Aifs 2.
phy2 -> rt2x00lib_request_firmware Info - Loading firmware file 'rt2561s.bin'.
phy2 -> rt2x00lib_request_firmware Error - Failed to request Firmware.
phy2 -> rt2x00lib_request_firmware Info - Loading firmware file 'rt2561s.bin'.
phy2 -> rt2x00lib_request_firmware Error - Failed to request Firmware.

Here are the compile errors I am getting when trying to compile the latest CVS

make
CC [M] /mnt/lin/rt2x00-cvs-2008020323/rt61pci.o
In file included from /mnt/lin/rt2x00-cvs-2008020323/rt61pci.c35
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h363 error field 'conf' has incomplete type
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h390 warning 'struct ieee80211_vif' declared inside parameter list
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h390 warning its scope is only this definition or declaration, which is probably not what you want
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h In function 'vif_to_intf'
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h392 error dereferencing pointer to incomplete type
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h At top level
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h434 error field 'band' has incomplete type
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h651 error 'IEEE80211_NUM_BANDS' undeclared here (not in a function)
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h652 error field 'curr_band' has incomplete type
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h969 warning 'struct ieee80211_vif' declared inside parameter list
/mnt/lin/rt2x00-cvs-2008020323/rt2x00.h977 warning 'struct ieee80211_vif' declared inside parameter list
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c In function 'rt61pci_config_antenna_5x'
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c478 error 'IEEE80211_BAND_5GHZ' undeclared (first use in this funct ion)
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c478 error (Each undeclared identifier is reported only once
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c478 error for each function it appears in.)
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c In function 'rt61pci_config_antenna'
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c654 error 'IEEE80211_BAND_5GHZ' undeclared (first use in this funct ion)
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c668 error 'IEEE80211_BAND_2GHZ' undeclared (first use in this funct ion)
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c In function 'rt61pci_link_tuner'
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c772 error 'struct ieee80211_rx_status' has no member named 'band'
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c772 error 'IEEE80211_BAND_2GHZ' undeclared (first use in this funct ion)
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c In function 'rt61pci_agc_to_rssi'
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c1604 error 'struct ieee80211_rx_status' has no member named 'band'
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c1604 error 'IEEE80211_BAND_5GHZ' undeclared (first use in this func tion)
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c In function 'rt61pci_beacon_update'
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c2377 error 'struct ieee80211_tx_control' has no member named 'vif'
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c At top level
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c2440 warning initialization from incompatible pointer type
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c2444 error unknown field 'bss_info_changed' specified in initialize r
/mnt/lin/rt2x00-cvs-2008020323/rt61pci.c2444 warning initialization from incompatible pointer type
make[2] *** [/mnt/lin/rt2x00-cvs-2008020323/rt61pci.o] Error 1
make[1] *** [_module_/mnt/lin/rt2x00-cvs-2008020323] Error 2
make *** [default] Error 2

IvD

04-02-2008 09:28:21

Latest CVS doesn't work with 2.6.24, remember the CVS tarball is a rt2x00 snapshot which is compatible with the latest development kernel..

Check your hotplug/udev daemon configuration and the firmware file permissions.

malachy

04-02-2008 21:30:33

There is nothing wrong with the file permissions of the firmware. Cheched that first off when it could not load it. I will go start researching the whole UDEV way of doing things, as I have never dealt with it before. Been using linux for years, and kernel autoload/modprobe has always done me fine.

malachy

04-02-2008 22:34:52

Here is the solution for Gentoo Users using the rt61pci driver from the 2.6.24 kernel

If not already installed, install UDEV via portage

[code377k6i82]emerge -va udev[/code377k6i82]

Download the latest firmware from [url377k6i82]http://www.ralinktech.com/ralink/Home/Support/Linux.html[/url377k6i82] You will want the file Firmware RT2501(RT2561/RT2661).

Uncompress the 3 .bin files from that archive to /lib/firmware

Create/Edit the file firmware.sh in /sbin

[code377k6i82]nano /sbin/firmware.sh[/code377k6i82]

Copy and paste the contents of the file below and save

[code377k6i82]#!/bin/sh -e

FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware"

err() {
echo "$@" >&2
if [ -x /bin/logger ]; then
/bin/logger -t "${0##*/}[$$]" "$@"
fi
}

if [ ! -e /sys$DEVPATH/loading ]; then
err "udev firmware loader misses sysfs directory"
exit 1
fi

for DIR in $FIRMWARE_DIRS; do
[ -e "$DIR/$FIRMWARE" ] || continue
echo 1 > /sys$DEVPATH/loading
cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
echo 0 > /sys$DEVPATH/loading
exit 0
done

echo -1 > /sys$DEVPATH/loading
err "Cannot find firmware file '$FIRMWARE'"
exit 1[/code377k6i82]

Make the file executable

[code377k6i82]chmod u+x /sbin/firmware.sh[/code377k6i82]

Create/Edit the file /etc/udev/rules.d/999-firmware.rules

[code377k6i82]nano /etc/udev/rules.d/999-firmware.rules[/code377k6i82]

Copy and paste the contents of the file below and save

[code377k6i82]#Locate and load firmware for device on module load

ACTION=="add", SUBSYSTEM=="firmware", RUN+="/sbin/firmware.sh"[/code377k6i82]

After making these changes, you should be able to unload and reload the module and the firmware will load properly.

Many thanks to IvD for his input and the various authors of the resources around the web I used to figure this out.