background:
The company's products with the motherboard supports wifi interfaces, in order to enhance the product's features, make the underlying support wifi.
Overview
The main process is as follows:
Kernel Configuration + For + software-driven transplant transplant + software configuration
Kernel Configuration
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)
As additional AP hotspot
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
Software migration
Based on the data, the relevant transplant wifi drive each tool as follows:
Package | Explanation |
---|---|
WirelessTools | Only support WEP authentication |
wpa_supplicant | Support WPA authentication |
hostapd | hostapd enables wireless card switch to master mode, analog AP (generally may be considered a router) function Soft AP (Soft AP) |
dhcpcd | dhcpcd is to achieve DHCP client, it can run as a background daemon. |
A script to compile 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 "\t@echo skip by Schips" >> Makefile
echo "install_docs:" >> Makefile
echo "\t@echo 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