FL2440 rt3070模块ap模式移植
------------------------------------------------------------------------------------------------------------------------------
交叉编译器:arm-linux-gcc-4.5.4
Linux内核版本:Linux-3.0
主机操作系统:Centos 6.5
开发板:FL2440
本文章的内核已经已经添加了DM9000的网卡,USB驱动,使用的是initramfs的文件系统。
------------------------------------------------------------------------------------------------------------------------------
大体移植过程:添加内核支持-->编译Openssl生成一些库函数,用作后面hostapd的编译-->编译libnl生成一些库函数,用作后面hostapd的编译-->编译hostapd生成开发板所需的命令文件hostapd以及配置文件hostapd.conf-->配置udhcpd的配置文件udhcpd.conf到开发板,完成dhcp服务器功能-->开发板上运行配置文件初次尝试连接wifi-->移植iptables命令完成上网功能。
一、内核移植
make menuconfig
[*] Networking support --->
Networking options --->
<*> Packet socket
<*> Unix domain sockets
[*] TCP/IP networking
[*] TCP/IP networking
[*] IP: kernel level autoconfiguration
[*] IP: multicast routing
[*] IP: DHCP support
[*] IP: BOOTP support
[*] IP: RARP support
[*] IP: multicast routing
[*] Network packet filtering framework (Netfilter) --->
[*] Advanced netfilter configuration
Core Netfilter Configuration ---> //除了下面的其余的全选
< > Transparent proxying support (EXPERIMENTAL)
< > set target and match support
< > CHECKSUM target support
< > "CT" target support
< > "DSCP" and "TOS" target support
< > "NOTRACK" target support
< > "TRACE" target support
<*> IP set support --->
(256) Maximum number of IP sets
<*> bitmap:ip set support
<*> bitmap:ip,mac set support
<*> bitmap:port set support
<*> list:set set support
<*> IP virtual server support --->
(12) IPVS connection table size (the Nth power of 2)
*** IPVS transport protocol load balancing support ***
[*] TCP load balancing support
[*] UDP load balancing support
[*] ESP load balancing support
[*] AH load balancing support
<*> round-robin scheduling
<*> weighted round-robin scheduling
<*> least-connection scheduling
<*> weighted least-connection scheduling
<*> locality-based least-connection scheduling
<*> locality-based least-connection with replication scheduling
<*> destination hashing scheduling
<*> source hashing scheduling
<*> shortest expected delay scheduling
<*> never queue scheduling
*** IPVS application helper ***
[*] Netfilter connection tracking
IP: Netfilter Configuration ---> //此下的全选
<*> RF switch subsystem support --->
二、网络配置工具移植
所需文件:
openssl-0.9.8e.tar.gz 下载地址 http://www.openssl.org/source/old/0.9.x/
libnl-1.1.4.tar.gz 下载地址 http://www.infradead.org/~tgr/libnl/
hostapd-1.0.tar.gz 下载地址 http://download.chinaunix.net/download.php?id=40061&ResourceID=4450
(1)移植openssl-0.9.8e
[xiaohexiansheng@centos6 openssl-0.9.8e]$ mkdir install
[xiaohexiansheng@centos6 openssl-0.9.8e]$ vim Makefile
修改编译生成文件所放的位置和编译器的位置
INSTALLTOP=/home/xiaohexiansheng/fl2440/3rdparty/apwifi/openssl-0.9.8e/install
CC= /opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc
AR=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-ar $(ARFLAGS) r
RANLIB= /opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-ranlib
[xiaohexiansheng@centos6 openssl-0.9.8e]$ sudo make
[xiaohexiansheng@centos6 openssl-0.9.8e]$ sudo make install
(2)移植libnl-1.1.4
在这里不需要修改Makefile文件,用 configure命令来指定安装路径和软件运行的系统平台
[xiaohexiansheng@centos6 libnl-1.1.4]$ mkdir install
[xiaohexiansheng@centos6 libnl-1.1.4]$ ./configure --prefix=/home/xiaohexiansheng/fl2440/3rdparty/apwifi/openssl-0.9.8e/install --host=arm-linux
[xiaohexiansheng@centos6 libnl-1.1.4]$ sudo make CC=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc
[xiaohexiansheng@centos6 libnl-1.1.4]$ sudo make install
将install/lib/目录下的libnl.so.1文件发送到开发板的/lib/目录下
(3)移植hostapd-1.0
修改.config文件和Makefile文件
[xiaohexiansheng@centos6 hostapd]$ cp defconfig .config
[xiaohexiansheng@centos6 hostapd]$ vim .config
添加:
CONFIG_DRICER_NL80211=y
[xiaohexiansheng@centos6 hostapd]$ vim Makefile
添加:
CFLAGS +=-I/home/xiaohexiansheng/fl2440/3rdparty/apwifi/libnl-1.1.4/install/include
CFLAGS +=-I/home/xiaohexiansheng/fl2440/3rdparty/apwifi/openssl-0.9.8e/install/include
LIBS +=-L/home/xiaohexiansheng/fl2440/3rdparty/apwifi/libnl-1.1.4/install/lib
LDFLAGS +=-L/home/xiaohexiansheng/fl2440/3rdparty/apwifi/libnl-1.1.4/install/lib
LIBS +=-L/home/xiaohexiansheng/fl2440/3rdparty/apwifi/openssl-0.9.8e/install/lib
LDFLAGS +=-L/home/xiaohexiansheng/fl2440/3rdparty/apwifi/openssl-0.9.8e/install/lib
[xiaohexiansheng@centos6 hostapd]$ make CC=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc
[xiaohexiansheng@centos6 hostapd]$ sudo make install
参考网上的资料修改hostapd.conf配置文件
[xiaohexiansheng@centos6 hostapd]$ vim hostapd.conf
配置文件修改如下:
nterface=wlan0
driver=nl80211
ssid=guanlei
channel=3
hw_mode=g
ignore_broadcast_ssid=0
auth_algs=1
wpa=3
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK WPA-EAP
wpa_pairwise=TKIP CCMP
拷贝当前目录下生成的hostapd与hostapd.conf文件到开发板上,给hostapd可执行权限。
(4)配置udhcpd
参考网上的资料配置udhcpd.conf文件
udhcpd.conf在busybox下的/examples/udhcpd/目录下
修改如下:
start 192.168.2.20 //修改IP池,起始IP的后两位可以随意,但必须在一个网段。
end 192.168.2.254
interface wlan0 //修改执行dhcp功能的接口
opt dns 8.8.8.8 //修改DNS、网关、netmask
option subnet 255.255.255.0
opt router 192.168.2.1
三、开发板上运行配置文件
理一下所需的文件和文件要放的位置:
/lib/:libnl.so.1
hostapd(执行命令)、hostapd.conf(配置文件)、udhcpd(执行命令)、udhcpd.conf(配置文件)
如果想要启动wlan0还需要一个rt2870的固件。下载地址:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
在开发板下创建/lib/firmware文件夹,将下载下来的linux-firmware/rt2870.bin拷贝到开发板的firmware文件夹下。
接下来开始配置开发板
(1)配置hostapd
>:./hostapd -B hostapd.conf
Configuration file: hostapd.conf
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 3, CWmax: 4, Aifs: 2, TXop: 102.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 4, CWmax: 5, Aifs: 2, TXop: 188.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 5, CWmax: 10, Aifs: 3, TXop: 0.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 5, CWmax: 10, Aifs: 7, TXop: 0.
Using interface wlan0 with hwaddr 00:a1:b0:40:6f:9a and ssid 'xiaohexiansheng'
phy0 -> rt2x00usb_watchdog_tx_status: Warning - TX queue 0 status timed out, invoke forced tx handler
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 2, CWmax: 3, Aifs: 1, TXop: 47.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 3, CWmax: 4, Aifs: 1, TXop: 94.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 4, CWmax: 6, Aifs: 3, TXop: 0.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 4, CWmax: 10, Aifs: 7, TXop: 0.
若出现读取random随机数错误,可采用符号链接的方法解决:
# mv /dev/random /dev/random.org
# ln -s /dev/urandom /dev/random
若出现如下错误:
Failed to create interface mon.wlan0: -23 (Too many open files in system)
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/hostapd/wlan0' manually if it is not used anymore
Failed to setup control interface
wlan0: Unable to setup interface.
解决方案:删除./hostapd的进程,删除/var/run下面的hostapd messages这两个文件
>: ifconfig wlan0 192.168.2.1 netmask 255.255.255.0 (先把要接入点设备设置好)
(2)配置udhcpd
执行udhcpd命令之前需要一个udhcpd.release的租赁文件,在相应的文件夹下创建即可。
>:mkdir -p /var/lib/misc/
>:touch /var/lib/misc/udhcpd.leases
>:udhcpd -f /etc/udhcpd.conf
udhcpd (v1.20.2) started
Sending OFFER of 192.168.2.20
Sending ACK to 192.168.2.20
OK,手机可以连上自己的开发板了。
四、定义防火墙策略实现开发板上网功能
iptables-1.4.12.tar.bz2 下载地址:http://www.netfilter.org/projects/iptables/downloads.html
[xiaohexiansheng@centos6 iptables-1.4.12]$ mkdir install
[xiaohexiansheng@centos6 iptables-1.4.12]$ ./configure --host=/arm-linux --enable-static --disable-shared --prefix=/home/xiaohexiansheng/fl2440/3rdparty/apwifi/iptables-1.4.12/install --disable-ipv6 --disable-largefile
[xiaohexiansheng@centos6 iptables-1.4.12]$ make CC=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc CFALGS=--static LDFLAGS=-static
[xiaohexiansheng@centos6 iptables-1.4.12]$ sudo make install
[xiaohexiansheng@centos6 iptables]$ sudo /opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-strip xtables-multi //strip 减少大小用的
将/install/lib文件夹和xtables-multi打包放到开发板/lib和/bin目录下,赋予可执行权限后将xtables-multi改名为iptables
在开发板上配置nat表。
//将局域网内地址通过eth0接口伪装后转发出去
>:iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
//开启转发功能,允许已建立连接及相关连接对内转发
>: iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISH -j ACCEPT
//对外转发,数据包从wlan0流向eth0
>: iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
/*开启linux 的转发功能! Linux系统是默认进制数据包转发的,所谓的转发就是当主机拥有多块网卡的时候,其中一块收到数据包,根据数据包的目的ip转发到本机的另一张网卡上,该网卡根据路由表继续发送数据包首先保证硬件连通,然后打开系统的转发功能
less /proc/sys/net/ipv4/ip_forward,该文件内容为0,表示禁止数据包转发,1表示允许,将其修改为1。可使用命令echo "1" > /proc/sys/net/ipv4/ip_forward 修改文件内容,重启网络服务或主机后效果不再*/
>:echo "1" >/proc/sys/net/ipv4/ip_forward
到此,手机连上wifi模块就可以上网了。
FL2440 rt3070模块ap模式移植的更多相关文章
- FL2440 rt3070模块station模式移植
---------------------------------------------------------------------------------------------------- ...
- FL2440 rt3070模块station模式动态获取IP地址
---------------------------------------------------------------------------------------------------- ...
- MT7601 AP模式移植
MT7601 的 STA 模式和 AP 模式的驱动,是不一样的. 所以,需要另外移植驱动 驱动源码位置 https://github.com/eywalink/mt7601u 下载之后,先修改 Mak ...
- Android KitKat 4.4 Wifi移植AP模式和网络共享的调试日志
Tethering技术在移动平台上已经运用的越来越广泛了.它能够把移动设备当做一个接入点,其它的设备能够通过Wi-Fi.USB或是Bluetooth等方式连接到此移动设备.在Android中能够将Wi ...
- 3.1 wifi网卡RT3070在S3C2440的移植和使用
学习目标:熟悉RT3070在S3C2440的移植和使用,以及其中的相关工具的安装和使用: 一.配置内核选择WIFI驱动 1. 将usb wifi插到电脑,在ubuntu使用命令:# lsusb 查看w ...
- 关于 RTL8723BS 同时开启 STA/AP 模式
最近接到一个调试 wifi 驱动的任务,使用的是 rtl8723bs 芯片组.要求是让无线设备工作在 station 模式的时候同时开启一个 ap 热点.简单来讲就是连接其他 wifi 的同时发出一个 ...
- Marvell w8782 sdio wifi AP模式设置
http://blog.csdn.net/junllee/article/details/8895908 w8782工作在station模式一切正常,于是想试试AP模式(master mode): A ...
- Nacos源码结构和AP模式注册中心实现介绍
前言 NacosAP模式源码分析目录 微服务下的注册中心如何选择 Nacos使用和注册部分源码介绍 Nacos服务心跳和健康检查源码介绍 Nacos服务发现 Nacos源码结构介绍 Nacos版本基于 ...
- 树莓派配置AP模式
所需硬件:树莓派.无线网卡 1.查看无线网卡是否被识别 pi@raspberrypi ~ $ sudo lsusb Bus Device : ID : Standard Microsystems Co ...
随机推荐
- 为什么VS没有提供平win64程序编写项
最近在学习C++和MFC编程,突然有个疑问,为什么每次新建项目时,都只有win32 console application,从来没见过win64的选项,于是去网上查了查,下面是我找到的几个答案: 作者 ...
- Django-urls路由分发
例如:127.0.0.0:8000/blog/lucaq.html,当有多个应用时,需要在blog应用下进行路由,我们在blog应用下做一个urls路由分发,就需要include模块实现. 导 ...
- xcode自动打ipa包脚本
http://blog.csdn.net/ccf0703/article/details/7999112 文章首发地址:http://webfrogs.github.com/IOS/2012/09/1 ...
- RabbitMQ消息队列(三): 发布/订阅
1. 订阅/发布: 前面worker示例中的每个任务都是只发送给某一个worker,如果我们多个worker都需要接收处理同一个任务,此时就要使用 订阅/发布功能,比如,日志模块产生日志并发送到队列中 ...
- canvas的基础使用。
目录: 创建canvas. 绘制直线.多边形和七巧板. 绘制弧和圆. (有些图过于宽,被挤压了.可以去相册[canvas用到的图.]看原图.) 创建canvas. HTML5的新标签<canva ...
- jquery发送json请求,给springmvc接收
js var obj = { 'name':name, 'desc':desc, 'scheduleStartTime':scheduleStartTime, 'scheduleEndTime':sc ...
- 【 Linux 网络虚拟化 】Openvswitch
openvswitch: openvswitch: 开放的虚拟交换机,虚拟交换就是利用虚拟平台,通过软件的方式形成交换机部件.跟传统的物理交换机相比,虚拟交换机同样具备众多优点: ...
- 【集合类型的并发】Collections.synchronizedList
摘要: 详细的解析:Collections.synchronizedList :关注要点,为什么在有synchroniezed方法的同时会出现 Collections.synchronizedList ...
- python基础之程序交互与数据类型
一.程序交互 1.什么是程序交互? name=input('输入用户名:') #无论用户输入何种内容,input都会存成字符串格式 print(name) 2.为啥要有程序交互? 让计算机能够模拟人, ...
- Mysql快速导出导入数据的实验
一.创建测试数据库 CREATE database example; use example; create TABLE `user` ( `id` ) NOT NULL, `last_name` v ...