1、驱动移植
1.1驱动下载链接:rtl8723dslinux驱动源码及固件资源-CSDN文库
1.2 rtl8723ds目录拷贝到下Linux 内 核 源 码 中 的 drivers/net/wireless/realtek/目录下。
1.3根据以下代码修改驱动目录下的makefile文件
--- Makefile
+++ Makefile
@@ -19,6 +19,8 @@ ifeq ($(GCC_VER_49),1)
EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later
endif
+EXTRA_CFLAGS += -I$(src)/include
+#else
EXTRA_CFLAGS += -I$(srctree)/$(src)/include
EXTRA_LDFLAGS += --strip-debug
@@ -226,9 +228,14 @@ _HAL_INTFS_FILES := hal/hal_intf.o \
hal/led/hal_$(HCI_NAME)_led.o
+EXTRA_CFLAGS += -I$(src)/platform
+#else
EXTRA_CFLAGS += -I$(srctree)/$(src)/platform
_PLATFORM_FILES := platform/platform_ops.o
+EXTRA_CFLAGS += -I$(src)/hal/btc
+EXTRA_CFLAGS += -I$(src)/hal/phydm
+#else
EXTRA_CFLAGS += -I$(srctree)/$(src)/hal/btc
EXTRA_CFLAGS += -I$(srctree)/$(src)/hal/phydm
2、修改上一级Kconfig Makfie
2.1打开
drivers/net/wireless/ realtek/Kconfig
,在里面加入下面这一行内容:
source "drivers/net/wireless/realtek/rtl8723ds/Kconfig"
2.2打开
drivers/net/wireless/realtek/Makefile
,在里面加入下面以后内容:
obj-$(CONFIG_RTL8723DS) += rtl8723ds/
3、配置内核
3.1
-> 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 //选中
3.2
-> Networking support (NET [=y])
-> Wireless (WIRELESS [=y])
-> <M> cfg80211 - wireless configuration API //
编译成模块
3.3
-> Device Drivers
-> [*] Staging drivers //选中
3.4
-> Device Drivers
-> Network device support (NETDEVICES [=y])
-> Wireless LAN (WLAN [=y])
-> Realtek devices (WLAN_VENDOR_REALTEK [=y])
-> <M> Realtek 8723D SDIO or SPI WiFi //
编译为模块
4、增加设备树
4.1在设备树根目录下添加
wifi_pwrseq: msc1-pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <&gpioh 5 GPIO_ACTIVE_LOW>;
};
4.2添加子节点
/*wifi*/
&sdmmc1 {
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_clk_pins_a>;
pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_clk_pins_a>;
pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
cd-gpios = <&gpiof 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
st,neg-edge;
no-1-8-v;
bus-width = <4>;
vmmc-supply = <&v3v3>;
#address-cells = <1>;
#size-cells = <0>;
non-removable;
mmc-pwrseq = <&wifi_pwrseq>;
status = "okay";
};
5、编译内核和模块
6、修改biuldroot,增加wifi工具配置
→ Target packages
→ Networking applications
→ [*] wireless tools //选中
→[*] Install shared library //选中
→ [*] wpa_supplicant //选中
→ [*] Enable nl80211 support //选中
→[*] Enable AP mode //选中
→ [*] Enable Wi-Fi Display //选中
→ [*] Enable mesh networking //选中
→ [*] Enable autoscan //选中
→ [*] Enable EAP //选中
→ [*] Enable HS20 //选中
→ [*] Enable syslog support //选中
→ [*] Enable WPS //选中
→ [*] Enable WPA3 support //选中
→ [*] Install wpa_cli binary //选中
→ [*] Install wpa_client shared library //选中
→ [*] Install wpa_passphrase binary //选中
→ [*] Enable support for the DBus control interface //选中
→ [*] Introspection support
7、拷贝两个固件到板子/lib/firmware/,拷贝驱动模块到/lib/modules/6下
8、加载模块并测试
ifconfig wlan0 up
iwlist wlan0 scanning
修改wpa_supplicant.conf文件
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1
network={
ssid="ZZK"
psk="xxxxxxxxxxxxx"
}
查看/var/run/wpa_supplicant是否有这个目录没有则创建。
wpa_supplicant.conf
文 件 编 写 好 以 后 再 在 开 发 板 根 文 件 系 统 下 创 建
一 个“
/var/run/wpa_supplicant
”目录,
wpa_supplicant
工具要用到此目录!
wpa_supplicant -Dnl80211 -c /etc/wpa_supplicant.conf -i wlan0 &
udhcpc -i wlan0 //从路由器获取 IP 地址
ping -I 192.168.13.42 www.baidu.com