天天看點

linux wifi 8192移植 及部分wifi工具的使用

8192 在imx53 linux上移植

8192wifi驅動

1.編譯8192.ko

編譯過程是進入8192,執行

./make_drv

選1

添加一個新的CONFIG_PLATFORM_ARM_MX53=y,把其他的那個改成n

 編輯Makefile

添加下面代碼

 ifeq ($(CONFIG_PLATFORM_ARM_MX53), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_WISTRON_PLATFORM

ARCH := arm

CROSS_COMPILE := /opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-none-linux-gnueabi-

KVER  := 2.6.35

KSRC ?= /home/vmuser/ltib_x7/ltib/rpm/BUILD/X7_kernel

endif

執行

make

會産生8192cu.ko

搞到闆子上

insmod 8192cu.ko

2. 啟動wlan0

ifconfig -a 會發現wlan0

ifconfig wlan0 192.168.2.1

ifconfig wlan0 up

3.設定8192為client

#wpa_supplicant 服務端程式,使用配置腳本wpa_supplicant.conf 自動連接配接到ap

#wpa_cli用于互動的用戶端程式,比如可以用于手動連接配接到某個ap

./wpa_supplicant -i wlan0 -c  /etc/wpa_supplicant.conf   &

#自動擷取ip位址

udhcpc -i wlan0

#/etc/wpa_supplicant.conf            
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=root
#ap_scan=1
network={
ssid="mywlan"
psk="1234567890"
        proto=WPA2
        key_mgmt=WPA-PSK
pairwise=TKIP
group=TKIP
        priority=20
}
           

4.設定8192為ap:

#hostapd 服務端程式,使用腳本hostapd.conf自動配置資訊,配置檔案hostapd.conf

#hostapd_cli用于互動的用戶端程式,比如

#hostpd_cli all_sta列出所有的已連接配接的client

#iwlist wlan0 scan ; cat /proc/net/rtl819xC/wlan0/best_channel 檢視最好的channel

./hostapd ./hostapd.conf -B

#啟動dhcp伺服器:

#配置檔案位于/etc/dhcpd.conf 

dhcpd wlan0

//hostapd.conf
interface=wlan0
bridge=br0
ssid=songtest
hw_mode=g
channel=11
wpa_key_mgmt=WPA-PSK

logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2

dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0

beacon_int=100
dtim_period=2
max_num_sta=255
rts_threshold=2347
fragm_threshold=2346
macaddr_acl=0
auth_algs=3
ignore_broadcast_ssid=0
wmm_enabled=1

wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0

wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0

wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0
ieee80211n=1
ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]
eapol_key_index_workaround=0
eap_server=0
own_ip_addr=192.168.2.1

wpa=2
wpa_passphrase=1234567890
wpa_pairwise=CCMP
           
#/etc/dhcpd.conf 
ddns-update-style interim;
ignore client-updates;
option SIP code 120 = string;
subnet 192.168.2.0  netmask 255.255.255.0 {

# --- default gateway
        option routers                  192.168.2.1,192.168.2.2,192.168.2.3;
        option subnet-mask              255.255.255.0;
        option nis-domain               "domain.org";
        option domain-name              "domain.org";
#       option SIP                      0:7:65:78:61:6d:70:6c:65:3:63:6f:6d:0:7:65:78:61:6d:70:6c:65:3:6e:65:74;
        option SIP                      1:24:45:67:89;
        option domain-name-servers      203.145.184.13;
        option broadcast-address        192.168.1.255;
        option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#       option netbios-node-type 2;

        range dynamic-bootp 192.168.2.3 192.168.2.254;


        #default-lease-time 1000;
        default-lease-time 21600;
        #max-lease-time 1200;
        max-lease-time 6000;

        # we want the nameserver to appear at a fixed address
        host ns {
                next-server marvin.redhat.com;
                hardware ethernet 12:34:56:78:AB:CD;
                fixed-address 207.175.42.254;
        }
        host anand {
                        hardware ethernet 00:11:11:07:80:68;
                        fixed-address 192.168.2.155;
                        option host-name "anand";
        }
        host dhcphost {
                        hardware ethernet 00:04:9f:96:9c:4d;
                        fixed-address 192.168.2.168;
                        option host-name "dhcphost";
        }
}
           

直接使用無線管理工具 wireless_tools ,也能實作8192與遠端 AP 的連結以及無線網絡的通信。

其中, iwconfig 用來配置無線網卡, iwlist 用來搜尋無線網絡。

ifconfig wlan0 192.168.2.2 netmask 255.255.254.0 up

iwlist wlan0 scanning

iwconfig wlan0 essid “mywlan”

iwconfig wlan0 key 1234567890