参考网址: http://wangye.org/blog/archives/845/

http://blog.csdn.net/lme525/article/details/37762519

     http://blog.sina.com.cn/s/blog_6e228288010153uq.html

通过命令启用hostapd热点时,需要将手机设置为静态ip才能认证通过

参照以下方法:

wpa_supplicant 和hostapd可能需要 openssl libnl 所以需要先交叉编译这两个工具

1)

openssl-1.0.2e 交叉编译方法

tar -xf openssl-1.0.2e.tar.gz

cd openssl-1.0.2e

AR=mipsel-linux-ar RANLIB=mipsel-linux-ranlib CC=mipsel-linux-gcc /usr/bin/perl ./Configure shared linux-generic32 --prefix=/home/loongson/tools/wpa_supplicant/install

make

make install

说明:

AR/RANDLIB/CC 环境变量 是确保Makefile中使用mipsel-linux 系列工具

/usr/bin/perl ./Configure  表示执行perl脚本

Configure 注意第一个字母是大写

shared 表示要编译动态库,

linux-generic32 表示生成目标平台名称

--prefix 指明安装目录.

2)

libnl-1.1.4 交叉编译方法

tar -xf libnl-1.1.4.tar.gz

./configure --prefix=/home/loongson/tools/wpa_supplicant/install CC=mipsel-linux-gcc --host=mips

make

make install

说明:

libnl的最新版本是libnl-3.x 但是在编译wpa_supplicant时需要用到某个头文件,只有libnl-1.1.4提供,所以使用libnl-1.1.4

3)

wpa_supplicant-2.5 交叉编译方法

tar -xf wpa_supplicant-2.5.tar.gz

cd wpa_supplicant-2.5/wpa_supplicant

创建配置文件:cp defconfig .config

修改配置文件.config :

CFLAGS += -I/home/loongson/tools/wpa_supplicant/install/include

LIBS += -L/home/loongson/tools/wpa_supplicant/install/lib

LIBS_p += -L/home/loongson/tools/wpa_supplicant/install/lib

LIBS_c += -L/home/loongson/tools/wpa_supplicant/install/lib

CC = mipsel-linux-gcc

CONFIG_TLS=openssl

make

4)

最后把编译出来的 wpa_cli wpa_supplicant wpa_passphrase 复制到开发板的根文件系统

把/home/loongson/tools/wpa_supplicant/install/lib/目录下的 libcrypto.* libnl.* libssl.*库文件复制到开发板的根文件系统 的/lib下

5)

无线网卡配置例子

/* 无线网卡设置 */

wpa_passphrase "Loongson-Product" loongson425 > /tmp/supplicant.conf

ifconfig wlan0 up

wpa_supplicant -B -Dwext -iwlan0 -c /tmp/supplicant.conf

udhcpc -b -i wlan0

ifconfig wlan0 192.168.2.144

route add default gw 192.168.2.1

ping 192.168.2.1

自动获取ip

从Busybox的examples/udhcp/下复制 simple.script文件到开发板/usr/share/udhcpc/下,并重命名为default.script,然后更改文件default.script的权限,

chmod a+x default.script

wpa_passphrase "Loongson-Product" loongson425 > /tmp/supplicant.conf

wpa_supplicant -B -Dwext -iwlan0 -c /tmp/supplicant.conf

udhcpc -i wlan0

6)

hostapd 交叉编译方法

tar -xf hostapd-2.5.tar.gz

cd hostapd-2.5/hostapd

cp defconfig .config

修改.config文件,添加

CFLAGS += -I/home/loongson/tools/wpa_supplicant/install/include

LIBS += -L/home/loongson/tools/wpa_supplicant/install/lib

LIBS_p += -L/home/loongson/tools/wpa_supplicant/install/lib

LIBS_c += -L/home/loongson/tools/wpa_supplicant/install/lib

CC = mipsel-linux-gcc

CONFIG_DRIVER_WIRED=y

CONFIG_TLS=openssl

make

生成hostapd和hostapd.conf文件,复制到开发板的根文件系统,库文件同wpa_passphrase

1.

hostapd.conf放到开发板根文件系统的/etc目录下

