|
1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | +# Makefile for Realtek RTL8192EU USB 802.11n driver |
| 3 | +# Hyperion Kernel Project โ in-tree port of the Realtek vendor driver. |
2 | 4 | # |
3 | | -# Makefile for Realtek RTL8192EU in-tree driver |
4 | | -# Hyperion Kernel Project v2.2.2 |
5 | | -# |
| 5 | +# Architecture notes: |
| 6 | +# This driver uses the Realtek private wireless stack (wext/cfg80211 wrapper). |
| 7 | +# It does NOT use mac80211. This is intentional โ a proper mac80211 port |
| 8 | +# would require porting ~20,000 lines of chip HAL from scratch and does not |
| 9 | +# exist anywhere publicly as of 2026. The cfg80211 path used here is the |
| 10 | +# only architecture that correctly programs the RTL8192EU hardware and gives |
| 11 | +# working internet. |
| 12 | + |
| 13 | +# ---- fixed chip/HCI choices for this in-tree driver ---- |
| 14 | +CONFIG_RTL8192E := y |
| 15 | +CONFIG_USB_HCI := y |
| 16 | + |
| 17 | +MODULE_NAME := 8192eu |
| 18 | + |
| 19 | +# ---- feature knobs (edit to taste) ---- |
| 20 | +CONFIG_POWER_SAVING := y |
| 21 | +CONFIG_USB_AUTOSUSPEND := n |
| 22 | +CONFIG_BT_COEXIST := y |
| 23 | +CONFIG_MP_INCLUDED := y |
| 24 | +CONFIG_80211W := y |
| 25 | +CONFIG_EFUSE_CONFIG_FILE := y |
| 26 | +CONFIG_LOAD_PHY_PARA_FROM_FILE := y |
| 27 | +CONFIG_TXPWR_BY_RATE := y |
| 28 | +CONFIG_TXPWR_BY_RATE_EN := n |
| 29 | +CONFIG_TXPWR_LIMIT := y |
| 30 | +CONFIG_TXPWR_LIMIT_EN := n |
| 31 | +CONFIG_RTW_CHPLAN := 0xFF |
| 32 | +CONFIG_RTW_ADAPTIVITY_EN := disable |
| 33 | +CONFIG_RTW_ADAPTIVITY_MODE := normal |
| 34 | +CONFIG_BR_EXT := y |
| 35 | +CONFIG_WIFI_MONITOR := y |
| 36 | +CONFIG_RTW_NAPI := y |
| 37 | +CONFIG_RTW_GRO := n |
| 38 | +CONFIG_RTW_NETIF_SG := y |
| 39 | +CONFIG_RTW_DEBUG := n |
| 40 | +CONFIG_RTW_LOG_LEVEL := 2 |
| 41 | + |
| 42 | +# ---- compiler flags ---- |
| 43 | +ccflags-y += -O2 |
| 44 | +ccflags-y += -Wno-unused-variable -Wno-unused-label -Wno-unused-function |
| 45 | + |
| 46 | +ccflags-y += -I$(src)/include |
| 47 | +ccflags-y += -I$(src)/hal/phydm |
| 48 | +ccflags-y += -I$(src)/platform |
| 49 | +ccflags-y += -I$(src)/hal/btc |
| 50 | + |
| 51 | +ccflags-y += -DCONFIG_RTL8192E |
| 52 | +ccflags-y += -DCONFIG_USB_HCI |
| 53 | +ccflags-y += -DCONFIG_LITTLE_ENDIAN |
| 54 | +# cfg80211 glue โ required for NetworkManager / wpa_supplicant to see the adapter |
| 55 | +ccflags-y += -DCONFIG_IOCTL_CFG80211 |
| 56 | +ccflags-y += -DRTW_USE_CFG80211_STA_EVENT |
| 57 | +ccflags-y += -DDM_ODM_SUPPORT_TYPE=0x04 |
| 58 | + |
| 59 | +ifeq ($(CONFIG_POWER_SAVING), y) |
| 60 | +ccflags-y += -DCONFIG_POWER_SAVING |
| 61 | +endif |
| 62 | + |
| 63 | +ifeq ($(CONFIG_USB_AUTOSUSPEND), y) |
| 64 | +ccflags-y += -DCONFIG_USB_AUTOSUSPEND |
| 65 | +endif |
| 66 | + |
| 67 | +ifeq ($(CONFIG_BT_COEXIST), y) |
| 68 | +ccflags-y += -DCONFIG_BT_COEXIST |
| 69 | +endif |
| 70 | + |
| 71 | +ifeq ($(CONFIG_MP_INCLUDED), y) |
| 72 | +ccflags-y += -DCONFIG_MP_INCLUDED |
| 73 | +endif |
| 74 | + |
| 75 | +ifeq ($(CONFIG_80211W), y) |
| 76 | +ccflags-y += -DCONFIG_IEEE80211W |
| 77 | +endif |
| 78 | + |
| 79 | +ifeq ($(CONFIG_EFUSE_CONFIG_FILE), y) |
| 80 | +ccflags-y += -DCONFIG_EFUSE_CONFIG_FILE |
| 81 | +ccflags-y += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8192eu.map\" |
| 82 | +ccflags-y += -DWIFIMAC_PATH=\"/data/wifimac.txt\" |
| 83 | +endif |
| 84 | + |
| 85 | +ifeq ($(CONFIG_LOAD_PHY_PARA_FROM_FILE), y) |
| 86 | +ccflags-y += -DCONFIG_LOAD_PHY_PARA_FROM_FILE |
| 87 | +ccflags-y += -DREALTEK_CONFIG_PATH=\"/lib/firmware/\" |
| 88 | +endif |
| 89 | + |
| 90 | +ifeq ($(CONFIG_TXPWR_BY_RATE), y) |
| 91 | +ccflags-y += -DCONFIG_TXPWR_BY_RATE=1 |
| 92 | +else |
| 93 | +ccflags-y += -DCONFIG_TXPWR_BY_RATE=0 |
| 94 | +endif |
| 95 | + |
| 96 | +ifeq ($(CONFIG_TXPWR_BY_RATE_EN), y) |
| 97 | +ccflags-y += -DCONFIG_TXPWR_BY_RATE_EN=1 |
| 98 | +else |
| 99 | +ccflags-y += -DCONFIG_TXPWR_BY_RATE_EN=0 |
| 100 | +endif |
| 101 | + |
| 102 | +ifeq ($(CONFIG_TXPWR_LIMIT), y) |
| 103 | +ccflags-y += -DCONFIG_TXPWR_LIMIT=1 |
| 104 | +else |
| 105 | +ccflags-y += -DCONFIG_TXPWR_LIMIT=0 |
| 106 | +endif |
| 107 | + |
| 108 | +ifeq ($(CONFIG_TXPWR_LIMIT_EN), y) |
| 109 | +ccflags-y += -DCONFIG_TXPWR_LIMIT_EN=1 |
| 110 | +else |
| 111 | +ccflags-y += -DCONFIG_TXPWR_LIMIT_EN=0 |
| 112 | +endif |
| 113 | + |
| 114 | +ifeq ($(CONFIG_RTW_ADAPTIVITY_EN), disable) |
| 115 | +ccflags-y += -DCONFIG_RTW_ADAPTIVITY_EN=0 |
| 116 | +else ifeq ($(CONFIG_RTW_ADAPTIVITY_EN), enable) |
| 117 | +ccflags-y += -DCONFIG_RTW_ADAPTIVITY_EN=1 |
| 118 | +endif |
| 119 | + |
| 120 | +ifeq ($(CONFIG_RTW_ADAPTIVITY_MODE), normal) |
| 121 | +ccflags-y += -DCONFIG_RTW_ADAPTIVITY_MODE=0 |
| 122 | +else ifeq ($(CONFIG_RTW_ADAPTIVITY_MODE), carrier_sense) |
| 123 | +ccflags-y += -DCONFIG_RTW_ADAPTIVITY_MODE=1 |
| 124 | +endif |
| 125 | + |
| 126 | +ifeq ($(CONFIG_BR_EXT), y) |
| 127 | +ccflags-y += -DCONFIG_BR_EXT |
| 128 | +ccflags-y += '-DCONFIG_BR_EXT_BRNAME="br0"' |
| 129 | +endif |
| 130 | + |
| 131 | +ifeq ($(CONFIG_WIFI_MONITOR), y) |
| 132 | +ccflags-y += -DCONFIG_WIFI_MONITOR |
| 133 | +endif |
| 134 | + |
| 135 | +ifeq ($(CONFIG_RTW_NAPI), y) |
| 136 | +ccflags-y += -DCONFIG_RTW_NAPI |
| 137 | +endif |
| 138 | + |
| 139 | +ifeq ($(CONFIG_RTW_GRO), y) |
| 140 | +ccflags-y += -DCONFIG_RTW_GRO |
| 141 | +endif |
| 142 | + |
| 143 | +ifeq ($(CONFIG_RTW_NETIF_SG), y) |
| 144 | +ccflags-y += -DCONFIG_RTW_NETIF_SG |
| 145 | +endif |
| 146 | + |
| 147 | +ifeq ($(CONFIG_RTW_DEBUG), y) |
| 148 | +ccflags-y += -DCONFIG_RTW_DEBUG |
| 149 | +ccflags-y += -DRTW_LOG_LEVEL=$(CONFIG_RTW_LOG_LEVEL) |
| 150 | +endif |
| 151 | + |
| 152 | +# ---- phydm ---- |
| 153 | +include $(src)/hal/phydm/phydm.mk |
| 154 | + |
| 155 | +# ---- core ---- |
| 156 | +rtk_core := \ |
| 157 | + core/rtw_cmd.o \ |
| 158 | + core/rtw_security.o \ |
| 159 | + core/rtw_debug.o \ |
| 160 | + core/rtw_io.o \ |
| 161 | + core/rtw_ioctl_set.o \ |
| 162 | + core/rtw_ieee80211.o \ |
| 163 | + core/rtw_mlme.o \ |
| 164 | + core/rtw_mlme_ext.o \ |
| 165 | + core/rtw_mi.o \ |
| 166 | + core/rtw_wlan_util.o \ |
| 167 | + core/rtw_vht.o \ |
| 168 | + core/rtw_pwrctrl.o \ |
| 169 | + core/rtw_rf.o \ |
| 170 | + core/rtw_chplan.o \ |
| 171 | + core/rtw_recv.o \ |
| 172 | + core/rtw_sta_mgt.o \ |
| 173 | + core/rtw_ap.o \ |
| 174 | + core/mesh/rtw_mesh.o \ |
| 175 | + core/mesh/rtw_mesh_pathtbl.o \ |
| 176 | + core/mesh/rtw_mesh_hwmp.o \ |
| 177 | + core/rtw_xmit.o \ |
| 178 | + core/rtw_p2p.o \ |
| 179 | + core/rtw_rson.o \ |
| 180 | + core/rtw_tdls.o \ |
| 181 | + core/rtw_br_ext.o \ |
| 182 | + core/rtw_iol.o \ |
| 183 | + core/rtw_sreset.o \ |
| 184 | + core/rtw_btcoex_wifionly.o \ |
| 185 | + core/rtw_btcoex.o \ |
| 186 | + core/rtw_beamforming.o \ |
| 187 | + core/rtw_odm.o \ |
| 188 | + core/rtw_rm.o \ |
| 189 | + core/rtw_rm_fsm.o \ |
| 190 | + core/efuse/rtw_efuse.o |
| 191 | + |
| 192 | +$(MODULE_NAME)-y += $(rtk_core) |
| 193 | +$(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += core/rtw_mp.o |
| 194 | + |
| 195 | +# ---- OS / USB interface ---- |
| 196 | +$(MODULE_NAME)-y += \ |
| 197 | + os_dep/osdep_service.o \ |
| 198 | + os_dep/linux/os_intfs.o \ |
| 199 | + os_dep/linux/usb_intf.o \ |
| 200 | + os_dep/linux/usb_ops_linux.o \ |
| 201 | + os_dep/linux/ioctl_linux.o \ |
| 202 | + os_dep/linux/xmit_linux.o \ |
| 203 | + os_dep/linux/mlme_linux.o \ |
| 204 | + os_dep/linux/recv_linux.o \ |
| 205 | + os_dep/linux/ioctl_cfg80211.o \ |
| 206 | + os_dep/linux/rtw_cfgvendor.o \ |
| 207 | + os_dep/linux/wifi_regd.o \ |
| 208 | + os_dep/linux/rtw_android.o \ |
| 209 | + os_dep/linux/rtw_proc.o \ |
| 210 | + os_dep/linux/rtw_rhashtable.o |
| 211 | + |
| 212 | +$(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += os_dep/linux/ioctl_mp.o |
| 213 | + |
| 214 | +# ---- HAL common ---- |
| 215 | +$(MODULE_NAME)-y += \ |
| 216 | + hal/hal_intf.o \ |
| 217 | + hal/hal_com.o \ |
| 218 | + hal/hal_com_phycfg.o \ |
| 219 | + hal/hal_phy.o \ |
| 220 | + hal/hal_dm.o \ |
| 221 | + hal/hal_dm_acs.o \ |
| 222 | + hal/hal_btcoex_wifionly.o \ |
| 223 | + hal/hal_btcoex.o \ |
| 224 | + hal/hal_mp.o \ |
| 225 | + hal/hal_mcc.o \ |
| 226 | + hal/hal_hci/hal_usb.o \ |
| 227 | + hal/led/hal_led.o \ |
| 228 | + hal/led/hal_usb_led.o |
| 229 | + |
| 230 | +# ---- HAL RTL8192E + USB ---- |
| 231 | +$(MODULE_NAME)-y += \ |
| 232 | + hal/HalPwrSeqCmd.o \ |
| 233 | + hal/rtl8192e/Hal8192EPwrSeq.o \ |
| 234 | + hal/rtl8192e/rtl8192e_xmit.o \ |
| 235 | + hal/rtl8192e/rtl8192e_sreset.o \ |
| 236 | + hal/rtl8192e/rtl8192e_hal_init.o \ |
| 237 | + hal/rtl8192e/rtl8192e_phycfg.o \ |
| 238 | + hal/rtl8192e/rtl8192e_rf6052.o \ |
| 239 | + hal/rtl8192e/rtl8192e_dm.o \ |
| 240 | + hal/rtl8192e/rtl8192e_rxdesc.o \ |
| 241 | + hal/rtl8192e/rtl8192e_cmd.o \ |
| 242 | + hal/rtl8192e/hal8192e_fw.o \ |
| 243 | + hal/rtl8192e/usb/usb_halinit.o \ |
| 244 | + hal/rtl8192e/usb/rtl8192eu_led.o \ |
| 245 | + hal/rtl8192e/usb/rtl8192eu_xmit.o \ |
| 246 | + hal/rtl8192e/usb/rtl8192eu_recv.o \ |
| 247 | + hal/rtl8192e/usb/usb_ops_linux.o \ |
| 248 | + hal/efuse/rtl8192e/HalEfuseMask8192E_USB.o |
| 249 | + |
| 250 | +# ---- BT coexistence for 8192e ---- |
| 251 | +ifeq ($(CONFIG_BT_COEXIST), y) |
| 252 | +$(MODULE_NAME)-y += \ |
| 253 | + hal/btc/halbtc8192e1ant.o \ |
| 254 | + hal/btc/halbtc8192e2ant.o |
| 255 | +endif |
| 256 | + |
| 257 | +# ---- phydm ---- |
| 258 | +$(MODULE_NAME)-y += $(_PHYDM_FILES) |
6 | 259 |
|
7 | | -# โโ Module object list โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
8 | | -rtl8192eu-objs := \ |
9 | | - rtl8192eu_usb.o |
| 260 | +# ---- platform ---- |
| 261 | +$(MODULE_NAME)-y += platform/platform_ops.o |
10 | 262 |
|
11 | | -# โโ Build target โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
12 | | -obj-$(CONFIG_RTL8192EU) += rtl8192eu.o |
| 263 | +# ---- wire it all together ---- |
| 264 | +obj-$(CONFIG_RTL8192EU) := $(MODULE_NAME).o |
13 | 265 |
|
14 | | -# โโ Compiler flags โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
15 | | -# -Wno-unused-function: some HAL stubs are intentionally unused |
16 | | -# -Wno-implicit-fallthrough: Realtek code has some intentional fallthroughs |
17 | | -ccflags-y += -I$(srctree)/drivers/net/wireless/realtek/rtl8192eu/include |
18 | | -ccflags-y += -Wno-unused-function |
19 | | -ccflags-y += -Wno-implicit-fallthrough |
| 266 | +EXTRA_CFLAGS += $(ccflags-y) |
| 267 | +EXTRA_LDFLAGS += $(ldflags-y) |
0 commit comments