wifiWG233移植

  1. 驱动的移植
    1. 交叉编译WIFI原厂固件驱动

   根据网上资料,和官方文档编译成功。

  1. 修改Makefile
  1. 修改交叉编译环境

   

  1. 执行 make

编译成功,生成88x2bu.ko

  1. 加载原厂驱动

Insmod 88x2bu.ko

生成wlan0

wifiWG233移植_第1张图片

 

 

  1. Hostapd工具移植生成可连接热点AP
    1. 安装libnl库
    1. 使用命令tar -xvf libnl-1.1.tar.gz解压我们提供的libnl-1.1.tar.gz
    2. 进入libnl-1.1目录下执行./configure --prefix=/usr/local/libnl
    3. 在libnl-1.1/include/netlink-local.h中添加头文件#include
    4. 运行make CC=aarch64-linux-gnu-gcc
    5. 运行make install

    1. 编译hostapd

进入wpa_supplicant_8_kk_4.4_rtw_r24640.20171025/hostapd目录下编辑此目录下的.config文件

    1. 在.config文件中添加如下内容

LIBNL=/usr/local/libnl

CFLAGS += -I$(LIBNL)/include

LIBS += -L$(LIBNL)/lib

    1. 在该hostapd目录下执行make
    1. 运行配置

./hostapd rtl_hostapd_5G.conf –B

配置文件rtl_hostapd_5G.conf如下所示。

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

interface=wlan0

#ctrl_interface=/var/run/hostapd

ssid=rtwap

channel=36

wpa=2

wpa_passphrase=87654321

#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 #######################################

driver=nl80211

beacon_int=100

hw_mode=a

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

  1. DHCP配置

./hostapd rtl_hostapd_5G.conf -B 正常的话,是可以成功生成AP热点。用电脑和手机可以正常搜到。不过不能分配IP。就是因为没有进行dhcp的原因。

 配置步骤如下。

  1. 设置wlan0 ip

   ifconfig wlan0 192.168.2.1

  1. 启动wlan0

   ifconfig wlan0 up

  1. 新建配置文件

   网上查资料,需要配置文件,才能用udhcpd 工具配置。网上复制一个配置文件,尝试配置,成功了。

   注意配置文件的IP区间是在之前ifconfig wlan0 192.168.2.1 的同一个网段。

   把下面的复制到配置新建的配置文件udhcpd.conf里。把配置文件拷贝到/etc/下。

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

# The start and end of the IP lease block

start       192.168.2.2 #default: 192.168.0.20

end     192.168.2.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  253     #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-wlan2.pid   #default: /var/run/udhcpd.pid

# Every time 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  # <--- useful 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 114.114.114.114 #192.168.2.1

option  subnet  255.255.255.0

option  domain  local   #atherosowl.com

option  lease   864000      # 10 days of seconds

# Currently supported options, for more info, see options.c

#opt subnet

#opt timezone

opt router 192.168.2.1

#opt timesvr

#opt namesvr

#opt dns

#opt logsvr

#opt cookiesvr

#opt lprsvr

#opt bootsize

#opt domain

#opt swapsvr

#opt rootpath

#opt ipttl

#opt mtu

#opt broadcast

#opt wins

#opt lease

#opt ntpsrv

#opt tftp

#opt bootfile

# Static leases map

#static_lease 00:60:08:11:CE:4E 192.168.0.54

#static_lease 00:60:08:11:CE:3E 192.168.0.44

  1. 运行配置命令

先ps看一下后台有没有udhcpd和hostapd程序在执行

有的话就killall udhcpd 或者 killall hostapd给关掉

Udhcpd udhcpd.conf

或者

udhcpd -fS /etc/udhcpd.conf &

hostapd -B /etc/hostapd.conf

执行这两个程序,可能udhcpd会报如下的错误,在相应目录新建一个对应名字文件即可

root@ti81xx:~# udhcpd (v1.19.4) started

udhcpd: can't open '/var/lib/misc/udhcpd.leases': No such file or directory

到这一步,就可以用电脑连接模块生成的AP了。并且可以自动获取IP了。可以ping通板子,也可以通过ssh远程连接板子了。

你可能感兴趣的:(linux)