概述
文章目录
- 一、配置Linux内核
- 1、配置RTL8762
- 2、配置Wireless
- 二、加载模块
- 2.1 缺固件
- 2.2 打开wlan0
- 2.3 配置连接WiFi
- 连接WiFi
- 获取IP地址--配置DHCP
- 查看网络状态
- ping功能测试
- 三、设置开机启动
开发板:荔枝派zero dock
linux:5.2.y
rootfs:buildroot 2020.02.04
参考:https://blog.csdn.net/xiangkezhi167810/article/details/111564192
一、配置Linux内核
1、配置RTL8762
Linux 内核配置里面使能编译成模块,编译后的.ko驱动文件在drivers/staging/rtl8723bs
目录下:
- 将
r8723bs.ko
驱动模块文件拷贝到根文件系统的/lib/moduel
- 将WiFi固件
rtl8723bs_nic.bin
拷到根文件系统分区/lib/firmware/rtlwifi
目录下
2、配置Wireless
make ARCH=arm menuconfig
- 配置
Networking support
- 配置
Wireless
- 配置
cfg80211 - wireless configuration API
- 配置
Generic IEEE 802.11 Networking Stack (mac80211)
Networking support ----->
Wireless--------->
二、加载模块
# insmod r8723bs.ko
[ 36.481676] r8723bs: module is from the staging directory, the quality is unknown, you have been warned.
[ 36.511062] RTL8723BS: module init start
[ 36.515010] RTL8723BS: rtl8723bs v4.3.5.5_12290.20140916_BTCOEX20140507-4E40
[ 36.522154] RTL8723BS: rtl8723bs BT-Coex version = BTCOEX20140507-4E40
[ 36.530386] pnetdev = 962276c2
[ 36.566061] RTL8723BS: rtw_ndev_init(wlan0)
[ 36.574579] RTL8723BS: module init ret =0
# [ 36.668467] rtl8723bs: acquire FW from file:rtlwifi/rtl8723bs_nic.bin
[ 36.676667] rtl8723bs mmc1:0001:1: Direct firmware load for rtlwifi/rtl8723bs_nic.bin failed with error -2
[ 36.686451] Request firmware failed with error 0xfffffffe
2.1 缺固件
在根文件系统里面新建一个文件夹:mkdir /lib/firmware/rtlwifi
将rtl8723bs_nic.bin文件拷贝进去
再次加载模块,OK啦!
# insmod /lib/modules/r8723bs.ko
[ 18.907777] r8723bs: module is from the staging directory, the quality is unknown, you have been warned.
[ 18.936518] RTL8723BS: module init start
[ 18.940558] RTL8723BS: rtl8723bs v4.3.5.5_12290.20140916_BTCOEX20140507-4E40
[ 18.947601] RTL8723BS: rtl8723bs BT-Coex version = BTCOEX20140507-4E40
[ 18.956571] pnetdev = (ptrval)
[ 18.997777] RTL8723BS: rtw_ndev_init(wlan0)
[ 19.006120] RTL8723BS: module init ret =0
# [ 19.099402] rtl8723bs: acquire FW from file:rtlwifi/rtl8723bs_nic.bin
[ 19.206303] random: crng init done
[ 19.209732] random: 3 urandom warning(s) missed due to ratelimiting
2.2 打开wlan0
# ifconfig wlan0 up
# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:64 errors:0 dropped:0 overruns:0 frame:0
TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4736 (4.6 KiB) TX bytes:4736 (4.6 KiB)
wlan0 Link encap:Ethernet HWaddr 84:20:96:AB:33:12
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
2.3 配置连接WiFi
编辑vi /etc/network/interfaces文件
# Configure Loopback
auto lo
iface lo inet loopback
# wlan0
auto wlan0
iface wlan0 inet dhcp
wpa_supplicant连接WIFI的时候会从配置文件中读取账号和密码,以及加密方式等, 所以我们再运行wpa_supplicant工具的时候要提前写好配置文件。
配置文件名称自定,但是要以 .conf 为后缀,并保存在 /etc/ 目录下,这边给出一个配置文件的例子。
编辑vi /etc/wpa_supplicant.conf 文件:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
ssid="KKKK"
scan_ssid=1
key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
pairwise=TKIP CCMP
group=CCMP TKIP WEP104 WEP40
psk="99999999"
priority=5
}
创建一个socket通信的目录
mkdir -p /var/run/wpa_supplicant
连接WiFi
wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
连接上WiFi了!
# wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
# [ 551.186574] RTL8723BS: rtw_set_802_11_connect(wlan0) fw_state = 0x00000008
[ 551.434341] RTL8723BS: start auth
[ 551.537068] RTL8723BS: auth success, start assoc
[ 551.545614] RTL8723BS: rtw_cfg80211_indicate_connect(wlan0) BSS not found !!
[ 551.552751] RTL8723BS: assoc success
[ 551.920760] RTL8723BS: send eapol packet
[ 551.932044] RTL8723BS: send eapol packet
[ 551.936675] RTL8723BS: set pairwise key camid:4, addr:c8:e7:d8:34:27:84, kid:0, type:AES
[ 551.969865] RTL8723BS: set group key camid:5, addr:c8:e7:d8:34:27:84, kid:1, type:AES
获取IP地址–配置DHCP
# udhcpc -i wlan0
udhcpc: started, v1.31.1
udhcpc: sending discover
udhcpc: sending select for 192.168.1.108
udhcpc: lease of 192.168.1.108 obtained, lease time 7200
deleting routers
adding dns 202.96.134.33
adding dns 202.96.128.68
查看网络状态
# wpa_cli -iwlan0 status
bssid=c8:e7:d8:34:27:84
freq=2437
ssid=MERCURY_2784
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=192.168.1.108
address=84:20:96:ab:33:12
uuid=7574b47e-48e1-5457-ab19-3a4cde3b2130
ping功能测试
# ping www.baidu.com
PING www.baidu.com (14.215.177.38): 56 data bytes
64 bytes from 14.215.177.38: seq=0 ttl=56 time=7.935 ms
64 bytes from 14.215.177.38: seq=1 ttl=56 time=7.928 ms
64 bytes from 14.215.177.38: seq=2 ttl=56 time=7.468 ms
64 bytes from 14.215.177.38: seq=3 ttl=56 time=7.711 ms
64 bytes from 14.215.177.38: seq=4 ttl=56 time=8.665 ms
64 bytes from 14.215.177.38: seq=5 ttl=56 time=7.852 ms
64 bytes from 14.215.177.38: seq=6 ttl=56 time=10.686 ms
64 bytes from 14.215.177.38: seq=7 ttl=56 time=7.569 ms
^C
--- www.baidu.com ping statistics ---
8 packets transmitted, 8 packets received, 0% packet loss
round-trip min/avg/max = 7.468/8.226/10.686 ms
非常nice !
三、设置开机启动
新建一个rc.local文件到/etv/init.d目录下
# vi /etc/init.d/rc.local
内容:
!/bin/sh
sh /etc/init.d/auto_wifi_link.sh
echo "wifi finish!!"
创建脚本auto_wifi_link.sh放到/etc/init.d/目录下
# vi /etc/init.d/auto_wifi_link.sh
内容:
#!/bin/sh
insmod /lib/modules/r8723bs.ko
ifconfig wlan0 up
wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
sleep 3s
udhcpc -i wlan0
修改开机启动项 vi /etc/inittab
在# now run any rc scripts
后加入如下
::sysinit:/etc/init.d/rc.local
如下:
# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
#
# Note: BusyBox init doesn't support runlevels. The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: <id>:<runlevels>:<action>:<process>
#
# id == tty to run on, or empty for /dev/console
# runlevels == ignored
# action == one of sysinit, respawn, askfirst, wait, and once
# process == program to run
# Startup the system
::sysinit:/bin/mount -t proc proc /proc
::sysinit:/bin/mount -o remount,rw /
::sysinit:/bin/mkdir -p /dev/pts
::sysinit:/bin/mkdir -p /dev/shm
::sysinit:/bin/mount -a
::sysinit:/bin/hostname -F /etc/hostname
# now run any rc scripts
::sysinit:/etc/init.d/rcS
::sysinit:/etc/init.d/rc.local #看这里!!!!
# Put a getty on the serial port
#console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL
::respawn:-/bin/sh
# Stuff to do for the 3-finger salute
#::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r
修改rc.local 权限
# chmod 755 /etc/init.d/rc.local
rc.local就能够正常工作了。
reboot重启看到自动导入驱动然后连接wifi得到ip地址
最后
以上就是发嗲大侠为你收集整理的全志V3s学习记录(12)RTL8723BS的使用一、配置Linux内核二、加载模块三、设置开机启动的全部内容,希望文章能够帮你解决全志V3s学习记录(12)RTL8723BS的使用一、配置Linux内核二、加载模块三、设置开机启动所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复