rtl8812AU and/or rtl8814AU drivers

Hi I'm no programmer too just a hack.
Unfortunately, I haven't build for 8814au in a while since I switch to a dedicated AP and I tried to build a few times before I post this and no luck.
The makefile is basically derived from openwrt/package/kernel/rtl8812au-ct/Makefile
I'll post mine anyway, you might find something useful.


include $(TOPDIR)/rules.mk

PKG_NAME:=rtl8814au
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/aircrack-ng/rtl8812au.git
PKG_SOURCE_DATE:=2019-09-02
PKG_SOURCE_VERSION:=57871abeba6152c4b75778240caff889a17b0c2b
PKG_BUILD_PARALLEL:=1

STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h

include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk

define KernelPackage/rtl8814au
  SUBMENU:=Wireless Drivers
  TITLE:=Realtek RTL8814AU support
  DEPENDS:= +kmod-usb-core +kmod-cfg80211 @USB_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SU$
  FILES:= $(PKG_BUILD_DIR)/88XXau.ko
  AUTOLOAD:=$(call AutoLoad,100,88XXau,1)
endef

NOSTDINC_FLAGS = \
        -I$(PKG_BUILD_DIR) \
        -I$(PKG_BUILD_DIR)/include \
        -I$(STAGING_DIR)/usr/include/mac80211-backport \
        -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
        -I$(STAGING_DIR)/usr/include/mac80211 \
        -I$(STAGING_DIR)/usr/include/mac80211/uapi \
        -include backport/backport.h

define Build/Compile
        $(MAKE) -C "$(PKG_BUILD_DIR)" \
                ARCH="$(LINUX_KARCH)" \
                CROSS_COMPILE="$(TARGET_CROSS)" \
                NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
                modules
endef

$(eval $(call KernelPackage,rtl8814au))

Depends on your target platform, I also had to make changes to the src Makefile to get something compiling. Last time I was able to build the module I think I had to remove -Werror in OpenWrt just to build the module, but can't remember were exactly.
This is as far as I was able to build untill I got an error:

./include/net/iw_handler.h:528:7: note: expected 'struct iw_event *' but argument is of type 'struct iw_event *'
 char *iwe_stream_add_point(struct iw_request_info *info, char *stream,
       ^~~~~~~~~~~~~~~~~~~~
./include/net/iw_handler.h: At top level:
./include/net/iw_handler.h:549:39: warning: 'struct iw_event' declared inside parameter list will not be visible outside of this definition or declaration
       char *value, char *ends, struct iw_event *iwe,
                                       ^~~~~~~~
In file included from /home/dell/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/rtl8814au-2019-09-02-57871abe/include/drv_types.h:30:0,
                 from /home/dell/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/rtl8814au-2019-09-02-57871abe/core/rtw_cmd.c:17:
/home/dell/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/rtl8814au-2019-09-02-57871abe/include/ieee80211.h:386:5: warning: "WIRELESS_EXT" is not defined, evaluates to 0 [-Wundef]
 #if WIRELESS_EXT < 17
     ^~~~~~~~~~~~
In file included from /home/dell/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/rtl8814au-2019-09-02-57871abe/core/rtw_cmd.c:17:0:
/home/dell/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/rtl8814au-2019-09-02-57871abe/include/drv_types.h:1510:23: error: field 'iwstats' has incomplete type
  struct iw_statistics iwstats;
                       ^~~~~~~
cc1: some warnings being treated as errors
make[5]: *** [scripts/Makefile.build:304: /home/dell/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/rtl8814au-2019-09-02-57871abe/core/rtw_cmd.o] Error 1
make[4]: *** [Makefile:1517: _module_/home/dell/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/rtl8814au-2019-09-02-57871abe] Error 2
make[4]: Leaving directory '/home/dell/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/linux-4.19.69'
make[3]: *** [Makefile:1599: modules] Error 2
make[3]: Leaving directory '/home/dell/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/rtl8814au-2019-09-02-57871abe'
make[2]: *** [Makefile:46: /home/dell/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/rtl8814au-2019-09-02-57871abe/.built] Error 2
make[2]: Leaving directory '/home/dell/myfeeds/rtl8814au'
time: package/feeds/localfeed/rtl8814au/compile#4.05#1.12#4.79
make[1]: *** [package/Makefile:113: package/feeds/localfeed/rtl8814au/compile] Error 2
make[1]: Leaving directory '/home/dell/openwrt'
make: *** [/home/dell/openwrt/include/toplevel.mk:218: package/rtl8814au/compile] Error 2

I will try to keep building and see how far I can go.
BTW I build from git master.

yes, I also got werror warnings. what I found was if you delete the

NOSTDINC_FLAGS = \
        -I$(PKG_BUILD_DIR) \
        -I$(PKG_BUILD_DIR)/include \
        -I$(STAGING_DIR)/usr/include/mac80211-backport \
        -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
        -I$(STAGING_DIR)/usr/include/mac80211 \
        -I$(STAGING_DIR)/usr/include/mac80211/uapi \
        -include backport/backport.h

the compile will be success. but the module won't work.

I will post my Makefile and patches later

Drivers for RTL8812AU are included in OpenWrt 19.07.

You might want to check it here:

1 Like

Hi all

Is there any particular hint to make it to work?

I am using a rtl8812au dongle on Raspberri PI4 on snapshot

The dongle is recognized but the first strange thing comes from the configuration page, where in 5Ghz there is no possibility to change between AC and N mode.

But trying to bring up and access point in 5Ghz oe 2.4Ghz return hostpad errors and after a while the drivers is uninit

Bye

Try building the driver from this source:https://github.com/aircrack-ng/rtl8812au/pull/619
I had tested with rtl8811, rtl8812au and rtl8814au USB WiFi dongles, working well and has AC mode support.

How could I test that driver?

You have to download the source driver and cross compile or add it to OpenWrt Buildroot as a patch https://github.com/1Jeff1/openwrt/commit/5249b47cc4658ee78cb2a94362d3401cea90e9cd.patch

1 Like

Should I download the patch? In which directory?

From the root directory:

wget https://github.com/1Jeff1/openwrt/commit/5249b47cc4658ee78cb2a94362d3401cea90e9cd.patch

patch -p 1 -i 5249b47cc4658ee78cb2a94362d3401cea90e9cd.patch
2 Likes

Do they work as APs?
A drawback to Realtek was they didn't (same with Intel)... I think.

@jeff1 Are you able to give a look at the 8812BU driver and try to build it in Openwrt?
I tried but with no success, I have limited knowledge of Openwrt build system

BTW tried the driver built in the latest snapshot
Actually it is working as bad as the -ct one currently in the repo
I am not able to run it in AC mode, sometimes it works in N mode @2.4Ghz, but slow and for example there is no rate indication

I want to try this driver on the nanopi r2s, but I get this error when is compiling:

rtl8812au-ac-2020-05-20-fc0194c1/os_dep/linux/ioctl_cfg80211.c:10072:25: error: initialization of 'int (*)(struct wiphy *, struct wireless_dev *, u64)' {aka 'int (*)(struct wiphy *, struct wireless_dev *, long long unsigned int)'} from incompatible pointer type 'void (*)(struct wiphy *, struct wireless_dev *, u16,  bool)' {aka 'void (*)(struct wiphy *, struct wireless_dev *, short unsigned int,  _Bool)'} [-Werror=incompatible-pointer-types]
.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
 ^~~~~~~~~~~~~~~~~~~
rtl8812au-ac-2020-05-20-fc0194c1/os_dep/linux/ioctl_cfg80211.o] Error 1

I updated the rtl8812au-ac driver, It should work now.
https://github.com/1Jeff1/openwrt/commit/af426db0e78c3880a6bfe26fa97ae03caccce783.patch

3 Likes

Thanks @jeff1 I was able to compile the WiFi driver for the NanoPi R2S and confirm working with my dongle Alfa AWUS036ACS with no issues at all, also this driver works better than the one used on friendlywrt as this support AC WiFi.

How did you set it up? By CLI or GUI?

I set it up using GUI, I'm not familiarized with CLI.

I mean by LuCI? Because I have an Archer T4UHP with the rtl8812au chipset and it doesn't work.

@jeff1
I managed to compile your rtl8812au-ac driver package as single package for 19.07.3 on a Archer C2600 (have modified 0003-wireless-5.8.patch to match the older kernel code). The driver can do a successful scan on my ASUS USB-AC56 wifi device (after having problems with the delivered rtl8812au-ct driver).

The problem is, that I am not able to successfully connect to a hotspot:

