首先在官方的驅動中不一定支持我們需要的平台,這樣就需要我們對需要的平台進行相關的添加,主要修改下面兩個文件:
1、根目錄下的Makefile:
PLATFORM = HI_3518C
#add by kj ,in the platform hi_3518c
ifeq ($(PLATFORM),HI_3518C)
LINUX_SRC = /home/kongjun/mywork/develop_kj/Hi3518_SDK_V1.0.3.0/osdrv/kernel/linux-3.0.y
LINUX_SRC_MODULE = /home/kongjun/mywork/develop_kj/Hi3518_SDK_V1.0.3.0/osdrv/kernel/linux-3.0.y/drivers/net/wireless/
CROSS_COMPILE = arm-hisiv100nptl-linux-
endif
#end alter by kj
2、./os/linux/config.mk 文件:
#add by kj
ifeq ($(PLATFORM),HI_3518C)
#WFLAGS += -DRT_BIG_ENDIAN
endif
#add by kj
ifeq ($(PLATFORM),HI_3518C)
#CFLAGS := -v -D__KERNEL__ -DMODULE -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -mbig-endian -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -mapcs-32 -D__LINUX_ARM_ARCH__=5 -mcpu=xscale -mtune=xscale -malignment-traps -msoft-float $(WFLAGS)
EXTRA_CFLAGS := -v $(WFLAGS) -I$(RT28xx_DIR)/include
export CFLAGS
endif
3、make即可。
注:
驅動加載後生成的設備名稱是‘ra0’,這個在驅動是可以修改的,在驅動中的位置是:
./include/rtmp_def.h
#define INF_MAIN_DEV_NAME "ra"
#define INF_MBSSID_DEV_NAME "ra"
#define INF_WDS_DEV_NAME "wds"
#define INF_APCLI_DEV_NAME "apcli"
#define INF_MESH_DEV_NAME "mesh"
#define INF_P2P_DEV_NAME "p2p"
其他參考資料:
2. RT3070驅動修改
解壓 tar -zxvf 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO.tar.gz
進入RT3070_Linux_STA目錄,看到有一個README_STA_usb文件,裡面介紹了如何加載該驅動,先浏覽一下
2.1 先設好環境變量
export PATH=/opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/usr/bin:$PATH
2.2 makefile修改 (-為去掉設置, +為新加的設置)
#vi makefile
- #PLATFORM = PC
+ PLATFORM = IXP
#(選用的是IXP)
ifeq ($(PLATFORM),IXP)
- LINUX_SRC = /project/stable/Gmtek/snapgear-uclibc/linux-2.6.x
- CROSS_COMPILE = arm-linux-
+ LINUX_SRC = /xxx/kernel/linux-2.6.14
+ CROSS_COMPILE = arm-hismall-linux-
endif
2.3 /os/linux/config.mk修改
#cd /os/linux/
#vi config.mk
# Support Wpa_Supplicant
- HAS_WPA_SUPPLICANT=n
+ HAS_WPA_SUPPLICANT=y
# Support Native WpaSupplicant for Network Maganger
- HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n
+ HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y
ifeq ($(PLATFORM),IXP)
- WFLAGS += -DRT_BIG_ENDIAN
#加這個選項,模塊運行時顯示出錯,CPU不能工作
endif
ifeq ($(PLATFORM),IXP)
- CFLAGS := -v -D__KERNEL__ -DMODULE -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -mbig-endian -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -mapcs-32 -D__LINUX_ARM_ARCH__=5 -mcpu=xscale -mtune=xscale -malignment-traps -msoft-float $(WFLAGS)
- EXTRA_CFLAGS := -v $(WFLAGS) -I$(RT28xx_DIR)/include -mbig-endian
+ EXTRA_CFLAGS := -v $(WFLAGS) -I$(RT28xx_DIR)/include
export CFLAGS
endif
3、 編譯源碼
make通過,在2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO/os/linux目錄下生成了rt3070sta.ko,也就是RT3070的驅動了
4. 拷貝驅動到目標系統
把RT2870STA.dat拷貝到/etc/Wireless/RT2870STA目錄下
把rt3070sta.ko拷貝到/xxx/ 目錄下 xxx自定
5. 加載驅動模塊
insmod /xxx/rt3070sta.ko
出現以下錯誤
rt3070sta: Unknown symbol usb_alloc_urb
rt3070sta: Unknown symbol usb_free_urb
rt3070sta: Unknown symbol usb_register
rt3070sta: Unknown symbol usb_put_dev
rt3070sta: Unknown symbol usb_get_dev
rt3070sta: Unknown symbol usb_submit_urb
rt3070sta: Unknown symbol usb_control_msg
rt3070sta: Unknown symbol usb_deregister
rt3070sta: Unknown symbol usb_kill_urb
rt3070sta: Unknown symbol usb_buffer_free
rt3070sta: Unknown symbol usb_buffer_alloc
insmod: cannot insert `rt3070sta.ko': Unknown symbol in module (-1): No such file or directory
原因未加載USB驅動
5.1 加載usbcore.ko
insmod /lib/modules/2.6.14-hi3511v100dmeb-release/kernel/drivers/usb/core/usbcore.ko
顯示
usbcore: registered new driver usbfs
usbcore: registered new driver hub
加載成功
5.2.1 如果為USB1.1 加載hi3511_usb_1-1.ko
insmod /lib/modules/2.6.14-hi3511v100dmeb-release/misc/hi3511_usb_1-1.ko
顯示
USB1_1-M0001C030002 @Hi3511v110_OSDrv_1_0_0_1 2008-11-03 18:35:15
Clock to USB host has been enabled
hisilicon-ohci hisilicon-ohci.0: hisilicon OHCI
hisilicon-ohci hisilicon-ohci.0: new USB bus registered, assigned bus number 1
hisilicon-ohci hisilicon-ohci.0: irq 20, io mem 0xa0000000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usb 1-1: new full speed USB device using hisilicon-ohci and address 2
加載成功
5.2.2 如果為USB2.0 加載hiusb.ko
insmod /lib/modules/2.6.14-hi3511v100dmeb-release/misc/hiusb.ko
顯示
<6>hiusb-hcd hiusb-hcd.0: Hisilicon USB host controller
hiusb-hcd hiusb-hcd.0: new USB bus registered, assigned bus number 1
hiusb-hcd hiusb-hcd.0: irq 23, io base 0x80090000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
加載成功
5.3 然後再加載rt3070sta.ko
insmod /xxx/rt3070sta.ko
顯示
rtusb init rt2870 --->
=== pAd = d1af4000, size = 514424 ===
<-- RTMPAllocTxRxRingMemory, Status=0
<-- RTMPAllocAdapterBlock, Status=0
usbcore: registered new driver rt2870
加載成功
#ifconfig -a 可以查看到ra0設備的存在
若無密碼或密碼為WEP加密,則此時可以啟動無線, 若密碼為WPA加密,則需移植wpa_supplicant,往後再說移植
6.無密碼或密碼為WEP加密:
6.1 啟動無線
#ifconfig ra0 up
(Efuse for 3062/3562/3572) Size=0x2d [2d0-2fc]
RTMP_TimerListAdd: add timer obj d1b3c620!
RTMP_TimerListAdd: add timer obj d1b3c650!
RTMP_TimerListAdd: add timer obj d1b3c680!
RTMP_TimerListAdd: add timer obj d1b3c5f0!
RTMP_TimerListAdd: add timer obj d1b3c560!
RTMP_TimerListAdd: add timer obj d1b3c590!
RTMP_TimerListAdd: add timer obj d1b06b94!
RTMP_TimerListAdd: add timer obj d1af5f54!
RTMP_TimerListAdd: add timer obj d1af5f8c!
RTMP_TimerListAdd: add timer obj d1b06c38!
RTMP_TimerListAdd: add timer obj d1b06b34!
RTMP_TimerListAdd: add timer obj d1b06c04!
-->RTUSBVenderReset
<--RTUSBVenderReset
Key1Str is Invalid key length(0) or Type(0)
Key2Str is Invalid key length(0) or Type(0)
Key3Str is Invalid key length(0) or Type(0)
Key4Str is Invalid key length(0) or Type(0)
1. Phy Mode = 5
2. Phy Mode = 5
phy mode> Error! The chip does not support 5G band 5!
RTMPSetPhyMode: channel is out of range, use first channel=1
(Efuse for 3062/3562/3572) Size=0x2d [2d0-2fc]
3. Phy Mode = 9
MCS Set = ff 00 00 00 01
<==== rt28xx_init, Status=0
0x1300 = 00064300
啟動成功
6.2 設置ip
#ifconfig ra0 192.168.1.230 netmask 255.255.255.0
6.3 掃描無線網絡
#iwlist ra0 scan
===>rt_ioctl_giwscan. 9(9) BSS returned, data->length = 1476
ra0 Scan completed :
Cell 01 - Address: F0:7D:68:96:A6:C2
Protocol:802.11b/g/n
ESSID:"dlinktf"
Mode:Managed
Frequency:2.412 GHz (Channel 1)
Quality=18/100 Signal level=-83 dBm Noise level=-92 dBm
Encryption key:on
Bit Rates:54 Mb/s
Cell 02 - Address: F4:EC:38:55:AF:BC
Protocol:802.11b/g/n
ESSID:"visview"
Mode:Managed
Frequency:2.427 GHz (Channel 4)
Quality=18/100 Signal level=-83 dBm Noise level=-91 dBm
Encryption key:off
Bit Rates:54 Mb/s
顯示以上信息說明模塊已經正常工作
6.4 設置SSID和WEP加密算法
可以參考裡面的iwpriv_usage.txt進行配置,
6.4.1 無密碼
Config STA to link with AP which is OPEN/NONE(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=OPEN
3. iwpriv ra0 set EncrypType=NONE
4. iwpriv ra0 set SSID="AP's SSID"
6.4.2 WEP加密算法
iwpriv ra0 set NetworkType=Infra
iwpriv ra0 set AuthMode=SHARED
iwpriv ra0 set EncrypType=WEP
iwpriv ra0 set DefaultKeyID=1
iwpriv ra0 set Key1="AP's wep key"
iwpriv ra0 set SSID="AP's SSID"
設置完一會,等網絡連接好就可以了。