RT2500 compile problem

I have installed suse 11.4 with gnome 3 in my MSI S270 laptop. Everything works fine apart from the wireless that has the well described problems of slow speed and connectivity issues.

The solution as described in many post over the internet is to compile the RT2500 drivers from source. I followed this post that refers to RT2500 with opensuse 10.3.

However I have problems compiling and get this message

make[1]: Entering directory `/usr/src/linux-2.6.37.6-0.5-obj/x86_64/default'
make -C ../../../linux-2.6.37.6-0.5 O=/usr/src/linux-2.6.37.6-0.5-obj/x86_64/default/. modules
  Building modules, stage 2.
  MODPOST 0 modules
make[1]: Leaving directory `/usr/src/linux-2.6.37.6-0.5-obj/x86_64/default'
rt2500.ko failed to build!
make: *** [module] Error 1

I think that it has to do with the configuration of the makefile which does not point correctly to opensuse 11.4 KERNDIR and MODDIR. I have tried to change this unsuccessfully.

The Makefile code is

###########################################################################

RT2400/RT2500 SourceForge Project - http://rt2x00.serialmonkey.com

This program is free software; you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation; either version 2 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program; if not, write to the

Free Software Foundation, Inc.,

59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Licensed under the GNU GPL

Original code supplied under license from RaLink Inc, 2004.

###########################################################################

###########################################################################

Module Name: Makefile

Abstract: Makefile for rt2500 kernel module

Revision History:

Who When What

-------- ----------- -----------------------------

MarkW 8th Dec 04 Rewrite of Makefile

AmirS 1st Jan 05 Update for gmake compat

MarkW 20th Jan 05 Fixed permissions on directory

MichalL 5th Mar 05 Module installation fixes

MarkW 29th Jul 05 Allow install dir override

###########################################################################

all: module

MODULE_NAME := rt2500
IF_NAME := ra0

#PATCHLEVEL := 6
#KERNDIR=/usr/src/linux-2.6
#MODDIR=/lib/modules/2.6.12/extra

ifeq ($(PATCHLEVEL),)
PATCHLEVEL := $(shell uname -r | cut -d. -f2)
endif

if “uname -r” has the string “fc”, then we try to find the Fedora Core rev.

ifeq ($(findstring fc, $(shell uname -r|cut -s -d- -f2)), fc)
FCREV := $(shell uname -r|cut -s -d. -f4|cut -s -d- -f1)
endif

RESMAN_CORE_OBJS := rtmp_main.o
RESMAN_GLUE_OBJS := mlme.o connect.o sync.o assoc.o auth.o auth_rsp.o rtmp_data.o rtmp_init.o sanity.o rtmp_wep.o wpa.o md5.o rtmp_tkip.o rtmp_info.o rt2x00debug.o eeprom.o

$(MODULE_NAME)-objs := $(RESMAN_CORE_OBJS) $(RESMAN_GLUE_OBJS)

ifdef TOPDIR
obj-m += $(MODULE_NAME).o
endif

EXTRA_CFLAGS += -I$(src)
ifneq ($(FCREV),)
EXTRA_CFLAGS += -DFEDORA=$(FCREV)
endif

ifdef KERNDIR
KERNEL_SOURCES := $(KERNDIR)
else
KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
endif

ifdef MODDIR
MODULE_ROOT := $(MODDIR)
else
MODULE_ROOT := /lib/modules/$(shell uname -r)/extra
endif

ifdef KERNOUT
KERNEL_OUTPUT := KBUILD_OUTPUT=$(KERNOUT)
else
KERNEL_OUTPUT :=
endif

src ?= .
obj ?= .

ifeq ($(PATCHLEVEL), 4)
MODULE_OBJECT := $(MODULE_NAME).o
MODULE_CONF := /etc/modules.conf
else
MODULE_OBJECT := $(MODULE_NAME).ko
MODULE_CONF := /etc/modprobe.d/ralink
endif

ifeq ($(PATCHLEVEL), 4)
$(obj)/$(MODULE_NAME).o: $($(MODULE_NAME)-objs)
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $($(MODULE_NAME)-objs)
endif

KBUILD_PARAMS := -C $(KERNEL_SOURCES) SUBDIRS=$(CURDIR) $(KERNEL_OUTPUT)

module:
@$(MAKE) $(KBUILD_PARAMS) ‘EXTRA_CFLAGS=$(EXTRA_CFLAGS)’ modules;
if ! -f $(MODULE_OBJECT) ]; then
echo “$(MODULE_OBJECT) failed to build!”;
exit 1;
fi

debug:
@$(MAKE) $(KBUILD_PARAMS) ‘EXTRA_CFLAGS=$(EXTRA_CFLAGS)
-DRT2500_DBG’ modules;
if ! -f $(MODULE_OBJECT) ]; then
echo “$(MODULE_OBJECT) failed to build!”;
exit 1;
fi

debugfs:
@$(MAKE) $(KBUILD_PARAMS) ‘EXTRA_CFLAGS=$(EXTRA_CFLAGS)
-DRT2500_DBG -DRT2X00DEBUGFS’ modules;
if ! -f $(MODULE_OBJECT) ]; then
echo “$(MODULE_OBJECT) failed to build!”;
exit 1;
fi

