Embedded Linux USB WiFi-driven porting __linux

Source: Internet
Author: User
Tags bz2

Hardware platform: Freescale MX258 Development Board

Operating system: Linux2.6.31

wifi:rt2860 USB WiFi Module

Cross-compilation environment: GCC version 4.1.2

Debugging steps:

The first step: testing the USB host interface

To set the USB host to kernel mode in Menuconfig:

After recompiling the kernel, start the Development board, insert the U disk and mount it:

Mount/dev/sda1/tmp

Ls/tmp

can see the U disk has been normal mount, test USB HOST ok!

Step two: Download Leiling the latest USB drive online,

2011_0107_rt3070_rt3370_linux_sta_v2[1].5.0.1_dpo.tar.bz2

Copy to Linux directory and unzip:

Tar jxf 2011_0107_rt3070_rt3370_linux_sta_v2[1].5.0.1_dpo.tar.bz2

Since the name above is very long, it can be modified to a short name:

MV 2011_0107_rt3070_rt3370_linux_sta_v2[1].5.0.1_dpo Rt3070_linux_sta

Step three: Enter the Rt3070_linux_sta directory and see a README_STA_USB file that describes how to load the driver:

=======================================================================

Build Instructions:

====================

1> $tar-xvzf dpb_rt2870_linux_sta_x.x.x.x.tgz

Go to "./dpb_rt2870_linux_sta_x.x.x.x" directory.

2> in Makefile

Set the "MODE = STA" in Makefile and chose the target to Linux by set "target = Linux"

Define the Linux kernel source include file path linux_src

Modify to meet your need.

3> in Os/linux/config.mk

Define the GCC and LD of the target machine

Define the compiler flags Cflags

Modify to meet your need.

* * Build for being controlled by NetworkManager or wpa_supplicant wext functions

Please set ' has_wpa_supplicant=y ' and ' has_native_wpa_supplicant_support=y '.

=> #>cd wpa_supplicant-x.x

=> #>./wpa_supplicant-dwext-ira0-c wpa_supplicant.conf-d

* * Build for being controlled by Wpasupplicant with Ralink Driver

Please set ' has_wpa_supplicant=y ' and ' has_native_wpa_supplicant_support=n '.

=> #>cd wpa_supplicant-0.5.7

=> #>./wpa_supplicant-dralink-ira0-c wpa_supplicant.conf-d

4> $make

# Compile driver Source code

# to fix ' error:too few arguments to Functionˉiwe_stream_add_event '

=> $patch-I os/linux/sta_ioctl.c.patch os/linux/sta_ioctl.c

5> $CP Rt2870sta.dat/etc/wireless/rt2870sta/rt2870sta.dat

6> load driver, go to "os/linux/" directory.

#[kernel 2.4]

# $/sbin/insmod RT2870STA.O

# $/sbin/ifconfig RA0 inet your_ip up

#[kernel 2.6]

# $/sbin/insmod Rt2870sta.ko

# $/sbin/ifconfig RA0 inet your_ip up

7> Unload Driver

$/sbin/ifconfig ra0 Down

$/sbin/rmmod Rt2870sta

Here go to "./dpb_rt2870_linux_sta_x.x.x.x" directory. That's the Rt3070_linux_sta directory we just unzipped. To modify the makefile file in this directory, the following only gives the modified section:

#PLATFORM = PC

PLATFORM = ralink_2880

Ifeq ($ (PLATFORM), ralink_2880)

LINUX_SRC =/HOME/LQM/SHARE/G360/KERNEL_KFB

Cross_compile =/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/ arm-none-linux-gnueabi-

endif

Ifeq ($ (rt28xx_mode), Apsta)

Cp-f $ (Rt28xx_dir)/os/linux/rt$ (chipset) apsta.ko/tftpboot

Ifeq ($ (OSABL), YES)

Cp-f $ (Rt28xx_dir)/os/linux/rtutil$ (chipset) apsta.ko/tftpboot

Cp-f $ (Rt28xx_dir)/os/linux/rtnet$ (chipset) apsta.ko/tftpboot

endif

Else

Cp-f $ (Rt28xx_dir)/os/linux/rt$ (chipset) sta.ko/home/lqm/share/nfs/tmp

Note that while we are using the 2860 module, we can still define platform as ralink_2880, as long as the corresponding compilation environment is correct. LINUX_SRC represents the directory of the kernel, Corss_compile is a cross compilation environment, and the last line copies the generated KO file to the TMP Directory for NFS file systems after compiling.

Fourth step: According to the third step README_STA_USB give the hint, modify the Config.mk file, here also only give the modification part:

# Support Wpa_supplicant

Has_wpa_supplicant=y

# Support Native wpasupplicant for network Maganger

Has_native_wpa_supplicant_support=n

CC: =/OPT/FREESCALE/USR/LOCAL/GCC-4.1.2-GLIBC-2.5-NPTL-3/ARM-NONE-LINUX-GNUEABI/BIN/ARM-NONE-LINUX-GNUEABI-GCC

LD: =/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld

Ifeq ($ (PLATFORM), ralink_2880)

Extra_cflags: =-d__kernel__-i$ (linux_src)/include-i$ (rt28xx_dir)/include-wall-wstrict-prototypes-wno-trigraphs- O2-fno-strict-aliasing-fno-common-uarm-fno-common-pipe-d__linux_arm_arch__=5-march=armv5te-msoft-float-uarm- Dmodule-dmodversions-include $ (LINUX_SRC)/include/config/modversions.h $ (wflags)

Export Extra_cflags

endif

Note that here CC is a cross compilation environment, and LD is a cross compiled link. The default extra_cflags is Cflags, which needs to be modified to extra_cflags, or the following error will be prompted at compile time:

SCRIPTS/MAKEFILE.BUILD:49: * * * cflags is changed in "/home/lqm/share/rt3070_linux_sta/os/linux/makefile". Fix it to use Extra_cflags. Stop it.

Linux_arm_arch must be set to 5,-march must be set up and CPU matching, because this is MX258, so set to ARMv5TE, can not be set to armv5t or ARMV5, otherwise the following error occurred:

CC [M]/home/lqm/share/rt3070_linux_sta/os/linux/. /.. /os/linux/rt_main_dev.o

{standard input}: Assembler messages:

{Standard input}:340:error:selected processor does not support ' PLD [R5, #0] '

{Standard input}:349:error:selected processor does not support ' PLD [R5, #0] '

MAKE[2]: * * * * [/home/lqm/share/rt3070_linux_sta/os/linux/. /.. /OS/LINUX/RT_MAIN_DEV.O] Error 1

MAKE[1]: * * * [_module_/home/lqm/share/rt3070_linux_sta/os/linux] Error 2

MAKE[1]: Leaving directory '/HOME/LQM/SHARE/G360/KERNEL_KFB '

Make: * * * * [LINUX] Error 2

[ROOT@LQM rt3070_linux_sta]#

Fifth step: Make

If the compilation works correctly, the Rt3070sta.ko file will be generated in the/rt3070_linux_sta/os/linux directory.

Step Sixth: Plug the USB WiFi module into the USB host port on the Development Board and Rt3070sta.ko

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.