OpenWrt Forum Archive

Topic: Compile rtl8812au driver for Chaos Calmer

The content of this topic has been archived on 13 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
im currently running OpenWrt Chaos Calmer 15.05 on my Raspberry Pi and i need to compile the rtl8812au driver for OpenWrt.
I need this to get my Edimax EW-7811UTC to work. I need an Wifi Stick running on a 5,4 ghz frequency to run it in my company. Well i tried several other wifi dongle to work on OpenWrt but no success for the 5,4 ghz range so i try to compile the driver for this wifi dongle. After some research i found an makefile for OpenWrt shown in the link below
https://gist.github.com/Ins1ghtLabs/c34 … 257d1b4a2d
and the source code for the driver here:
https://github.com/gnab/rtl8812au 
also i checked the OpenWrt page to compile the package (kernel Package):
https://wiki.openwrt.org/doc/devel/packages

I know there are some things missing in the makefile. I know i have to add the pkg-source section and this shouldn´t be a problem.  My problem is the install section which is missing there. I think i need that section to install the package on my raspberry pi so which lines do i have to add to the makefile or is this makefile ready to use?

thanks in advance

I know there are some things missing in the makefile. I know i have to add the pkg-source section and this shouldn´t be a problem.


See Build/Prepare - the source code gets copied from a local directory (probably one where the code was unpacked to) - this is often done in OpenWrt - some packages have "src" subdirectories.

I My problem is the install section which is missing there. I think i need that section to install the package on my raspberry pi so which lines do i have to add to the makefile or is this makefile ready to use?

From the looks it is ready to use - the OpenWrt Kernel make macros should handle it

  FILES:= $(PKG_BUILD_DIR)/8812au.ko
  AUTOLOAD:=$(call AutoLoad,rtl8812au)

this should package the necessary module and create rules to load the driver module once the kmod-.... is installed

Thanks for the fast answer.

So i can just cross compile this code on my Linux machine with the SDK and install it with make install package on my Openwrt system? or do i have to rebuild my OpenWrt with the ImageBuilder including the package?
Because i already setup my whole System which means a lot of work and hopefully just adding this package to my System.
Im gonna try to compile this and see whats happen.
thanks

Well it seems like i have to do some more work. I tried to compile it with the SDK even at start i get the first error.
There is a file called <drv_types.h> requiered to include but i don´t get it why it Shows an error. I checked the package/include dir and this file is available there so why it says no such file or directory.

(Last edited by Taulin on 19 Jan 2016, 11:29)

Well the Makefile is for OpenWrt buildroot - dunno if using the SDK will make it work - maybe some further adjustment regarding include paths is needed

Hmm ok so i have to go on with the buildroot. But there is still one problem. When i use the build root it gonna use the newest kernel Version but i need the package with the kernelversion for the 15.05 release Version 3.18.20 so is it possible to get the buildroot for older releases of the kernel ? And where do i find it?

Thanks for your help

Thanks so i go for the 15.05 releas branch there and download it. Hopefully it´s the right kernel Version im gonna reply when im stucking again thanks for your help.

I tried it with the buildroot but also with no success. First i got the same error as before but i solved it by coping the files from the include folder to my build_dir(but i think this is not the best solution). After this error i got the following error and i have no clue how to solve this. I also cannot find anything by seraching for this error on web.

/home/debian/chaoscalmer/openwrt-483dac8/build_dir/target-arm_arm1176jzf-s+vfp_uClibc-0.9.33.2_eabi/linux-brcm2708_bcm2708/RTL8812AU/core/rtw_cmd.c:1959:27: warning: unused variable 'TDLSoption' [-Wunused-variable]
  struct TDLSoption_param *TDLSoption; 

I also got this error too:

 rtwmlme_ext.h:919:4: error: #error "Must be LITTLE or BIG Endian"

I searched for that Endian thing and found it in the source makefile and it should be set on Little endian but still this error occurs.
So i hope you guys can help to get it to work

BTW i tried 3 diffrent source Codes which i found on Web but all giving me the same error so i think my problem is the OpenWrt makefile. I think im not pointing to the right paths but i don´t know how to set them.

This is my makefile which i found on web:

 #
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=RTL8812AU
PKG_VERSION:=1.0
PKG_RELEASE:=1



PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

define KernelPackage/rtl8812au
  SUBMENU:=Wireless Drivers
  TITLE:=Driver for RTL8812AU wireless chipsets
  VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)
  FILES:= $(PKG_BUILD_DIR)/8812au.ko
  AUTOLOAD:=$(call AutoLoad,rtl8812au)
endef



EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
EXTRA_CFLAGS += -O1


#EXTRA_CFLAGS += -I$(src)/include

