hostapd移植「建议收藏」

hostapd移植「建议收藏」内核版本:linux-2.6.39开发板平台:at91sam9x35wifi模块:rt3070 先说一下wifi的两种常见的模式。AP模式:AccessPoint,提供无线接入服务,允许其它无线设备接入,提供数据访问,一般的无线路由/网桥工作在该模式下。AP和AP之间允许相互连接。Station模式:类似于无线终端,station本身并不接受无线的接入,它可以连接到AP

大家好,又见面了,我是你们的朋友全栈君。

内核版本:linux-2.6.39

开发板平台:at91sam9x35

wifi模块:rt3070

 

先说一下wifi的两种常见的模式。

AP模式: Access Point,提供无线接入服务,允许其它无线设备接入,提供数据访问,一般的无线路由/网桥工作在该模式下。AP和AP之间允许相互连接。

Station模式:类似于无线终端,station本身并不接受无线的接入,它可以连接到AP,一般无线网卡即工作在该模式。

hostapd就是使wifi模块工作在AP模式。

 

一.添加内核对rt3070的支持。

 

make menuconfig:
  [*] Networking support  —>
     -*-   Wireless  —>
            <*>   cfg80211 – wireless configuration API
            [ ]     nl80211 testmode command
            [ ]     enable developer warnings
            [ ]     cfg80211 regulatory debugging
            [*]     enable powersave by default
            [ ]     use statically compiled regulatory rules database
            [*]     cfg80211 wireless extensions compatibility
            [*]   Wireless extensions sysfs files        
            <*>   Common routines for IEEE802.11 drivers 
            [ ]   lib80211 debugging messages (NEW)   
            <*>   Generic IEEE 802.11 Networking Stack (mac80211)
            [ ]   PID controller based rate control algorithm (NEW)
            [*]   Minstrel (NEW)        
            [*]     Minstrel 802.11n support (NEW)  
                  Default rate control algorithm (Minstrel)  —>
            [ ]   Enable mac80211 mesh networking (pre-802.11s) support (NEW)
            [ ]   Select mac80211 debugging features (NEW)  —> 
   
  Device Drivers  —>
       [*] Network device support  —>
            [*]   Wireless LAN  —>
                 <*>   Ralink driver support  —>
                      — Ralink driver support
                      < >   Ralink rt2500 (USB) support (NEW)
                      < >   Ralink rt2501/rt73 (USB) support (NEW)
                      <*>   Ralink rt27xx/rt28xx/rt30xx (USB) support
                      [ ]     rt2800
   usb – Include support for rt33xx devices
                      [ ]     rt2800usb – Include support for rt35xx devices (EXPERIMENTAL) (NEW)
                      [ ]     rt2800usb – Include support for rt53xx devices (EXPERIMENTAL) (NEW)
                      [ ]     rt2800usb – Include support for unknown (USB) devices (NEW)
                      [ ]   Ralink debug output (NEW)

hostapd依赖openssl和libnl,所以先移植openssl和libnl

二.编译openssl

编译openssl需要wpa_supplicant里面的patch包
[lingyun@localhost hostapd]$wget http://www.openssl.org/source/openssl-0.9.8e.tar.gz
[lingyun@localhost hostapd]$ wget http://hostap.epitest.fi/releases/wpa_supplicant-2.0.tar.gz
[lingyun@localhost hostapd]$ tar -xzf openssl-0.9.8e.tar.gz
[lingyun@localhost hostapd]$ tar -xzf wpa_supplicant-2.0.tar.gz
[lingyun@localhost hostapd]$ cd openssl-0.9.8e
[lingyun@localhost openssl-0.9.8e]$ cp ../wpa_supplicant-2.0/patches/openssl-0.9.8e-tls-extensions.patch .
[lingyun@localhost openssl-0.9.8e]$ patch -p1 < ./openssl-0.9.8e-tls-extensions.patch
[lingyun@localhost openssl-0.9.8e]$ vim Makefile

