Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save weedy/cb042f4a11d2a5f94d1b228820be9184 to your computer and use it in GitHub Desktop.
Save weedy/cb042f4a11d2a5f94d1b228820be9184 to your computer and use it in GitHub Desktop.
OpenWRT RTL8812AU Makefile
#
# 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:=RTL8812A
PKG_VERSION=2016-09-11-$(PKG_SOURCE_VERSION)
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/uminokoe/rtl8812AU.git
PKG_SOURCE_VERSION:=688f6ac5e412ecfa074d33d95e9c11202f301d95
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
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_TRAFFIC_PROTECT = y
CONFIG_LOAD_PHY_PARA_FROM_FILE = y
CONFIG_BR_EXT = y
CONFIG_PLATFORM_MIPS_AR9132 = 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)
$(PKG_UNPACK)
endef
define Build/Compile
echo $(CONFIG_RTL8812AU_8821AU)
$(MAKE) -C "$(LINUX_DIR)" M=$(PKG_BUILD_DIR) \
$(MAKE_OPTS) modules
endef
$(eval $(call KernelPackage,rtl8812au))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment