Compiling RT3070USB for FriendlyARM

david Kaplan
I need help to compile and get working a driver for the TL-WN321G V4 that
works on the mini2440. Your help can be compensated. We use the standard
FriendlyArm environment and kernels 2.6.29 or 2.6.32.2. As I wrote in the
usb kit thread all of the current drivers do not work for the rt2070
chipset. The attached driver code was used successful as discussed in the
following link. My problem is that I do not understand how to even compile
this driver for the FA environment. I have not succeeded in changing all of
the make file.

http://www.friendlyarm.net/forum/topic/1479

http://ubuntuforums.org/showthread.php?t=1285828

Any help would be vastly appreciated.

David Kaplan

Dave
Attachment: rt2870.tar.gz (4.19 MB)
I've cross compiled the module for you. I simply followed the instructions
from that thai website.

Now proceed with step 6:

mount / dev / <flashdrivedev> / mnt
sudo mkdir-p / etc/Wireless/RT2870STA
sudo cp / mnt/RT2870STA.dat/etc/Wireless/RT2870STA/
sudo apt-get install tofrodos
sudo dos2unix / etc/Wireless/RT2870STA/RT2870STA.dat
sudo chmod + x / etc/Wireless/RT2870STA/RT2870STA.dat
sudo cp /mnt/rt2870.bin/lib/firmware/
sudo cp
/mnt/rt3070sta.ko/lib/modules/2.6.32-rc8/kernel/drivers/staging/rt3070/

david Kaplan
Shalom!
 Using ftp I copied the 3 files to the mini2440. I then created a
/etc/Wireless/RT2870STA folder and put the RT2870STA.dat file in it.
I gave it run permissions. I copied the rt2870.bin file to /lib/firmware.
I do not know exactly where to copy the rt3070sta.ko file so I left it in
the home folder. It is 10363160 bytes which seems large.
I understand maybe mistakenly, that I need to run insmod rt3070sta.ko.
I did this and I got
 "[root@FriendlyARM plg]# /sbin/insmod rt3070sta.ko 
insmod: cannot insert 'rt3070sta.ko': invalid module format"

[root@FriendlyARM plg]# uname -r
2.6.32.2-FriendlyARM

Do I need strip or something?
After I succeed in performing insmod I need to perform modprobe and then
put this in the rcS file?

I would rather compile the driver into the image but I can live with
anything.
I use the standard vivi bootload and FA mini2440-t5 image.

Thanks
 David

I know a little in a lot of fields but not a lot in every specific field.

david Kaplan
Shalom!
 I did not notice since I perform the insnod from telnet that the serial
port console showed the following debug message:

rt3070sta: version magic '2.6.32-rc8 mod_unload ARMv4 ' should be
'2.6.32.2-FriendlyARM mod_unload ARMv4 '

 I guess the kernel versions must be exactly the same.
Could you send me the driver folder with the make file adjusted so I can
compile?

Also is USB defined in one of the files ?
{USB_DEVICE(0x148F,0x2070)}, /* Ralink 2070 */



Thank you very much
David

Dave
Ah sorry i forgot that...

First you have to adapt line 96 and 97 to your compiler and kernel source.

I've already added the 2070 to /common/rtusb_dev_id.c

then run "sudo ARCH=arm make"

Dave
First you have to adapt line 96 and 97 to your compiler and kernel source.
(in the Makefile of course....)

david Kaplan
I changed the Makefile entry to

ifeq ($(PLATFORM),ARM)
LINUX_SRC = /opt/FriendlyARM/mini2440/linux-2.6.32.2
CROSS_COMPILE = /usr/local/arm/4.3.2/bin/arm-linux-
#LINUX_SRC = /home/david/Desktop/mini2440/kernel/kernel-bin
#CROSS_COMPILE = /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-
endif

but I get error on line 3. Which line 3?

Why does it say "arm-none-linux-gnueabi-gcc: not found" ?

Thanks

------------------------------------------------------------
[root@kiryat8 RT3370]# sudo ARCH=arm make
make -C tools
make[1]: Entering directory `/root/RT3370/tools'
gcc -g bin2h.c -o bin2h
make[1]: Leaving directory `/root/RT3370/tools'
/root/RT3370/tools/bin2h
cp -f os/linux/Makefile.6 /root/RT3370/os/linux/Makefile
make -C /opt/FriendlyARM/mini2440/linux-2.6.32.2
SUBDIRS=/root/RT3370/os/linux modules
/usr/local/arm/4.3.2/bin/arm-linux-gcc: line 3: exec:
arm-none-linux-gnueabi-gcc: not found
make[1]: Entering directory `/opt/FriendlyARM/mini2440/linux-2.6.32.2'
  CC [M]  /root/RT3370/os/linux/../../common/crypt_md5.o
/usr/local/arm/4.3.2/bin/arm-linux-gcc: line 3: exec:
arm-none-linux-gnueabi-gcc: not found
make[2]: *** [/root/RT3370/os/linux/../../common/crypt_md5.o] Error 127
make[1]: *** [_module_/root/RT3370/os/linux] Error 2
make[1]: Leaving directory `/opt/FriendlyARM/mini2440/linux-2.6.32.2'
make: *** [LINUX] Error 2

Dave
what happens if you change the path to 
"CROSS_COMPILE=/usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-" ?

Dave
i guess you forgot to export the path to your toolchain.

gedit /home/root/.bashrc

then append at the end: "export PATH=$PATH:/usr/local/arm/4.3.2/bin"

save->restart your terminal and it should work

david Kaplan
Shalom!
 I thought about that and I checked:
My .bashrc is
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
  . /etc/bashrc
fi
export PATH=$PATH:/usr/local/arm/4.3.2/bin
========================================================
When I enter "arm-none-linux-gnueabi-gcc" in the command line it is found:
[root@kiryat8 RT3370]# arm-none-linux-gnueabi-gcc
arm-none-linux-gnueabi-gcc: no input files
========================================================
I see the path is twice in the PATH but that should not hurt should it?
[root@kiryat8 RT3370]# $PATH
bash:
/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/lo
cal/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/arm/4.3.2/bin:/
root/bin:/usr/local/arm/4.3.2/bin:
No such file or directory
[root@kiryat8 RT3370]# 
========================================================
I reset the PATH and relogged in and the same problem.
[root@kiryat8 RT3370]# $PATH
bash:
/usr/local/arm/4.3.2/bin:/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bi
n:/usr/lib/ccache:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/
root/bin:
No such file or directory
========================================================

Still the same compile error.
crypt_md5.c is the first file being compiled.
There is nothing on its line 3.

david Kaplan
I found on the following link that they export the ARCH so after I issued:
export ARCH=arm
the compile errors disappered.
I will test the driver next week.

Many thanks.
http://www.friendlyarm.net/forum/topic/1786

Dave
"line 3" is referring to line 3 in arm-linux-gcc which is a script
executing arm-none-linux-gnueabi-gcc

what happens if you run make without sudo?

Dave
ah great!