糖尿病康复,内容丰富有趣,生活中的好帮手!
糖尿病康复 > linux rtl8723bu 蓝牙 RTL8723BU(wifi Bluetooth) 移植

linux rtl8723bu 蓝牙 RTL8723BU(wifi Bluetooth) 移植

时间:2018-09-12 03:14:21

相关推荐

linux rtl8723bu 蓝牙 RTL8723BU(wifi Bluetooth) 移植

源码:RTL8723BU_WiFi_linux_v4.4.2_18635_BTCOEX1228-664a.1006.zip

下载地址:/download/qq_22902919/10471522

硬件:imx6q

软件:linux3.x

Wifi移植:

1.内核配置

首先需要配置内核, 支持USB设备, 支持wifi设备, 支持IEEE802.11等。

1.1 支持 USB 设备:

[*] USB support --->

Support for Host-side USB

EHCI HCD (USB 2.0) support

OHCI HCD (USB 1.1) support

USB Mass Storage support

ChipIdea Highspeed Dual Role Controller

[*] ChipIdea device controller

[*] ChipIdea host controller

1. 2. 支持 wifi 设备:

[*] 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

1. 3. 支持 IEEE 802.11:

[*] Networking support --->

-*- Wireless --->

cfg80211 - wireless configuration API

Generic IEEE 802.11 Networking Stack (mac80211)

2.sta 模式驱动编译与实现

usb wifi &bt模块采用的核心为rtl8723bu,平台为NXP的IMX6Q。根据提供的驱动为

RTL8723BU_WiFi_linux_v4.4.2_18635_BTCOEX1228-664a.1006.tar.bz2。

2.1. 源码路径

2.1.1 解压源码包并重命名:

$ tar jxvf RTL8723BU_WiFi_linux_v4.4.2.tar.bz2

$ ls

RTL8723BU_WiFi_linux_v4.4.2_18635_BTCOEX1228-664a.1006

$ mv RTL8723BU_WiFi_linux_v4.4.2_18635_BTCOEX1228-664a.1006 rtl8723bu

2.1.2 拷贝源码:

把源码拷贝到到linux-imx/drivers/net/wireless/下

2.2. 驱动源码的修改

解压进入驱动目录,修改rtl8723bu文件夹下的 Makefile, 增加平台类型,默认为 I386_PC,这

里增加 CONFIG_PLATFORM_TI_AM3354 = y,并将其他所有都配置为 n:

在Platform Related中添加:CONFIG_PLATFORM_ARM__IMX6Q = y

增加CONFIG_PLATFORM_ARM__IMX6Q相关配置(在ifeq($(CONFIG_PLATFORM_I386_PC), y)之后添加):

