Advertisement

RTL8189FTV 芯片在全志H3芯片SDK Kernel中的驱动

阅读量:

在linux-orangepi-orange-pi-5.4内核上配置以下参数

(1) Device Drivers --->

[*] Network device support --->

[*] Wireless LAN --->

<*> Realtek 8189F SDIO WiFi

(2) [*] Networking support --->

-*- wireless -->

<*> cfg80211 - wireless configuration API

WIFI 管理软件wpa_supplicant-2.11和wireless_tools.29工具的编译:

准备材料:

(1)dbus-1.13.18.tar.xz

(2) expat-2.2.9.tar.xz

(3) libnl-3.5.0.tar.gz

(4) openssl-3.0.0.tar.gz

(5)wireless_tools.tar.gz

(6)wpa_supplicant-2.11.tar.gz

编译步骤:

(1) dbus-1.13.8

./configure --host=arm-none-linux-gnueabihf --prefix=/work/H3/dbus-1.13.18/_install CFLAGS=-I/work/H3/expat-2.2.9/_install/include/ LDFLAGS=-L/work/H3/expat-2.2.9/_install/lib --disable-selinux

make && make install

(2) expat-2.2.9.tar.xz

./configure --host=arm-none-linux-gnueabihf --prefix=/work/H3/expat-2.2.9/_install

make && make install

(3) libnl-3.5.0.tar.gz

./configure --host=arm-none-linux-gnueabihf --prefix=/home/work/work/H3/libnl-3.5.0/_install CC=arm-none-linux-gnueabihf-gcc

make && make install

(4)openssl-3.0.0.tar.gz

./config shared no-asm --prefix=/home/work/work/H3/openssl-3.0.0/_install --cross-compile-prefix=/opt/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-

make && make install

(5) wireless_tools.tar.gz

进入wireless_tools目录,修改Makefile

CC = arm-none-linux-gnueabihf-gcc

AR = arm-none-linux-gnueabihf-ar

RANLIB = arm-none-linux-gnueabihf-ranlib

make

在目录里拷贝命令文件:ifrename,iwevent,iwlist,iwspy,iwconfig

(6) wpa_supplicant-2.11.tar.gz

进入wpa_supplicant-2.11/wpa_supplicant/里面

cp defconfig .config

修改.config 里面相关内容

CC=arm-none-linux-gnueabihf-gcc

Uncomment following two lines and fix the paths if you have installed OpenSSL

or GnuTLS in non-default location

CFLAGS += -I/home/work/work/H3/openssl-3.0.0/_install/include
LIBS += -L/home/work/work/H3/openssl-3.0.0/_install/lib64
CFLAGS += -I/home/work/work/H3/libnl-3.5.0/_install/include
LIBS += -L/home/work/work/H3/libnl-3.5.0/_install/lib

CFLAGS += -I/home/work/work/H3/dbus-1.13.18/_install/include
LIBS += -L/home/work/work/H3/dbus-1.13.18/_install/lib

执行编译命令:

export PKG_CONFIG_PATH=/home/work/work/H3/libnl-3.5.0/_install/lib/pkgconfig:$PKG_CONFIG_PATH

make

拷贝命令:wpa_cli,wpa_supplicant,wpa_passphrase

至此所有相关源码以及编译成功,将以上源码的相关bin和lib文件拷贝进开发板中sbin和lib中

运行wpa_supplicant 命令前准备:

创建 /etc/wpa_supplicant.conf文件,添加以下内容

wpa_passphrase 热点名称 热点密码 > /etc/wpa_supplicant.conf

修改:

ctrl_interface=/var/run/wpa_supplicant
update_config=1
ap_scan=1
network={
ssid="热点名称"
psk="密码"
key_mgmt=WPA-PSK

}

执行wpa_supplicant 命令

wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf

使用udhcpc -i wlan0 分配IP, 发现分配到IP 但未设置IP,检测/usr/share/udhcpc/default.script 文件是否有存在,不存在则添加:

#!/bin/sh

udhcpc script edited by Tim Riker Tim@Rikers.org

RESOLV_CONF="/etc/resolv.conf"

[ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; }

NETMASK=""
if command -v ip >/dev/null; then
[ -n "subnet" ] && NETMASK="/subnet"
else
[ -n "subnet" ] && NETMASK="netmask subnet"
fi
BROADCAST="broadcast +"
[ -n "broadcast" ] && BROADCAST="broadcast broadcast"

case "1" in deconfig) echo "Clearing IP addresses on interface, upping it"
if command -v ip >/dev/null; then
ip -4 addr flush dev interface ip link set dev interface up
else
ifconfig $interface 0.0.0.0
fi
;;

renew|bound)
echo "Setting IP address ip on interface"
if command -v ip >/dev/null; then
ip addr add ipNETMASK BROADCAST dev interface
else
ifconfig interface ip NETMASK BROADCAST
fi

if [ -n "router" ] ; then echo "Deleting routers" while route del default gw 0.0.0.0 dev interface ; do
:
done

metric=0
for i in router ; do echo "Adding router i"
if [ "$subnet" = "255.255.255.255" ]; then

special case for /32 subnets:

/32 instructs kernel to always use routing for all outgoing packets

(they can never be sent to local subnet - there is no local subnet for /32).

Used in datacenters, avoids the need for private ip-addresses between two hops.

ip route add i dev interface
fi
route add default gw i dev interface metric $((metric++))
done
fi

If the file is a symlink somewhere (like /etc/resolv.conf

pointing to /run/resolv.conf), make sure things work.

if test -L "$RESOLV_CONF"; then

If it's a dangling symlink, try to create the target.

test -e "RESOLV_CONF" || touch "RESOLV_CONF"
fi
realconf=(readlink -f "RESOLV_CONF" 2>/dev/null || echo "RESOLV_CONF") echo "Recreating realconf"
tmpfile="realconf-$"

"tmpfile" [ -n "domain" ] && echo "search domain" >> "tmpfile"
for i in dns ; do echo " Adding DNS server i"
echo "nameserver i" >> "tmpfile"
done
mv "tmpfile" "realconf"
;;
esac

exit 0

chomd 0755 default.script

这时再执行dhcpc -i wlan0 就能设置IP了

关于wpa_cli 上使用出错问题没找到具体问题,也不去找了

参考:

linux下WIFI模块使用:wpa_supplicant工具交叉编译以及配置 - 闹闹爸爸 - 博客园

[Linux-openssl移植到ARM_openssl 3.3.0移植到arm-博客]( "Linux-openssl移植到ARM_openssl 3.3.0移植到arm-博客")

全部评论 (0)

还没有任何评论哟~