Help build a module for rtl8812

Hi.
I need a module for rtl8812au from this https://github.com/morrownr/8812au-20210629 form MT7612A SOC.
I use SDK and build this

env STAGING_DIR=/home/vanessa/src/work/MT7612A/openwrt/staging_dir make ARCH=mips CROSS_COMPILE=/home/vanessa/src/work/MT7612A/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux- M=8812au KSRC=/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/linux-5.4.188/
make ARCH=mips CROSS_COMPILE=/home/vanessa/src/work/MT7612A/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux- -C /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/linux-5.4.188/ M=/home/vanessa/src/work/MT7612A/rtl8812au  modules
make[1]: входимо до каталогу «/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/linux-5.4.188»
  CC [M]  /home/vanessa/src/work/MT7612A/rtl8812au/core/rtw_cmd.o
  CC [M]  /home/vanessa/src/work/MT7612A/rtl8812au/core/rtw_security.o
.........
  CC [M]  /home/vanessa/src/work/MT7612A/rtl8812au/hal/phydm/rtl8812a/phydm_rtl8812a.o
  CC [M]  /home/vanessa/src/work/MT7612A/rtl8812au/hal/phydm/txbf/haltxbfjaguar.o
  CC [M]  /home/vanessa/src/work/MT7612A/rtl8812au/platform/platform_ops.o
  CC [M]  /home/vanessa/src/work/MT7612A/rtl8812au/core/rtw_mp.o
  LD [M]  /home/vanessa/src/work/MT7612A/rtl8812au/8812au.o
  Building modules, stage 2.
  MODPOST 1 modules