ifeq ($(CONFIG_PLATFORM_ARM__IMX6Q), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN

ARCH := arm

#CROSS_COMPILE := arm-poky-linux-gnueabi-

CROSS_COMPILE := /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi-

KVER := 3.14.28

KSRC := /home/james/work/linux-imx-3.14.28

endif

其中

EXTRA_CFLAGS:小端模式;

ARCH: arm 平台;

CROSS_COMPILE:交叉编译器;

KVER:内核版本号;

KSRC:内核所在目录;

2.3 驱动加载

在make menuconfig中使rtl8723编译进内核:

[*] Network device support --->

[*] Wireless LAN --->

Realtek 8723B USB WiFi

2.4 编译

2.4.1 编译命令

$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi-

2.4.2 错误

2.4.2.1 编译过程有可能发生的errors

最后编译内核,出现macro "__TIME__" might prevent reproducible builds [-Werror=date-time]错误,

只需在相应的Makefile中添加EXTRA_CFLAGS += -Wno-error=date-time (不把该行为当成错误),

2.4.2.2 调试过程有可能发生的errors

在调试中发现驱动一直在循环重启,只需在rtl8723bu/include/autoconf.h中屏蔽#define CONFIG_DEBUG这个宏.

2.5 模块的应用调试

2.5.1 启动wifi模块

$ ifconfig -a

$ ifconfig wlan0 up

$ ifconfig

2.5.2 扫描热点

$ iwlist wlan0 scanning

2.5.3 模块连接到路由器

因为现在的无线wifi网络大多是wpa 加密。没有wpa_supplicant工具的请移植wpa_supplicant。

2.5.3.1 建立wpa_supplicant.conf

$ vim /etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant

update_config=1

ctrl_interface_group=root

ap_scan=1

network={

ssid="Baidu9519"

key_mgmt=WPA-PSK

pairwise=TKIP CCMP

group=CCMP TKIP

psk="19360439"

}

$mkdir -p /var/run/wpa_supplicant

2.5.3.2 连接到路由器

$ wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf &

2.5.2 给模块分配ip有两种模式

自动分配

$ udhcpc -i wlan0

手动分配:必须知道热点IP的分配范围

$ ifconfig wlan0 192.168.95.2

2.5.3 ping

2.5.3.1 ping网关

$ ping 192.168.95.1

注意:如果使用小度WiFi或者其他等随身WiFi时,把Windows的防火墙关闭,否则ping不通网关。

2.5.3.2 ping百度

$ echo nameserver 202.96.134.33 >> /etc/resolv.conf

$ ping

3. SOFTAP实现

3.1 加载驱动

$ ifconfig wlan0 up

$ ifconfig wlan0 192.168.0.2

3.2 编译hostap

编译hostap,解压wpa_supplicant_hostapd-0.8_rtw_r7475.0812.tar.gz

3.2.1 进入hsotapd

$ cd wpa_supplicant_hostapd-0.8_rtw_r7475.0812/hsotapd

3.2.2 编译hsotapd

$ make CC=arm-poky-linux-gnueabi-gcc

编译完成后,会生成hostapd、hostapd_cli等命令。

使用hsotapd时“编译的bin文件No such file or directory”问题

文件是存在,但是该文件所需要的一些库文件,是不存在的。这个时候就需要静态链接。

修改Makefile:

LDFLAGS += -rdynamic

修改为:

LDFLAGS += -static

3.3 拷贝文件

拷贝hostapd、hostapd_cli等命令及配置文件rtl_hostapd_2G.conf到开发板中的/bin下,拷

贝 rtl_hostapd_2G.conf到开发板/etc下,

3.4 启动 hostap

$ hostapd /etc/rtl_hostapd_2G.conf – B

此时,可以用笔记本检测到 wifi信号rtwap,并可以连接上,需要配置静态 IP 地址,

3.5 支持 DHCP

3.5.1.udhcpd.conf文件

从 busybox 源码里的 example/dhcp/下复制 udhcpd.conf文件到我们的文件系统/etc下, 修改里面的interface为wlan0;

3.5.2 开启udhcpd服务

$ udhcpd -fS /etc/udhcpd.conf

Bluetooth移植:

1. 配置驱动

1.1 解压源码

拷贝我们提供的驱动包的 Linux_BT_USB_3.1.0526_8723BU_BTCOEX_0119-5844.rar

驱动源码到工作目录,解压源码;

1. 2 拷贝驱动文件

拷贝 blutooth_usb_driver 目录下驱动文件 blutooth_usb_driver/ rtk_bt.c, rtk_bt.h,

rtk_coex.c, rtk_coex.h 到 内核

/linux/linux-3.2.0-psp04.06.00.11/drivers/bluetooth 目录下,

1. 3 修改内核中 Makefile 和 Kconfig 文件

修改 kernel 目录下的 drivers/bluetooth 下的 Makefile 和 Kconfig 文件,

在 Makefile 中添加如下定义:

obj-$(CONFIG_BT_RTKBTUSB) += rtk_btusb.o

rtk_btusb-y := rtk_coex.o rtk_bt.o

在 Kconfig 中添加如下定义:

config BT_RTKBTUSB

tristate "RTK HCI USB driver"

depends on USB

help

RTK Bluetooth HCI USB driver.

1.4 复制固件

将8723B目录下rtl8723b_fw,rtl8723bu_config拷贝到开发板的/lib/firmware/目录下

2. 配置内核

2.1 选择蓝牙相关的配置,配置RTL8723为编译到内核中并配置其他辅助配置

[*] Networking support --->

Bluetooth subsystem support --->

[*] Bluetooth Classic (BR/EDR) features

RFCOMM protocol support

[*] RFCOMM TTY support

BNEP protocol support

[*] Multicast filter support

[*] Protocol filter support

HIDP protocol support

[*] Bluetooth Low Energy (LE) features

[ ] Bluetooth self testing support

[*] Export Bluetooth internals in debugfs

Bluetooth device drivers --->

[*] HCILL protocol support

RTK HCI USB driver

2.2 返回Networking support 配置界面,RF switch subsystem support配置

[*] Networking support --->

RF switch subsystem support --->

[*] RF switch input support

2.3 进入Input Device Suppor 配置界面,Miscellaneous devices配置

Device Drivers --->

Input device support --->

[*] Miscellaneous devices --->

User level driver support

2.4 进入Generic Driver Options配置页面,Userspace firmwareloading support配置

Generic Driver Options --->

-*- Userspace firmware loading support

[*] Include in-kernel firmware blobs in kernel binary

3. 编译内核

$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi-

4. 蓝牙驱动测试

4.1 启动蓝牙设备

$ hciconfig hci0 up

4.2 查看蓝牙设备

$ hciconfig

4.3 扫描设备

$ hcitool scan

4.4 开启可检测性和连接

$ hciconfig hci0 up piscan

这样,其他设备可通过扫描检测到设备;

4.5 ping测试

$ l2ping xx: xx: xx: xx: xx: xx

如果觉得《linux rtl8723bu 蓝牙 RTL8723BU(wifi Bluetooth) 移植》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。