MINI2440 Hostapd移植笔记

移植环境:

PC:fedora 14

MINI2440

无线网卡型号:RTL8188CU

 

手头的无线网卡芯片的realteck的RTL8188CU芯片,从官网下载驱动移植好后成功驱动网卡,但在移植Hostapd是出现问题总是提示invalid/unknown driver'nl80211',后来多方查阅资料发现这款芯片得用驱动包里自带的专用hostapd。

现记录移植过程如下:

找到官方驱动包里的hostapd,进行如下操作

cp defconfig .config

对 .config进行如下修改:

去掉CONFIG_DRIVER_RTW=y前的注释

注释掉#CONFIG_DRIVER_NL80211=y

去掉CONFIG_WPS=y前注释

去除CONFIG_IEEE80211N=y前注释

 

修改Makefile

ifndef CC

CC=gcc

Endif

改为CC=arm-linux-gcc

保存后make

 

将生成的hostapd和hostapd_cli文件复制到开发版的/bin目录

 

编辑hostapd.conf文件内容如下

##### hostapd configuration file ##############################################


interface=wlan0
ctrl_interface=/var/run/hostapd
ssid=mini2440
channel=6
wpa=2
wpa_passphrase=12345678
#bridge=br0




##### Wi-Fi Protected Setup (WPS) #############################################


eap_server=1


# WPS state
# 0 = WPS disabled (default)
# 1 = WPS enabled, not configured
# 2 = WPS enabled, configured
wps_state=2


uuid=12345678-9abc-def0-1234-56789abcdef0


# Device Name
# User-friendly description of device; up to 32 octets encoded in UTF-8
device_name=RTL8192CU


# Manufacturer
# The manufacturer of the device (up to 64 ASCII characters)
manufacturer=Realtek


# Model Name
# Model of the device (up to 32 ASCII characters)
model_name=RTW_SOFTAP


# Model Number
# Additional device description (up to 32 ASCII characters)
model_number=WLAN_CU


# Serial Number
# Serial number of the device (up to 32 characters)
serial_number=12345


# Primary Device Type
# Used format: --
# categ = Category as an integer value
# OUI = OUI and type octet as a 4-octet hex-encoded value; 0050F204 for
#       default WPS OUI
# subcateg = OUI-specific Sub Category as an integer value
# Examples:
#   1-0050F204-1 (Computer / PC)
#   1-0050F204-2 (Computer / Server)
#   5-0050F204-1 (Storage / NAS)
#   6-0050F204-1 (Network Infrastructure / AP)
device_type=6-0050F204-1


# OS Version
# 4-octet operating system version number (hex string)
os_version=01020300


# Config Methods
# List of the supported configuration methods
config_methods=label display push_button keypad




##### default configuration #######################################
interface=wlan0
driver=rtl871xdrv    #注意这里不能是nl80211
beacon_int=100
hw_mode=g
ieee80211n=1
wme_enabled=1
ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+]
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
max_num_sta=8
wpa_group_rekey=86400

在终端输入ifconfig wlan0 192.168.3.1给无线网卡分配一个静态IP,

然后输入hostapd -d /etc/hostapd.conf即可启动Hostapd,使用笔记本可以搜到一个mini2440的wifi热点,但是没有配置dhcp服务器,搜到的热点是不能直接连接的需要配置静态ip访问。


下面来讲一下udhcpd的配置,由于内核自带udhcpd功能,这里只要简单配置一下:

编写udhcp.conf文件,内容如下:


# Sample udhcpd configuration file (/etc/udhcpd.conf)


# The start and end of the IP lease block


start 192.168.3.2 #default: 192.168.0.20
end 192.168.3.254 #default: 192.168.0.254




# The interface that udhcpd will use


interface wlan0 #default: eth0




# The maximim number of leases (includes addressesd reserved
# by OFFER's, DECLINE's, and ARP conficts


#max_leases 254 #default: 254




# If remaining is true (default), udhcpd will store the time
# remaining for each lease in the udhcpd leases file. This is
# for embedded systems that cannot keep time between reboots.
# If you set remaining to no, the absolute time that the lease
# expires at will be stored in the dhcpd.leases file.


#remaining yes #default: yes




# The time period at which udhcpd will write out a dhcpd.leases
# file. If this is 0, udhcpd will never automatically write a
# lease file. (specified in seconds)


#auto_time 7200 #default: 7200 (2 hours)




# The amount of time that an IP will be reserved (leased) for if a 
# DHCP decline message is received (seconds).


#decline_time 3600 #default: 3600 (1 hour)




# The amount of time that an IP will be reserved (leased) for if an
# ARP conflct occurs. (seconds


#conflict_time 3600 #default: 3600 (1 hour)




# How long an offered address is reserved (leased) in seconds


#offer_time 60 #default: 60 (1 minute)


# If a lease to be given is below this value, the full lease time is
# instead used (seconds).


#min_lease 60 #defult: 60




# The location of the leases file


#lease_file /var/lib/misc/udhcpd.leases #defualt: /var/lib/misc/udhcpd.leases


# The location of the pid file
#pidfile /var/run/udhcpd.pid #default: /var/run/udhcpd.pid


# Everytime udhcpd writes a leases file, the below script will be called.
# Useful for writing the lease file to flash every few hours.


#notify_file #default: (no script)


#notify_file dumpleases # <--- usefull for debugging


# The following are bootp specific options, setable by udhcpd.


#siaddr 192.168.0.22 #default: 0.0.0.0


#sname zorak #default: (none)


#boot_file /var/nfs_root #default: (none)


# The remainer of options are DHCP options and can be specifed with the
# keyword 'opt' or 'option'. If an option can take multiple items, such
# as the dns option, they can be listed on the same line, or multiple
# lines. The only option with a default is 'lease'.


#Examles
opt dns 8.8.8.8 8.8.4.4
option subnet 255.255.255.0
opt router 192.168.3.1
#opt wins 192.168.10.10
option dns 8.8.8.8 # appened to above DNS servers for a total of 3
option domain local
option lease 864000 # 10 days of seconds




# Currently supported options, for more info, see options.c
#subnet
#timezone
#router
#timesvr
#namesvr
#dns
#logsvr
#cookiesvr
#lprsvr
#bootsize
#domain
#swapsvr
#rootpath
#ipttl
#mtu
#broadcast
#wins
#lease
#ntpsrv
#tftp
#bootfile


在终端输入udhcpd /etc/udhcpd.conf,设备连接无线AP,将能自动分配IP



你可能感兴趣的:(ARM/Linux)