RT5370 in Ubuntu 10.04LTS

Here are instructions how to compile and install a RT5370 WLAN device driver kernel into Ubuntu 10.04 LTS (Lucid Lynx). My device was purchased from DealExtreme (SKU 71905). Its USB ID is 148f:5370:

$ lsusb
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 005: ID 148f:5370 Ralink Technology, Corp.
Bus 001 Device 004: ID 0bda:0158 Realtek Semiconductor Corp. Mass Storage Device
Bus 001 Device 003: ID 0c45:63e3 Microdia
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Before proceeding make sure that you have packages build-essential and linux-headers-generic (in case you have some other kernel you need the corresponding headers) installed:

$ sudo apt-get install build-essential linux-headers-generic

Step 1: Download source

Download a slightly changed source package. The change is explained in this Ubuntu Forum thread.

Note! The driver version 2.5.0.3 does not need any changes and you may get the original driver.

Step 2: Extract package

Extract the package:

$ tar --get -j <2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO.bz2

Step 3: Configuration

If you intend to control the device via NetworkManager you have to change two settings in the configuration.

$ gedit os/linux/config.mk

In line 57: HAS_WPA_SUPPLICANT=y (was "n")
In line 61: HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y (was "n")

Step 4: Compile

Descend into source directory and compile the package.

$ cd 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/
$ make
make -C tools
make[1]: Entering directory `/tmp/rt/2011_0225_RT5370_RT5372_Linux_STA_V2.5.0.1_DPO_ml-1/tools'
gcc -g bin2h.c -o bin2h
make[1]: Leaving directory `/tmp/rt/2011_0225_RT5370_RT5372_Linux_STA_V2.5.0.1_DPO_ml-1/tools'
/tmp/rt/2011_0225_RT5370_RT5372_Linux_STA_V2.5.0.1_DPO_ml-1/tools/bin2h
cp -f os/linux/Makefile.6 /tmp/rt/2011_0225_RT5370_RT5372_Linux_STA_V2.5.0.1_DPO_ml-1/os/linux/Makefile
make -C /lib/modules/2.6.32-35-generic/build SUBDIRS=/tmp/rt/2011_0225_RT5370_RT5372_Linux_STA_V2.5.0.1_DPO_ml-1/os/linux modules
[lots of output...]
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-35-generic'
cp -f /tmp/rt/2011_0225_RT5370_RT5372_Linux_STA_V2.5.0.1_DPO_ml-1/os/linux/rt5370sta.ko /tftpboot
cp: cannot create regular file `/tftpboot': Permission denied
make: *** [LINUX] Error 1
$

Don't worry about the error message (in italics). For some unknown reason the original make script tries to copy the compiled module os/linux/rt5370.ko to tftpboot path. Since you don't have the root privileges this fails.

Step 5: Install data file

$ sudo mkdir -p /etc/Wireless/RT2870STA
$ sudo cp RT2870STA.dat  /etc/Wireless/RT2870STA/

Step 6: Copy kernel module

$ sudo cp os/linux/rt5370sta.ko /lib/modules/`uname -r`/kernel/drivers/net/
$ sudo depmod

You're finished!

You have now compiled the kernel module (steps 1-4) and installed it (steps 5-6). Reboot the the USB device into the workstation and reboot. You should now have a new wireless device ra0. If this is your first WLAN device the NetworkManager should notice it on the fly.

Kernel Update

After (major) kernel updates you have to recompile and install the kernel.

$ cd 2011_0225_RT5370_RT5372_Linux_STA_V2.5.0.1_DPO_ml-1/
$ make clean
$ make
$ sudo cp os/linux/rt5370sta.ko /lib/modules/`uname -r`/kernel/drivers/net/
$ sudo depmod

References

Updated 31-MAR-2012 / Matti Lattu