把原来hostapd.conf文件的内容清空,hostapd.conf配置文件修改如下

interface=wlan0

driver=nl80211

ssid=DMF_WiFi

channel=3

hw_mode=g

ignore_broadcast_ssid=0

auth_algs=1

wpa=3

wpa_passphrase=87654321

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP

rsn_pairwise=CCMP

2.

从busybox的examples/udhcp/下复制 udhcpd.conf文件到开发板根文件系统的/etc目录下

udhcpd.conf配置文件根据实际使用修改,如

start192.168.0.20

end192.168.0.254

interfacewlan0

optdns192.168.10.2 192.168.10.10

optionsubnet255.255.255.0

optrouter192.168.10.2

optwins192.168.10.10

一般修改这几个就可以

3.

开发板的根文件系统的/var/lib/misc/目录下添加 udhcpd.leases文件,udhcpd在执行的时候可能会提示没有一个叫做udhcpd.release的租赁文件,这个只要在相应的文件夹下创建即可

4.

最后执行

hostapd -B /etc/hostapd.conf

ifconfig wlan0 192.168.0.1 netmask 255.255.255.0   (先把要接入点设备设置好,否则其他无线网卡接入到该ap时会分配不到地址)

udhcpd /etc/udhcpd.conf

则可以实现wifi热点的启用

要实现开发板wifi_ap访问外网,则需要以下操作:

开发板eth1连接路由器,路由器可以访问外网,路由器网关是:192.168.2.1 DNS:192.168.1.1

1)

首先使开发板的eth1可以访问外网

自动获取ip

udhcpc -i eth1

ping www.baidu.com

ping通,说明可以访问外网

2)

wifi设置为ap模式,这里使用的是rt3070的usb wifi

hostapd -B /etc/hostapd.conf

ifconfig wlan0 192.168.0.1 netmask 255.255.255.0   (先把要接入点设备设置好,否则其他无线网卡接入到该ap时会分配不到地址)

udhcpd /etc/udhcpd.conf

hostapd.conf配置文件内容:

interface=wlan0

driver=nl80211

ssid=DMF_WiFi

channel=3

hw_mode=g

ignore_broadcast_ssid=0

auth_algs=1

wpa=3

wpa_passphrase=87654321

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP

rsn_pairwise=CCMP

udhcpd.conf配置文件内容(修改的部分):

start192.168.0.20

end192.168.0.254

interfacewlan0

optdns192.168.2.1 192.168.2.1  #这里是路由的网关地址?不是DNS:192.168.1.1?

optionsubnet255.255.255.0

optrouter192.168.0.1

optwins192.168.0.1

3)

设置iptables wlan0的访问转发到eth1

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

iptables -A FORWARD -i eth1 -o wlan0 -m state --state RELATED,ESTABLISH -j ACCEPT

iptables -A FORWARD -i wlan0 -o eth1 -j ACCEPT

echo 1 > /proc/sys/net/ipv4/ip_forward

文档的下载及文件下载:http://pan.baidu.com/s/1ntsvbb7#path=%252Floongson1%252Ftools%252Fwifi