clean:
@rm -f $(RESMAN_GLUE_OBJS) $(RESMAN_CORE_OBJS) .*.{cmd,flags}
@rm -f $(MODULE_NAME).{o,ko,mod.{o,c}} built-in.o $(VERSION_HEADER) *~
@rm -fr .tmp_versions Module.symvers modules.order

modules_install:
@if ! -f $(MODULE_OBJECT) ]; then
$(MAKE) module;
fi
ifeq ($(PATCHLEVEL),4)
@echo “install ‘$(MODULE_OBJECT)’ to $(MODULE_ROOT)”
install -m 755 -o 0 -g 0 -d $(MODULE_ROOT)
install -m 644 -o 0 -g 0 $(MODULE_OBJECT) $(MODULE_ROOT)
/sbin/depmod -ae
else
@echo “2.6 module install”
make $(KBUILD_PARAMS) modules_install
/sbin/depmod -a
endif

install: modules_install
@echo “*** Update $(MODULE_CONF) alias for $(IF_NAME)”;
if -d dirname $(MODULE_CONF) ]; then
if -s $(MODULE_CONF) ]; then
if ! grep -q ‘$(IF_NAME)’ $(MODULE_CONF) ; then
echo “alias $(IF_NAME) $(MODULE_NAME)” >> $(MODULE_CONF) ;
fi;
else
echo “alias $(IF_NAME) $(MODULE_NAME)” >> $(MODULE_CONF) ;
fi;
else
echo “*** Config dir dirname $(MODULE_CONF) not found” >&2;
fi

install-fedora:
if ! -f $(MODULE_OBJECT) ]; then
module;
fi
@echo “install ‘$(MODULE_OBJECT)’ to $(MODULE_ROOT)”
install -m 755 -o 0 -g 0 -d $(MODULE_ROOT)
install -m 644 -o 0 -g 0 $(MODULE_OBJECT) $(MODULE_ROOT)
/sbin/depmod -a

@if ! grep -q ‘wlan0’ /etc/modprobe.conf ; then
echo “append ‘alias wlan0 rt2500’ to /etc/modprobe.conf”;
echo “alias wlan0 rt2500” >> /etc/modprobe.conf ;
echo “options rt2500 ifname=wlan%d” >> /etc/modprobe.conf ;
fi
ifeq ($(PATCHLEVEL), 4)
include $(KERNEL_SOURCES)/Rules.make
endif

My kernel is 2.6.37.6-0.5, I did all the steps as described in the post for opensuse 10.3 (installation of header, devel etc) and the RT2500 drivers I downloaded are rt2500-cvs-2009041204

Thanks for the help

Have you installed ‘ralink-firmware’ package?

Hi, thank you for replying

You mean that installing the ralink-firmware package will fix the wireless?

I installed the following repo

[driver_wireless]
name=Wireless Drivers (openSUSE_11.4)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/driver:/wireless/openSUSE_11.4/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/driver:/wireless/openSUSE_11.4/repodata/repomd.xml.key
enabled=1

and installed the ralink-firmware as suggested. An obsolete kernel package was removed and replaced by a new one.

Rebooted. Tested the wireless - still the same issues low speed-bad signal-connectivity problems.

This repo also gave me access to some other packages that contain drivers and modules for rt28x0, rt3090, rt61 and rt73 but NOT for rt2500 that is my wireless card.

Also tried to compile again. No luck.

Did “make” create any more specific error logs other than “Failed” ?

No other errors :\

hhmm… I worked so long yesterday to get my ralink to work that I forgot some of what I did. When I tried to compile the driver, it complained I had the wrong gcc and cc and upgrading them fixed that problem. However, the last thing I did, and that was what worked, was to extract 2 files from the 2500 tar file and place them like this:

cp rt73.bin /lib/firmware
cp rt73sta.dat /etc/Wireless/RT73STA

IIRC, the first made its own folder, the second required me to make a folder. Of course, you would need to change the rt73 part. I don’t think you need to compile the driver if the firmware is in the right place???

Cant really follow you.

The rt2500-cvs-daily.tar.gz that I downloaded from sourceforge is the latest version (2009-05-12) and does not contain any rt73.bin or rt73sta.dat files.

The rt73.bin is in the relevant rt73 tar but not the rt73sta.dat! (but do I need the rt73 firmware for my rt2500 card?)

If you mean that I need to do the relevant for rt2500 as you did for rt73; there is a rt2500sta.dat file but not a rt2500.bin!

Thanks for taking the time to answer!

the lspci -vvx output is:

02:09.0 Network controller: RaLink RT2500 802.11g (rev 01)
Subsystem: Micro-Star International Co., Ltd. Unknown 802.11g mini-PCI Adapter
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 64, Cache Line Size: 32 bytes
Interrupt: pin A routed to IRQ 22
Region 0: Memory at fbffc000 (32-bit, non-prefetchable) [size=8]
Capabilities: [40] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Kernel driver in use: rt2500pci
00: 14 18 01 02 17 01 10 04 01 00 80 02 08 40 00 00
10: 00 c0 ff fb 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 01 06 00 00 62 14 33 68
30: 00 00 00 00 40 00 00 00 00 00 00 00 05 01 00 00

So the rt2500pci driver that is already build in the kernel loads fine, the wifi is usable but limited; signal is really weak and download speed limited to <1Mbps

If I run “iwconfig wlan0 rate 11M” and reconnect the speed and signal are fixed! But this lasts only for a couple of minutes[/size]