背景:
公司用的产品主板支持wifi接口,为了加强产品的功能,做wifi的底层支持。
概览
主要的流程如下:
内核配置 + 有关驱动的移植 + 软件的移植 + 软件的配置
内核配置
Networking support
<*> RF switch subsystem support --->
[*] Power off on suspend (NEW)
<*> Generic rfkill regulator driver
(防止使用wpa_supplicant会出现rfkill: Cannot open RFKILL control device错误。)
-*- Wireless --->
<*> cfg80211 - wireless configuration API
[*] nl80211 testmode command
[*] enable powersave by default
[*] cfg80211 wireless extensions compatibility
<*> Generic IEEE 802.11 Networking Stack (mac80211)
作为AP热点的额外配置
Device Drivers --->
[*] Network device support --->
[*] Wireless LAN --->
<*> IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)
[*] Support downloading firmware images with Host AP driver
[*] Support for non-volatile firmware download
软件移植
根据有关资料,移植wifi有关驱动各工具如下:
软件包 | 说明 |
---|---|
WirelessTools | 只支持WEP认证方式 |
wpa_supplicant | 支持WPA认证方式 |
hostapd | hostapd能够使得无线网卡切换为master模式,模拟AP(通常可以认为是路由器)功能软AP(Soft AP) |
dhcpcd | dhcpcd是DHCP client的实现,可以作为后台守护进程运行。 |
一个脚本编译 wpa_supplicant:
##
# Copyright By Schips, All Rights Reserved
# https://gitee.com/schips/
# File Name: make.sh
# Created : Tue 10 Dec 2019 05:42:56 PM CST
#!/bin/sh
BUILD_HOST=arm-linux
ARM_GCC=${BUILD_HOST}-gcc
BASE=`pwd`
OUTPUT_PATH=${BASE}/install
OPENSSL=openssl-1.0.2t
WPA_SUPPLICANT=wpa_supplicant-0.7.3
make_dirs() {
cd ${BASE}
mkdir compressed install source -p
}
download_package () {
cd ${BASE}/compressed
#下载包
wget https://www.openssl.org/source/${OPENSSL}.tar.gz
wget -c http://w1.fi/releases/${WPA_SUPPLICANT}.tar.gz
}
tar_package () {
cd ${BASE}/compressed
ls * > /tmp/list.txt
for TAR in `cat /tmp/list.txt`
do
tar -xf $TAR -C ../source
done
rm -rf /tmp/list.txt
}
pre_make_ssl () {
cd ${BASE}/source/${OPENSSL}
startLine=`sed -n '/install_html_docs\:/=' Makefile | awk -F\b '{ print $1 }'`
echo $startLine
# 为了避免 多行结果
for startline in $startLine
do
lineAfter=99
endLine=`expr $startline + 999`
sed -i $startline','$endLine'd' Makefile
echo "install_html_docs:" >> Makefile
echo "\[email protected] skip by Schips" >> Makefile
echo "install_docs:" >> Makefile
echo "\[email protected] skip by Schips" >> Makefile
echo "# DO NOT DELETE THIS LINE -- make depend depends on it." >> Makefile
break
done
}
make_openssl () {
cd ${BASE}/source/${OPENSSL}
echo "SSL ABOUT"
./Configure --prefix=${OUTPUT_PATH}/${OPENSSL} os/compiler:${ARM_GCC}
pre_make_ssl
make && make install
}
make_wpa () {
cd ${BASE}/source/wpa*/wpa*
cp defconfig .config
echo "CC=${ARM_GCC} -L${OUTPUT_PATH}/${OPENSSL}/lib" >> .config
echo "CFLAGS += -I${OUTPUT_PATH}/${OPENSSL}/include" >> .config
echo "LIBS += -L${OUTPUT_PATH}/${OPENSSL}/lib" >> .config
make
}
make_dirs
download_package
tar_package
make_openssl
make_wpa
原文地址:https://www.cnblogs.com/schips/p/12168153.html
时间: 2024-10-04 12:47:00