root@Gate:~# logread | grep -e radio2 -e wlan4wan2 -e wwan2
Sun Aug  9 18:30:00 2020 cron.info crond[1026]: USER root pid 14653 cmd /usr/sbin/hotspot-login wlan4wan2>/dev/null
Sun Aug  9 18:45:00 2020 cron.info crond[1026]: USER root pid 25764 cmd /usr/sbin/hotspot-login wlan4wan2>/dev/null
Sun Aug  9 18:52:21 2020 daemon.notice netifd: Interface 'wwan2' is disabled
Sun Aug  9 18:52:21 2020 daemon.notice netifd: Interface 'wwan2' has link connectivity loss
Sun Aug  9 18:52:21 2020 daemon.notice netifd: wwan2 (25295): udhcpc: received SIGTERM
Sun Aug  9 18:52:21 2020 daemon.notice netifd: Interface 'wwan2' is now down
Sun Aug  9 18:52:21 2020 daemon.notice wpa_supplicant[25221]: wlan4wan2: CTRL-EVENT-DISCONNECTED bssid=ec:58:ea:12:10:88 reason=3 locally_generated=1
Sun Aug  9 18:52:21 2020 daemon.notice wpa_supplicant[25221]: nl80211: deinit ifname=wlan4wan2 disabled_11b_rates=0
Sun Aug  9 18:52:21 2020 daemon.notice wpa_supplicant[25221]: wlan4wan2: CTRL-EVENT-TERMINATING
Sun Aug  9 18:52:22 2020 daemon.notice netifd: radio2 (31285): command failed: Not supported (-95)
Sun Aug  9 18:52:22 2020 kern.info kernel: [ 8665.496512] IPv6: ADDRCONF(NETDEV_UP): wlan4wan2: link is not ready
Sun Aug  9 18:52:22 2020 daemon.notice netifd: Network device 'wlan4wan2' link is up
Sun Aug  9 18:52:22 2020 daemon.notice netifd: Interface 'wwan2' is enabled
Sun Aug  9 18:52:22 2020 daemon.notice netifd: Interface 'wwan2' has link connectivity
Sun Aug  9 18:52:22 2020 daemon.notice netifd: Interface 'wwan2' is setting up now
Sun Aug  9 18:52:22 2020 daemon.notice netifd: wwan2 (31551): udhcpc: started, v1.30.1
Sun Aug  9 18:52:22 2020 daemon.notice netifd: wwan2 (31551): udhcpc: sending discover
Sun Aug  9 18:52:27 2020 daemon.notice netifd: wwan2 (31551): udhcpc: sending discover
Sun Aug  9 18:52:27 2020 daemon.notice wpa_supplicant[31463]: wlan4wan2: Trying to associate with ec:58:ea:12:10:88 (SSID='WiFi4rlp' freq=2437 MHz)
Sun Aug  9 18:52:27 2020 daemon.notice wpa_supplicant[31463]: wlan4wan2: CTRL-EVENT-STARTED-CHANNEL-SWITCH freq=2437 ht_enabled=1 ch_offset=0 ch_width=20 MHz cf1=2437 cf2=0
Sun Aug  9 18:52:29 2020 daemon.notice wpa_supplicant[31463]: wlan4wan2: Associated with ec:58:ea:12:10:88
Sun Aug  9 18:52:29 2020 daemon.notice wpa_supplicant[31463]: wlan4wan2: CTRL-EVENT-CONNECTED - Connection to ec:58:ea:12:10:88 completed [id=0 id_str=]
Sun Aug  9 18:52:29 2020 daemon.notice wpa_supplicant[31463]: wlan4wan2: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Sun Aug  9 18:52:29 2020 kern.info kernel: [ 8672.120113] IPv6: ADDRCONF(NETDEV_CHANGE): wlan4wan2: link becomes ready
Sun Aug  9 18:52:31 2020 user.notice mwan3[32642]: Execute ifdown event on interface wwan2 (unknown)
Sun Aug  9 18:52:31 2020 user.info mwan3track[3548]: Detect ifdown event on interface wwan2 (wlan4wan2)
Sun Aug  9 18:52:31 2020 user.notice mwan3track[3548]: Interface wwan2 (wlan4wan2) is offline
Sun Aug  9 18:52:32 2020 daemon.notice netifd: wwan2 (31551): udhcpc: sending discover
config wifi-device 'radio2'
        option path 'platform/soc/soc:usb30@1/10000000.dwc3/xhci-hcd.1.auto/usb4/4-1/4-1:1.0'
        option type 'mac80211'
        option htmode 'VHT80'
        option country 'DE'
        option channel '6'
        option hwmode '11g'

config wifi-iface 'wwan2'
        option device 'radio2'
        option ifname 'wlan4wan2'
        option network 'wwan2 wwan2_6'
        option mode 'sta'
        option ssid 'WiFi4rlp'
        option encryption 'none'
        option macaddr 'XX:XX:XX:XX:XX:XX'
config interface 'wwan2'
        option proto 'dhcp'
        option hostname 'android-xxxxxxxxxx'
        option macaddr 'XX:XX:XX:XX:XX:XX'
        option metric '2'
        option peerdns '0'
        list dns '8.8.8.8'
        list dns '1.1.1.1'
        list dns '8.8.4.4'
        list dns '1.0.0.1'

config interface 'wwan2_6'
        option ifname '@wwan2'
        option proto 'dhcpv6'
        option reqaddress 'try'
        option reqprefix 'auto'
        option metric '2'

Any idea why the wifi disconnects directly? The same config works on a other device.

Thanks for creating this patch and for using the aircrack driver! I am able to scan!
Haven't previously been able to do that.