# CRYPTO_MDEBUG – turns on my ‘memory leak’ detecting stuff
# MFUNC – Make all Malloc/Free/Realloc calls call
#       CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
#       call application defined callbacks via CRYPTO_set_mem_functions()
# MD5_ASM needs to be defined to use the x86 assembler for MD5
# SHA1_ASM needs to be defined to use the x86 assembler for SHA1
# RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
# Do not define B_ENDIAN or L_ENDIAN if ‘unsigned long’ == 8.  It must
# equal 4.
# PKCS1_CHECK – pkcs1 tests.

CROSS=/opt/buildroot-2011.11/arm926t/usr/bin/arm-linux-
CC=${CROSS}gcc
CXX=${CROSS}g++
AR=${CROSS}ar $(ARFLAGS)r
AS=${CROSS}as
LD=${CROSS}ld
NM=${CROSS}nm
RANLIB=${CROSS}ranlib
STRIP=${CROSS}strip

INSTALL_PREFIX=

#INSTALLTOP=/usr/local/ssl
INSTALLTOP=/home/lingyun/zhouyou/hostapd/install

# Do not edit this manually. Use Configure –openssldir=DIR do change this!

#OPENSSLDIR=/usr/local/ssl
OPENSSLDIR=/home/lingyun/zhouyou/hostapd/install

[lingyun@localhost openssl-0.9.8e]$ sudo make
[lingyun@localhost openssl-0.9.8e]$ sudo make install
[lingyun@localhost install]$ ls
bin  certs  include  lib  man  misc  openssl.cnf  private

三.编译libnl

libnl是为了方便应用程序使用netlink接口而开发的一个库。这个库为原始netlink(是用以实现用户进程与内核进程通信的一种特殊的进程间通信(IPC) ,也是网络应用程序与内核通信的最常用的接口)消息传递以及不同的netlink family专用接口提供了一个统一的接口。移植libnl1.1是hostapd的移植的一部分,所以在移植hostapd之前先要移植libnl。

lingyun@localhost hostapd]$ wgethttp://www.infradead.org/~tgr/libnl/files/libnl-1.1.tar.gz
[lingyun@localhost hostapd]$ tar -zxf libnl-1.1.tar.gz
[lingyun@localhost hostapd]$ cd libnl-1.1
[lingyun@localhost libnl-1.1]$ ls
aclocal.m4  configure.in  include     libnl-1.pc     Makefile.opts.in  tests
ChangeLog   COPYING       install-sh  libnl-1.pc.in  Makefile.rules
configure   doc           lib         Makefile       src
[lingyun@localhost libnl-1.1]$ ./configure –host=arm –prefix=/home/lingyun/zhouyou/hostapd/install2
[lingyun@localhost libnl-1.1]$ make CC=/opt/buildroot-2011.11/arm926t/usr/bin/arm-linux-gcc AR=/opt/buildroot-2011.11/arm926t/usr/bin/arm-linux-ar RADNLIB=/opt/buildroot-2011.11/arm926t/usr/bin/randlib STRIP=/opt/buildroot-2011.11/arm926t/usr/bin/arm-linux-strip
[lingyun@localhost libnl-1.1]$ make install

make后会出现错误:,../include/netlink-local.h:218: error: ‘ULONG_MAX’ undeclared (first use in this function)
解决的方法在include/netlink-local.h里面加一个头文件#include <limits.h>

[lingyun@localhost hostapd]$ ls install2
include  lib

将install2/lib/下所有文件拷贝至开发板的/lib目录下,确保hostapd在开发板上运行,能够正确找到libnl库的位置。

四。移植hostapd

[lingyun@localhost hostapd]$wget http://hostap.epitest.fi/releases/hostapd-0.7.3.tar.gz
[lingyun@localhost hostapd]$ tar -zxf hostapd-0.7.3.tar.gz
[lingyun@localhost hostapd-0.7.3]$ ls
COPYING  hostapd  patches  README  src
[lingyun@localhost hostapd-0.7.3]$ cd hostapd/
[lingyun@localhost hostapd]$ cp defconfig .config
[lingyun@localhost hostapd]$ vim .config

# Driver interface for Host AP driver
CONFIG_DRIVER_HOSTAP=y

