Android.mk 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. ENABLE_QCACLD := true
  2. ifeq ($(TARGET_USES_QMAA), true)
  3. ifneq ($(TARGET_USES_QMAA_OVERRIDE_WLAN), true)
  4. ENABLE_QCACLD := false
  5. else
  6. ENABLE_QCACLD := true
  7. endif
  8. endif
  9. ifeq ($(ENABLE_QCACLD), true)
  10. # Android makefile for the WLAN Module
  11. LOCAL_PATH := $(call my-dir)
  12. # Assume no targets will be supported
  13. WLAN_CHIPSET :=
  14. ifeq ($(BOARD_HAS_QCOM_WLAN), true)
  15. # Check if this driver needs be built for current target
  16. ifneq ($(findstring qca_cld3,$(WIFI_DRIVER_BUILT)),)
  17. WLAN_CHIPSET := qca_cld3
  18. WLAN_SELECT := CONFIG_QCA_CLD_WLAN=m
  19. endif
  20. # Build/Package only in case of supported target
  21. ifneq ($(WLAN_CHIPSET),)
  22. # This makefile is only for DLKM
  23. ifneq ($(findstring vendor,$(LOCAL_PATH)),)
  24. ifneq ($(findstring opensource,$(LOCAL_PATH)),)
  25. WLAN_BLD_DIR := vendor/qcom/opensource/wlan
  26. endif # opensource
  27. # Multi-ko check
  28. LOCAL_DEV_NAME := $(patsubst .%,%,\
  29. $(lastword $(strip $(subst /, ,$(LOCAL_PATH)))))
  30. ifeq (1, $(strip $(shell expr $(words $(strip $(TARGET_WLAN_CHIP))) \>= 2)))
  31. ifeq ($(LOCAL_DEV_NAME), qcacld-3.0)
  32. LOCAL_MULTI_KO := true
  33. else
  34. LOCAL_MULTI_KO := false
  35. endif
  36. endif
  37. ifeq ($(LOCAL_MULTI_KO), true)
  38. LOCAL_ANDROID_ROOT := $(shell pwd)
  39. LOCAL_WLAN_BLD_DIR := $(LOCAL_ANDROID_ROOT)/$(WLAN_BLD_DIR)
  40. $(shell find $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/ -maxdepth 1 \
  41. -name '.*' ! -name '.git' -exec rm -rf {} +)
  42. $(foreach chip, $(TARGET_WLAN_CHIP), \
  43. $($(shell mkdir -p $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/.$(chip); \
  44. ln -sf $(LOCAL_WLAN_BLD_DIR)/qca-wifi-host-cmn \
  45. $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/.$(chip)/qca-wifi-host-cmn); \
  46. $(foreach node, \
  47. $(shell find $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/ -maxdepth 1 \
  48. ! -name '.*' ! -name '*~' \
  49. ! -name '.' ! -name 'qcacld-3.0'), \
  50. $(shell ln -sf $(node) \
  51. $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/.$(chip)/$(lastword $(strip $(subst /, ,$(node)))) \
  52. ))))
  53. include $(foreach chip, $(TARGET_WLAN_CHIP), $(LOCAL_PATH)/.$(chip)/Android.mk)
  54. else # Multi-ok check
  55. ifeq ($(WLAN_PROFILE),)
  56. WLAN_PROFILE := default
  57. endif
  58. ifeq ($(LOCAL_DEV_NAME), qcacld-3.0)
  59. LOCAL_DEV_NAME := wlan
  60. LOCAL_MOD_NAME := wlan
  61. CMN_OFFSET := ..
  62. LOCAL_SRC_DIR :=
  63. TARGET_FW_DIR := firmware/wlan/qca_cld
  64. TARGET_CFG_PATH := /vendor/etc/wifi
  65. TARGET_MAC_BIN_PATH := /mnt/vendor/persist
  66. else
  67. LOCAL_SRC_DIR := .$(LOCAL_DEV_NAME)
  68. CMN_OFFSET := .
  69. # Use default profile if WLAN_CFG_USE_DEFAULT defined.
  70. ifeq ($(WLAN_CFG_USE_DEFAULT),)
  71. WLAN_PROFILE := $(LOCAL_DEV_NAME)
  72. endif
  73. TARGET_FW_DIR := firmware/wlan/qca_cld/$(LOCAL_DEV_NAME)
  74. TARGET_CFG_PATH := /vendor/etc/wifi/$(LOCAL_DEV_NAME)
  75. TARGET_MAC_BIN_PATH := /mnt/vendor/persist/$(LOCAL_DEV_NAME)
  76. ifneq ($(TARGET_MULTI_WLAN), true)
  77. LOCAL_MOD_NAME := wlan
  78. DYNAMIC_SINGLE_CHIP := $(LOCAL_DEV_NAME)
  79. else
  80. LOCAL_MOD_NAME := $(LOCAL_DEV_NAME)
  81. endif
  82. endif
  83. # DLKM_DIR was moved for JELLY_BEAN (PLATFORM_SDK 16)
  84. ifeq ($(call is-platform-sdk-version-at-least,16),true)
  85. DLKM_DIR := $(TOP)/device/qcom/common/dlkm
  86. else
  87. DLKM_DIR := build/dlkm
  88. endif # platform-sdk-version
  89. # Build wlan.ko as $(WLAN_CHIPSET)_wlan.ko
  90. ###########################################################
  91. # This is set once per LOCAL_PATH, not per (kernel) module
  92. KBUILD_OPTIONS := WLAN_ROOT=$(WLAN_BLD_DIR)/qcacld-3.0/$(LOCAL_SRC_DIR)
  93. KBUILD_OPTIONS += WLAN_COMMON_ROOT=$(CMN_OFFSET)/qca-wifi-host-cmn
  94. KBUILD_OPTIONS += WLAN_COMMON_INC=$(WLAN_BLD_DIR)/qca-wifi-host-cmn
  95. KBUILD_OPTIONS += WLAN_FW_API=$(WLAN_BLD_DIR)/fw-api
  96. KBUILD_OPTIONS += WLAN_PROFILE=$(WLAN_PROFILE)
  97. KBUILD_OPTIONS += DYNAMIC_SINGLE_CHIP=$(DYNAMIC_SINGLE_CHIP)
  98. # We are actually building wlan.ko here, as per the
  99. # requirement we are specifying <chipset>_wlan.ko as LOCAL_MODULE.
  100. # This means we need to rename the module to <chipset>_wlan.ko
  101. # after wlan.ko is built.
  102. KBUILD_OPTIONS += MODNAME=$(LOCAL_MOD_NAME)
  103. KBUILD_OPTIONS += DEVNAME=$(LOCAL_DEV_NAME)
  104. KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
  105. KBUILD_OPTIONS += $(WLAN_SELECT)
  106. ifneq ($(WLAN_CFG_OVERRIDE_$(LOCAL_DEV_NAME)),)
  107. KBUILD_OPTIONS += WLAN_CFG_OVERRIDE="$(WLAN_CFG_OVERRIDE_$(LOCAL_DEV_NAME))"
  108. endif
  109. # Pass build options per chip to Kbuild. This will be injected from upper layer
  110. # makefile.
  111. #
  112. # e.g.
  113. # WLAN_KBUILD_OPTIONS_qca6390 := CONFIG_CNSS_QCA6390=y
  114. ifneq ($(WLAN_KBUILD_OPTIONS_$(LOCAL_DEV_NAME)),)
  115. KBUILD_OPTIONS += "$(WLAN_KBUILD_OPTIONS_$(LOCAL_DEV_NAME))"
  116. endif
  117. include $(CLEAR_VARS)
  118. LOCAL_MODULE := $(WLAN_CHIPSET)_$(LOCAL_DEV_NAME).ko
  119. LOCAL_MODULE_KBUILD_NAME := $(LOCAL_MOD_NAME).ko
  120. LOCAL_MODULE_DEBUG_ENABLE := true
  121. ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
  122. ifeq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),true)
  123. LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
  124. else
  125. LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)
  126. endif
  127. else
  128. LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules/$(WLAN_CHIPSET)
  129. endif
  130. ifeq ($(TARGET_PRODUCT), taro)
  131. include $(DLKM_DIR)/Build_external_kernelmodule.mk
  132. else
  133. include $(DLKM_DIR)/AndroidKernelModule.mk
  134. endif
  135. ###########################################################
  136. # Create Symbolic link
  137. ifneq ($(findstring $(WLAN_CHIPSET),$(WIFI_DRIVER_DEFAULT)),)
  138. ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
  139. ifneq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),true)
  140. $(shell mkdir -p $(TARGET_OUT_VENDOR)/lib/modules; \
  141. ln -sf /$(TARGET_COPY_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MODULE))
  142. endif
  143. else
  144. $(shell mkdir -p $(TARGET_OUT)/lib/modules; \
  145. ln -sf /system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT)/lib/modules/$(LOCAL_MODULE))
  146. endif
  147. endif
  148. ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
  149. TARGET_FW_PATH := $(TARGET_OUT_VENDOR)/$(TARGET_FW_DIR)
  150. else
  151. TARGET_FW_PATH := $(TARGET_OUT_ETC)/$(TARGET_FW_DIR)
  152. endif
  153. $(shell mkdir -p $(TARGET_FW_PATH); \
  154. ln -sf $(TARGET_MAC_BIN_PATH)/wlan_mac.bin $(TARGET_FW_PATH)/wlan_mac.bin)
  155. ifeq ($(TARGET_BOARD_AUTO),true)
  156. $(shell ln -sf $(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
  157. $(warning "generate soft link because TARGET_BOARD_AUTO true")
  158. else
  159. ifneq ($(GENERIC_ODM_IMAGE),true)
  160. $(shell ln -sf $(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
  161. $(warning "generate soft link because GRNERIC_ODM_IMAGE not true")
  162. endif
  163. endif
  164. endif # Multi-ko check
  165. endif # DLKM check
  166. endif # supported target check
  167. endif # WLAN enabled check
  168. endif # ENABLE_QCACLD