开发板支持wifi的更多相关文章

  1. iTOP-4418/6818开发板支持锂电池供电方案

    iTOP-4418/6818开发板支持的是官方推荐的AXP228电池管理,动态调频,更稳定可靠,支持充放电电路与电量计(库化计), 广泛应用于各种电子产品中. 4418开发板中锂电池充放电接口,适用于 ...

  2. 迅为IMX6开发板支持4G全网通模块GPS模块

    IMX6开发板特点 处理器:IMX6开发板支持4G全网通模块GPS模块. 核心板配置:2GB DDR3内存  16GB EMMC 存储,扩展引脚多达320个:运行温度-20 ℃到+80 ℃之间. 核心 ...

  3. [资料分享]迅为iTOP4412开发板-SDIO WiFi移植文档

    本文转自迅为:http://www.topeetboard.com 概述 近期需要把WiFi无线网络功能移植到iTOP-4412 开发平台,查阅了相关资料,经过一段时间的研究.调试,终于成功的将WiF ...

  4. 迅为IMX6开发板支持全网通4G模块丨GPS模块丨WIFI蓝牙丨千兆以太网

    迅为i.MX6开发板丨迅为i.MX6Q开发板丨四核imx6开发板丨Cortec-A9开发板丨资料介绍: 特点: 处理器:Freescale Cortex-A9四核i.MX6Q主频1GHz 核心板配置: ...

  5. iTOP-i.MX6Q开发板支持安卓Android6.0系统

    迅为IMX6开发板: Android4.4/6.0系统  Linux + Qt5.7系统  Ubuntu12.04系统 部分案例:HMI:3D打印机:医疗设备:工控机:触控一体机:车载终端 核心板兼容 ...

  6. iTOP-6818开发板支持AXP228电源管理[官方推荐最佳匹配]_支持动态调频

    iTOP-6818开发板与4418开发板共兼容同一底板: 核心板:::::: 尺寸 50mm*60mm 高度 核心板连接器组合高度1.5mm PCB层数 6层PCB沉金设计 4418 CPU ARM ...

  7. 基于TQ2440开发板的WiFi模块的使用经验总结

    一.软.硬件资源准备: 内核版本:linux-2.6.30.4 交叉编译器版本:4.3.3 wpa_supplicant工具:wpa_supplicant-0.7.3.tar ; openssl-0. ...

  8. iTOP-4418/6818开发板支持双屏异显,双屏同显

    iTOP-4418/6818开发板平台安卓系统下支持双屏异显,双屏同显,客户可按照不同用途,分别播放适合屏幕显示方式的内容 ,如HDMI屏幕和LCD屏幕显示不同内容, 一个屏幕播放广告,另一个屏幕运行 ...

  9. 迅为iMX6开发板支持单核,双核,四核处理器,为客户产品选择提供灵活性

    本文转自迅为:http://topeetboard.com 店铺:https://arm-board.taobao.com 处理器:Freescale Cortex-A9 四核 i.MX6Q 主频 1 ...

随机推荐

  1. JS-流程控制汇集

    <!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>流 ...

  2. SSH(Struts Spring Hibernate开发框架)

    Spring(Model) Spring的核心思想是IoC和AOP,Spring使得管理对象更加方便,极大的降低组件之间的耦合度,实现了软件各层之间的解耦. Struts(View) 使用Struts ...

  3. CSS的4种引入方式及优先级

    第一:css的四种引入方式 1.行内样式 最直接最简单的一种,直接对HTML标签使用style="",例如: <p style="color:#F00; " ...

  4. css重点章节复习—布局-边框-边距-浮动 (部分)

    css重点章节复习—布局-边框-边距-浮动 在第二个任务中,这一块的后面那条线真的弄了很久.起初也是在html里面写的代码.之后觉得这样不好,想到第一个页面中用到的border-bottom和bord ...

  5. ASP.NET 递归将分类绑定到 TreeView

    CREATE TABLE [dbo].[sysMenuTree]([NoteId] [decimal](18, 0) NOT NULL,[ParentId] [decimal](18, 0) NULL ...

  6. git的基本操作

    今天给同事培训了一下git的使用流程,简单记录一下 1,基本概念, 远程库和本地库. 2, git clone git://url/*.git clone远程的代码库到本地 3. 创建本地分支 当前是 ...

  7. phpexcel操作

    <?php include './PHPExcel/PHPExcel.php'; include './PHPExcel/PHPExcel/Writer/Excel2007.php'; //或者 ...

  8. 关于centos的yum代理设置

    10. 有代理服务器时使用 yum默认情况下,yum 通过 HTTP 连接到网络上的仓库.所有 yum HTTP 操作都使用 HTTP/1.1,与支持这一标准的 web 代理服务器兼容.您也可以连接到 ...

  9. javaWeb加载Properties文件

    public static Properties loadProps(String fileName) { Properties props = null; InputStream is = null ...

  10. Java——包的概念及使用

    package是在使用多个类或接口时,为了避免名称重复而采用的一种措施,直接在程序中加入package关键字即可 编译语法: javac -d . HelloWord.java -d:表示生成目录,生 ...