嵌入式ARM-Linux平台上的编译、配置和运行使用
wpa_supplicant编译和配置运行
从https://w1.fi/wpa_supplicant/(git地址git://w1.fi/hostap.git)下载最新的wpa_supplicant源码压缩包,目前最新的为版本2.5. wpa_supplicant的编译依赖于openssl和libnl库(Netlink Protocol Library Suite (libnl)),openssl是ssl协议的开源库(OpenSSL, Secure Sockets Layer (SSL v2/v3) Transport Layer Security (TLS v1)).(压缩包地址:http://www.openssl.org/source/,Git地址:https://github.com/openssl/openssl),libnl是网络相关的库(压缩包地址:http://www.infradead.org/~tgr/libnl/,Git地址 :http://git.infradead.org/users/tgr/libnl.git)。
编译libnl
解压源代码包。进入libnl目录,执行./configure配置编译环境;执行make进行编译
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
./configure --prefix=/usr\
--sysconfdir=/etc \
--disable-static&&
make
然后执行sudo make install,libnl.so会被安装至/usr/local/lib/目录下,相应的头文件也会被copy到/usr/local/include/netlink下。
如果报出编译错误:“../include/netlink_local.h:218:error ULONG_MAX undeclared",我们在对应文件添加一个头文件#include
编译openssl
进入openssl目录,./config shared #一定要加shared,否则编译出来的是静态库。执行make进行编译,完成后执行make install,编译好的openssl库和头文件等被安装在目录/usr/local/ssl下
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
./config --prefix=/usr\
--openssldir=/etc/ssl \
--libdir=lib\
shared\
zlib-dynamic &&
make
If you want to disable installing the static libraries, use this sed:
sed -i s# libcrypto.a##;s# libssl.a## Makefile
Now, as therootuser:
make MANDIR=/usr/share/man MANSUFFIX=ssl install &&
install -dv -m755 /usr/share/doc/openssl-1.0.2e&&
cp -vfr doc/*/usr/share/doc/openssl-1.0.2e
编译wpa_supplicant
添加修改配置文件
进入wpa_supplicant/wpa_supplicant目录,执行cp defconfig .config拷贝生成编译配置,然后修改配置文件.config,
#如果选择的不是libnl的1.0版本,需要根据libnl的版本打开下面的选项
CONFIG_LIBNL32=y
CONFIG_LIBNL20=y选择libnl的版本
#添加openssl和libnl的头文件和库文件目录,更新编译链接环境变量
CFLAGS += -I/usr/local/ssl/include
CFLAGS += -I/usr/local/include/ libnl3
CFLAGS += -I/usr/local/include/netlink
LIBS += -L/usr/local/ssl/lib
LIBS += -L/usr/local/lib
LIBS_p += -L/usr/local/ssl/lib#不加此行,编wpa_passphrase出错。
cp defconfig .config
make CC=arm-linux-gnueabi-gcc
make install DESTDIR=/home/export/rootfs
执行make进行编译
成功后生成三个目标文件wpa_supplicant, wpa_cli, wpa_passphrase,至此编译完成。
运行wpa_supplicant
需要保证libssl库在我们的搜索路径里,否则不做处理,会出现找不到libnl, ssl和crypto库的错误。
./wpa_supplicant
./wpa_supplicant: error while loading shared libraries: libssl.so.1.1.0: cannot open shared object file: No such file or directory
将/usr/local/ssl/lib下的libssl.so.x.x.x和libcrypto.so.xxx拷贝到/lib目录下即可,或者:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ssl/lib,或者在/etc/ld.so.conf文件中添加库的搜索路径。(或者在/etc/ld.so.conf.d下新建一个.conf文件,将搜索路径一行一个加入).
cp /usr/arm-linux-gnueabi/lib/libnl.so.1.1.4 /home/export/rootfs/lib/
cp /usr/arm-linux-gnueabi/lib/libcrypto.so.1.0.0 /home/export/rootfs/lib/
cp /usr/arm-linux-gnueabi/lib/libssl.so.1.0.0 /home/export/rootfs/lib/
配置wpa_supplicant
wpa_supplicant runs as a daemon and requires a configuration file. Create a file called /etc/wpa_supplicant.conf with the following contents:
network={
ssid="MySSID"
key_mgmt=WPA-PSK
proto=RSN
pairwise=CCMP TKIP
psk="MyPassPhrase"
}
The above file works with both WPA (TKIP) and WPA2 (CCMP/AES). Please insert your access point name at MySSID and you
ARM-Linux平台编译配置运行使 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)