Kbuild 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. # We can build either as part of a standalone Kernel build or as
  2. # an external module. Determine which mechanism is being used
  3. ifeq ($(MODNAME),)
  4. KERNEL_BUILD := 1
  5. else
  6. KERNEL_BUILD := 0
  7. endif
  8. TARGET_KERNEL_VERSION := 4.9
  9. # These are configurable via Kconfig for kernel-based builds
  10. # Need to explicitly configure for Android-based builds
  11. ifeq ($(CONFIG_ARCH_SDM845), y)
  12. TARGET_KERNEL_VERSION := 4.9
  13. endif
  14. ifeq ($(CONFIG_ARCH_SDM670), y)
  15. TARGET_KERNEL_VERSION := 4.9
  16. endif
  17. ifeq ($(CONFIG_ARCH_SM8150), y)
  18. TARGET_KERNEL_VERSION := 4.14
  19. endif
  20. ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
  21. TARGET_KERNEL_VERSION := 4.14
  22. endif
  23. KDIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)
  24. ifeq ($(KERNEL_BUILD), 1)
  25. AUDIO_ROOT := $(KDIR)/techpack/audio
  26. endif
  27. ifeq ($(KERNEL_BUILD), 0)
  28. ifeq ($(CONFIG_ARCH_SDM845), y)
  29. include $(AUDIO_ROOT)/config/sdm845auto.conf
  30. export
  31. INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
  32. endif
  33. ifeq ($(CONFIG_ARCH_SDM670), y)
  34. include $(AUDIO_ROOT)/config/sdm670auto.conf
  35. export
  36. INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
  37. endif
  38. ifeq ($(CONFIG_ARCH_SDM450), y)
  39. include $(AUDIO_ROOT)/config/sdm670auto.conf
  40. export
  41. INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
  42. endif
  43. ifeq ($(CONFIG_ARCH_SM8150), y)
  44. include $(AUDIO_ROOT)/config/sm8150auto.conf
  45. export
  46. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  47. endif
  48. ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
  49. include $(AUDIO_ROOT)/config/sm8150auto.conf
  50. export
  51. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  52. endif
  53. endif
  54. # As per target team, build is done as follows:
  55. # Defconfig : build with default flags
  56. # Slub : defconfig + CONFIG_SLUB_DEBUG := y +
  57. # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
  58. # Perf : Using appropriate msmXXXX-perf_defconfig
  59. #
  60. # Shipment builds (user variants) should not have any debug feature
  61. # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
  62. # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
  63. # there is no other way to identify defconfig builds, QTI internal
  64. # representation of perf builds (identified using the string 'perf'),
  65. # is used to identify if the build is a slub or defconfig one. This
  66. # way no critical debug feature will be enabled for perf and shipment
  67. # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
  68. # config.
  69. ############ UAPI ############
  70. UAPI_DIR := uapi
  71. UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
  72. ############ COMMON ############
  73. COMMON_DIR := include
  74. COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
  75. ############ IPC ############
  76. ifdef CONFIG_MSM_QDSP6_APRV2_RPMSG
  77. APRV_GLINK += apr.o
  78. APRV_GLINK += apr_v2.o
  79. APRV_GLINK += apr_tal_rpmsg.o
  80. endif
  81. ifdef CONFIG_MSM_QDSP6_APRV3_RPMSG
  82. APRV_GLINK += apr.o
  83. APRV_GLINK += apr_v3.o
  84. APRV_GLINK += apr_tal_rpmsg.o
  85. endif
  86. ifdef CONFIG_WCD_DSP_GLINK
  87. WDSP_GLINK += wcd-dsp-glink.o
  88. endif
  89. LINUX_INC += -Iinclude/linux
  90. INCS += $(COMMON_INC) \
  91. $(UAPI_INC)
  92. EXTRA_CFLAGS += $(INCS)
  93. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  94. -DANI_LITTLE_BIT_ENDIAN \
  95. -DDOT11F_LITTLE_ENDIAN_HOST \
  96. -DANI_COMPILER_TYPE_GCC \
  97. -DANI_OS_TYPE_ANDROID=6 \
  98. -DPTT_SOCK_SVC_ENABLE \
  99. -Wall\
  100. -Werror\
  101. -D__linux__
  102. KBUILD_CPPFLAGS += $(CDEFINES)
  103. ifeq ($(KERNEL_BUILD), 0)
  104. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
  105. endif
  106. # Currently, for versions of gcc which support it, the kernel Makefile
  107. # is disabling the maybe-uninitialized warning. Re-enable it for the
  108. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  109. # will override the kernel settings.
  110. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  111. EXTRA_CFLAGS += -Wmaybe-uninitialized
  112. endif
  113. #EXTRA_CFLAGS += -Wmissing-prototypes
  114. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  115. EXTRA_CFLAGS += -Wheader-guard
  116. endif
  117. # If the module name is not "wlan", then the define MULTI_IF_NAME to be the
  118. # same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
  119. # any string that must be unique for all instances of the driver on the system.
  120. # This allows multiple instances of the driver with different module names.
  121. # If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
  122. # treat the driver as the primary driver.
  123. ifneq ($(MODNAME), qdsp6v2)
  124. CHIP_NAME ?= $(MODNAME)
  125. CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
  126. endif
  127. # Module information used by KBuild framework
  128. obj-$(CONFIG_MSM_QDSP6_APRV2_RPMSG) += apr_dlkm.o
  129. obj-$(CONFIG_MSM_QDSP6_APRV3_RPMSG) += apr_dlkm.o
  130. apr_dlkm-y := $(APRV_GLINK)
  131. obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o
  132. wglink_dlkm-y := $(WDSP_GLINK)
  133. # inject some build related information
  134. CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"