ERROR: "cfg80211_external_auth_request" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_mgmt_tx_status" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "wiphy_apply_custom_regulatory" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "ieee80211_frequency_to_channel" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_rx_mgmt" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "__cfg80211_alloc_reply_skb" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_new_sta" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_inform_bss_frame_data" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "ieee80211_get_channel" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_unlink_bss" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_connect_done" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_put_bss" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_roamed" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_scan_done" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_ibss_joined" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_michael_mic_failure" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_disconnected" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "__cfg80211_send_event_skb" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_get_bss" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "wiphy_new_nm" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "wiphy_free" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_ready_on_channel" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_ch_switch_started_notify" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_ch_switch_notify" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "wiphy_unregister" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_del_sta_sinfo" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_vendor_cmd_reply" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "cfg80211_remain_on_channel_expired" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "wiphy_register" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
ERROR: "__cfg80211_alloc_event_skb" [/home/vanessa/src/work/MT7612A/rtl8812au/8812au.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make[1]: *** [Makefile:1647: modules] Помилка 2
make[1]: Залишаю каталог "/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/linux-5.4.188"
make: *** [Makefile:2392: modules] Error 2

on x86_64 or Raspberry PI (raspbian os) the module is built without errors.
Where did I make a mistake?
thanks

Those symbols all seem to point to cfg80211, which is another kernel module.

Looking at the Makefile it really seems that is doing a lot more for x86 and ARM64 than for MIPS. MT7621 is MIPS. That's the root of your issue.

Just in general, these Realtek/ Realsil USB wireless vendor drivers are usually something to run away from screaming…

1 Like

But I continued ....
Tried to use the build system. I added a package rtl8812au

$ cat package/kernel/rtl8812au/Makefile
include $(TOPDIR)/rules.mk

PKG_NAME:=rtl8812au
PKG_RELEASE=2

PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=

PKG_SOURCE:=rtl8812au.tar.xz

PKG_BUILD_PARALLEL:=1
#PKG_EXTMOD_SUBDIRS:=rtl8812au-ct

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

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

define KernelPackage/rtl8812au
  SUBMENU:=Wireless Drivers
  TITLE:=Driver for Realtek 8812 AU devices
  DEPENDS:=+kmod-cfg80211 +kmod-usb-core +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT
  FILES:=\
        $(PKG_BUILD_DIR)/rtl8812au.ko
  AUTOLOAD:=$(call AutoProbe,rtl8812au)
  PROVIDES:=kmod-rtl8812au
endef

NOSTDINC_FLAGS := \
        $(KERNEL_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

NOSTDINC_FLAGS+=-DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -DBUILD_OPENWRT

define Build/Compile
        +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
                $(KERNEL_MAKE_FLAGS) \
                M="$(PKG_BUILD_DIR)" \
                NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
                modules
endef

$(eval $(call KernelPackage,rtl8812au))

build it

$ make package/kernel/rtl8812au/compile V=s
make[1]: Entering directory '/home/vanessa/src/work/MT7612A/openwrt'
make[2]: Entering directory '/home/vanessa/src/work/MT7612A/openwrt/package/libs/toolchain'
........
make  -C "/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/linux-5.4.188" KCFLAGS="-fmacro-prefix-map=/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl=target-mipsel_24kc_musl" HOSTCFLAGS="-O2 -I/home/vanessa/src/work/MT7612A/openwrt/staging_dir/host/include -I/home/vanessa/src/work/MT7612A/openwrt/staging_dir/hostpkg/include -I/home/vanessa/src/work/MT7612A/openwrt/staging_dir/target-mipsel_24kc_musl/host/include -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="mipsel-openwrt-linux-musl-" ARCH="mips" KBUILD_HAVE_NLS=no KBUILD_BUILD_USER="" KBUILD_BUILD_HOST="" KBUILD_BUILD_TIMESTAMP="Sat Apr 16 12:59:34 2022" KBUILD_BUILD_VERSION="0" HOST_LOADLIBES="-L/home/vanessa/src/work/MT7612A/openwrt/staging_dir/host/lib" KBUILD_HOSTLDLIBS="-L/home/vanessa/src/work/MT7612A/openwrt/staging_dir/host/lib" CONFIG_SHELL="bash" V=''  cmd_syscalls= KBUILD_EXTRA_SYMBOLS="/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/symvers/gpio-button-hotplug.symvers /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/symvers/mac80211.symvers /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/symvers/mt76.symvers /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/symvers/rtl8812au-ct.symvers /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/symvers/rtl8812au.symvers" KERNELRELEASE=5.4.188 M="/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au" NOSTDINC_FLAGS="-nostdinc  -isystem /home/vanessa/src/work/MT7612A/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/lib/gcc/mipsel-openwrt-linux-musl/8.4.0/include -I/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au -I/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au/include -I/home/vanessa/src/work/MT7612A/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include/mac80211-backport -I/home/vanessa/src/work/MT7612A/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include/mac80211-backport/uapi -I/home/vanessa/src/work/MT7612A/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include/mac80211 -I/home/vanessa/src/work/MT7612A/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include/mac80211/uapi -include backport/backport.h -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -DBUILD_OPENWRT" modules
make[3]: Entering directory '/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/linux-5.4.188'
  CC [M]  /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au/core/rtw_cmd.o
In file included from /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au/include/osdep_service_linux.h:47,
                 from /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au/include/osdep_service.h:53,
                 from /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au/include/drv_types.h:27,
                 from /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au/core/rtw_cmd.c:17:
/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au/include/linux/wireless.h:28:11: fatal error: sys/socket.h: No such file or directory
  #include <sys/socket.h>   /* for "struct sockaddr" et al */
           ^~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.build:262: /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au/core/rtw_cmd.o] Error 1
make[3]: *** [Makefile:1734: /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au] Error 2
make[3]: Leaving directory '/home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/linux-5.4.188'
make[2]: *** [Makefile:53: /home/vanessa/src/work/MT7612A/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/rtl8812au/.built] Error 2
make[2]: Leaving directory '/home/vanessa/src/work/MT7612A/openwrt/package/kernel/rtl8812au'
time: package/kernel/rtl8812au/compile#1.64#0.50#1.86
    ERROR: package/kernel/rtl8812au failed to build.
make[1]: *** [package/Makefile:116: package/kernel/rtl8812au/compile] Error 1
make[1]: Leaving directory '/home/vanessa/src/work/MT7612A/openwrt'
make: *** [/home/vanessa/src/work/MT7612A/openwrt/include/toplevel.mk:230: package/kernel/rtl8812au/compile]

in my opinion it did not find the headers file of the c standard library