CONFIG_RTL8812A = y
CONFIG_RTL8821A = y
CONFIG_USB_HCI = y
CONFIG_MP_INCLUDED = y
CONFIG_POWER_SAVING = y
CONFIG_PLATFORM_ARM_RPI = y


export TopDIR ?= $(shell pwd)

ifeq ($(CONFIG_USB_HCI), y)
HCI_NAME = usb
endif


_OS_INTFS_FILES :=    os_dep/osdep_service.o \
            os_dep/linux/os_intfs.o \
            os_dep/linux/$(HCI_NAME)_intf.o \
            os_dep/linux/$(HCI_NAME)_ops_linux.o \
            os_dep/linux/ioctl_linux.o \
            os_dep/linux/xmit_linux.o \
            os_dep/linux/mlme_linux.o \
            os_dep/linux/recv_linux.o \
            os_dep/linux/ioctl_cfg80211.o \
            os_dep/linux/rtw_android.o


_HAL_INTFS_FILES :=    hal/hal_intf.o \
            hal/hal_com.o \
            hal/hal_com_phycfg.o \
            hal/hal_phy.o \
            hal/led/hal_$(HCI_NAME)_led.o

_OUTSRC_FILES := hal/OUTSRC/odm_debug.o    \
        hal/OUTSRC/odm_interface.o\
        hal/OUTSRC/odm_HWConfig.o\
        hal/OUTSRC/odm.o\
        hal/OUTSRC/HalPhyRf.o


########### HAL_RTL8812A_RTL8821A #################################

ifneq ($(CONFIG_RTL8812A)_$(CONFIG_RTL8821A), n_n)

RTL871X = rtl8812a
ifeq ($(CONFIG_USB_HCI), y)
MODULE_NAME = 8812au
endif

_HAL_INTFS_FILES +=  hal/HalPwrSeqCmd.o \
                    hal/$(RTL871X)/Hal8812PwrSeq.o \
                    hal/$(RTL871X)/Hal8821APwrSeq.o\
                    hal/$(RTL871X)/$(RTL871X)_xmit.o\
                    hal/$(RTL871X)/$(RTL871X)_sreset.o

_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
            hal/$(RTL871X)/$(RTL871X)_phycfg.o \
            hal/$(RTL871X)/$(RTL871X)_rf6052.o \
            hal/$(RTL871X)/$(RTL871X)_dm.o \
            hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
            hal/$(RTL871X)/$(RTL871X)_cmd.o \
            hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
            hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
            hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
            hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o

ifeq ($(CONFIG_SDIO_HCI), y)
_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
else
ifeq ($(CONFIG_GSPI_HCI), y)
_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
else
_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
endif
endif

ifeq ($(CONFIG_MP_INCLUDED), y)
_HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
endif

ifeq ($(CONFIG_RTL8812A), y)
EXTRA_CFLAGS += -DCONFIG_RTL8812A
_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8812A_FW.o\
        hal/OUTSRC/$(RTL871X)/HalHWImg8812A_MAC.o\
        hal/OUTSRC/$(RTL871X)/HalHWImg8812A_BB.o\
        hal/OUTSRC/$(RTL871X)/HalHWImg8812A_RF.o\
        hal/OUTSRC/$(RTL871X)/HalHWImg8812A_TestChip_FW.o\
        hal/OUTSRC/$(RTL871X)/HalHWImg8812A_TestChip_MAC.o\
        hal/OUTSRC/$(RTL871X)/HalHWImg8812A_TestChip_BB.o\
        hal/OUTSRC/$(RTL871X)/HalHWImg8812A_TestChip_RF.o\
        hal/OUTSRC/$(RTL871X)/HalPhyRf_8812A.o\
        hal/OUTSRC/$(RTL871X)/odm_RegConfig8812A.o
endif

ifeq ($(CONFIG_RTL8821A), y)

ifeq ($(CONFIG_RTL8812A), n)
ifeq ($(CONFIG_USB_HCI), y)
MODULE_NAME := 8821au
endif
ifeq ($(CONFIG_PCI_HCI), y)
MODULE_NAME := 8821ae
endif
endif

ifeq ($(CONFIG_SDIO_HCI), y)
MODULE_NAME := 8821as
endif