CROSS = /opt/buidroot-2011.11/arm926t/usr/bin/arm-linux-
OPENSSL_PATH=/home/lingyun/zhouyou/hostapd
PRJ_TOP=/home/lingyun/zhouyou/hostapd
CC=${CROSS}gcc
CFLAGS+=-I${OPENSSL_PATH}/install/include
LDFLAGS+=-L${OPENSSL_PATH}/install/lib -lssl

 # Driver interface for wired authenticator

#CONFIG_DRIVER_WIRED=y

 # Driver interface for madwifi driver

#CONFIG_DRIVER_MADWIFI=y

#CFLAGS += -I../../madwifi # change to the madwifi source directory

 # Driver interface for drivers using the nl80211 kernel interface

CONFIG_DRIVER_NL80211=y
LIBNL=${PRJ_TOP}/install2
CFLAGS += -I${LIBNL}/include/
LIBS += -L${LIBNL}/lib

# Wi-Fi Protected Setup (WPS)

CONFIG_WPS=y

# Enable UPnP support for external WPS Registrars

 

# IEEE 802.11n (High Throughput) support

CONFIG_IEEE80211N=y

 

# a file that usually has extension .p12 or .pfx)

#CONFIG_PKCS12=y

 

# Build IPv6 support for RADIUS operations

#CONFIG_IPV6=y

[lingyun@localhost hostapd]$ make

make后就会生成hostapd和hostapd_cli

 在开发板执行如下命:

~ >: ./hostapd -v
hostapd v0.7.3
User space daemon for IEEE 802.11 AP management,
IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Copyright (c) 2002-2010, Jouni Malinen <j@w1.fi> and contributors

这就表示hostapd移植成功了

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/143314.html原文链接:https://javaforall.net

(0)
上一篇 2022年5月11日 上午10:40
下一篇 2022年5月11日 上午11:00


相关推荐

  • 墙裂推荐9个在线图片压缩网站[通俗易懂]

    墙裂推荐9个在线图片压缩网站[通俗易懂]转载自:https://www.zcool.com.cn/article/ZNTQzNDYw.html?switchPage=on1.Tinypng网址:https://tinypng.com/Tinypng可以说是很受大家欢迎的一个图片压缩站点,不管对于前端工程师或者设计师来说都是一个不错的图片压缩工具。Tinypng的操作方式也十分的简单,上传、压缩、下载,流程十分的简单,网站不仅仅支…

    2022年6月18日
    35
  • Hello-Agents智能体生命周期管理:从设计、开发到维护的完整流程

    Hello-Agents智能体生命周期管理:从设计、开发到维护的完整流程

    2026年3月15日
    2
  • 腾讯混元翻译1.5:格式化模板自定义使用教程

    腾讯混元翻译1.5:格式化模板自定义使用教程

    2026年3月13日
    1
  • springboot整合kafka入门

    springboot整合kafka入门springboot整合kafka入门kafka基本概念本机安装kafka测试安装kafka(mac下)本机测试kafkaspringboot整合kafka(IDEA)测试kafka基本概念producer:生产者,负责发布消息到kafkacluster(kafka集群)中。生产者可以是web前端产生的pageview,或者是服务器日志,系统CPU、memory等。consumer:消费者,每个consumer属于一个特定的consuergroup(可为每个consumer指定group

    2025年6月12日
    6
  • C++解决大整数加法

    C++解决大整数加法c 解决大整数加法问题描述 求两个不超过 200 为的非负整数的和输入数据 输入有两行 每行是一个不超过 200 位的非负整数 没有多于的前导 0 输出要求 输出只一行 即相加后的结果 结果里不能有多于的前导 0 即如果结果是 342 那么就不能输出 0342 输入样例 输出样例 55555

    2026年3月26日
    2
  • 编写测试用例方法—-因果图&判定表

    编写测试用例方法—-因果图&判定表因果图:一、应用场合       在一个界面中,有多个控件,测试的时候要考虑控件的组合关系,不同的控件组合会产生不同的输出结果的组合,为了弄清什么样的输入组合会产生什么样的输出组合,使用因果图法。 二、因果图核心1、因—-原因,输入条件2、果—-结果,输出结果使用图形的方式,分析软件输入和输出的对应关系。 三、图形符号1、基本图形    表示输入和输出的对应关系(1)恒等(-)Ⓐ(输入、因…

    2022年8月14日
    6

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号