EXTRA_CFLAGS += -DCONFIG_RTL8821A
_OUTSRC_FILES += hal/OUTSRC/rtl8821a/HalHWImg8821A_FW.o\
        hal/OUTSRC/rtl8821a/HalHWImg8821A_MAC.o\
        hal/OUTSRC/rtl8821a/HalHWImg8821A_BB.o\
        hal/OUTSRC/rtl8821a/HalHWImg8821A_RF.o\
        hal/OUTSRC/rtl8821a/HalHWImg8821A_TestChip_MAC.o\
        hal/OUTSRC/rtl8821a/HalHWImg8821A_TestChip_BB.o\
        hal/OUTSRC/rtl8821a/HalHWImg8821A_TestChip_RF.o\
        hal/OUTSRC/rtl8812a/HalPhyRf_8812A.o\
        hal/OUTSRC/rtl8821a/HalPhyRf_8821A.o\
        hal/OUTSRC/rtl8821a/odm_RegConfig8821A.o        
endif    


endif


########### AUTO_CFG  #################################    
        
ifeq ($(CONFIG_AUTOCFG_CP), y)

ifeq ($(CONFIG_MULTIDRV), y)    
$(shell cp $(TopDIR)/autoconf_multidrv_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
else
ifeq ($(CONFIG_RTL8188E)$(CONFIG_SDIO_HCI),yy) 
$(shell cp $(TopDIR)/autoconf_rtl8189e_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
else
$(shell cp $(TopDIR)/autoconf_$(RTL871X)_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
endif
endif

endif

########### END OF PATH  #################################



ifneq ($(USER_MODULE_NAME),)
MODULE_NAME := $(USER_MODULE_NAME)
endif

ifneq ($(KERNELRELEASE),)

rtk_core :=    core/rtw_cmd.o \
        core/rtw_security.o \
        core/rtw_debug.o \
        core/rtw_io.o \
        core/rtw_ioctl_query.o \
        core/rtw_ioctl_set.o \
        core/rtw_ieee80211.o \
        core/rtw_mlme.o \
        core/rtw_mlme_ext.o \
        core/rtw_wlan_util.o \
        core/rtw_vht.o \
        core/rtw_pwrctrl.o \
        core/rtw_rf.o \
        core/rtw_recv.o \
        core/rtw_sta_mgt.o \
        core/rtw_ap.o \
        core/rtw_xmit.o    \
        core/rtw_p2p.o \
        core/rtw_tdls.o \
        core/rtw_br_ext.o \
        core/rtw_iol.o \
        core/rtw_sreset.o\
        core/efuse/rtw_efuse.o

$(MODULE_NAME)-y += $(rtk_core)

$(MODULE_NAME)-$(CONFIG_INTEL_WIDI) += core/rtw_intel_widi.o

$(MODULE_NAME)-$(CONFIG_WAPI_SUPPORT) += core/rtw_wapi.o    \
                    core/rtw_wapi_sms4.o
                    
$(MODULE_NAME)-y += $(_OS_INTFS_FILES)
$(MODULE_NAME)-y += $(_HAL_INTFS_FILES)
$(MODULE_NAME)-y += $(_OUTSRC_FILES)

$(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += core/rtw_mp.o \
                    core/rtw_mp_ioctl.o

ifeq ($(CONFIG_RTL8723A), y)
$(MODULE_NAME)-$(CONFIG_MP_INCLUDED)+= core/rtw_bt_mp.o
endif
ifeq ($(CONFIG_RTL8723B), y)
$(MODULE_NAME)-$(CONFIG_MP_INCLUDED)+= core/rtw_bt_mp.o
endif

obj-$(CONFIG_RTL8812AU_8821AU) := $(MODULE_NAME).o

else

export CONFIG_RTL8812AU_8821AU = m

endif


MAKE_OPTS:= ARCH=$(LINUX_KARCH) CROSS_COMPILE=$(TARGET_CROSS) SUBDIRS="$(PKG_BUILD_DIR)" EXTRA_CFLAGS="$(EXTRA_CFLAGS)"

define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    echo $(PKG_BUILD_DIR)
    $(CP) -r /home/debian/chaoscalmer/rtl8112au/* $(PKG_BUILD_DIR)/
endef

define Build/Compile
    echo $(CONFIG_RTL8812AU_8821AU)
    $(MAKE) -C "$(LINUX_DIR)" \
        $(MAKE_OPTS) \
        modules
endef



$(eval $(call KernelPackage,rtl8812au))

If anyone managed to compile this driver for openwrt pls post me the source and the makefile for openwrt.
thanks

Is there nobody who knows what im currently doing wrong? I really can´t get any of those codes compiled and i don´t have the experience to figure out where my current problem is. So it would be really nice when someone can help me.
Thanks

(Last edited by Taulin on 21 Jan 2016, 08:59)

compiling with an other sourcecode provides an other error. This time it tells me :

'.../build_dir/target-arm_arm1176jzf-s+vfp_uClibc-0.9.33.2_eabi/linux-brcm2708/RTL8812AU/8812au.ko' is missing.

The discussion might have continued from here.