Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. SHELL := /bin/bash
  2. KVER ?= $(shell uname -r)
  3. KSRC := /lib/modules/$(KVER)/build
  4. FIRMWAREDIR := /lib/firmware/
  5. PWD := $(shell pwd)
  6. CLR_MODULE_FILES := *.mod.c *.mod *.o .*.cmd *.ko *~ .tmp_versions* modules.order Module.symvers
  7. SYMBOL_FILE := Module.symvers
  8. # Handle the move of the entire rtw88 tree
  9. ifneq ("","$(wildcard /lib/modules/$(KVER)/kernel/drivers/net/wireless/realtek)")
  10. MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/realtek/rtw89
  11. else
  12. MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/rtw89
  13. endif
  14. #Handle the compression option for modules in 3.18+
  15. ifneq ("","$(wildcard $(MODDESTDIR)/*.ko.gz)")
  16. COMPRESS_GZIP := y
  17. endif
  18. ifneq ("","$(wildcard $(MODDESTDIR)/*.ko.xz)")
  19. COMPRESS_XZ := y
  20. endif
  21. ifeq ("","$(wildcard MOK.der)")
  22. NO_SKIP_SIGN := y
  23. endif
  24. EXTRA_CFLAGS += -O2
  25. EXTRA_CFLAGS += -DCONFIG_RTW89_DEBUGMSG
  26. EXTRA_CFLAGS += -DCONFIG_RTW89_DEBUGFS
  27. KEY_FILE ?= MOK.der
  28. obj-m += rtw89core.o
  29. rtw89core-y += core.o \
  30. chan.o \
  31. mac80211.o \
  32. mac.o \
  33. phy.o \
  34. fw.o \
  35. cam.o \
  36. efuse.o \
  37. regd.o \
  38. sar.o \
  39. acpi.o \
  40. coex.o \
  41. ps.o \
  42. debug.o \
  43. ser.o \
  44. wow.o
  45. obj-m += rtw_8852a.o
  46. rtw_8852a-y := rtw8852a.o \
  47. rtw8852a_table.o \
  48. rtw8852a_rfk.o \
  49. rtw8852a_rfk_table.o
  50. obj-m += rtw_8852ae.o
  51. rtw_8852ae-y := rtw8852ae.o
  52. obj-m += rtw_8851b.o
  53. rtw_8851b-y := rtw8851b.o \
  54. rtw8851b_table.o \
  55. rtw8851b_rfk.o \
  56. rtw8851b_rfk_table.o
  57. obj-m += rtw_8851be.o
  58. rtw_8851be-y := rtw8851be.o
  59. obj-m += rtw_8852b.o
  60. rtw_8852b-y := rtw8852b.o \
  61. rtw8852b_table.o \
  62. rtw8852b_rfk.o \
  63. rtw8852b_rfk_table.o
  64. obj-m += rtw_8852be.o
  65. rtw_8852be-y := rtw8852be.o
  66. obj-m += rtw_8852c.o
  67. rtw_8852c-y := rtw8852c.o \
  68. rtw8852c_table.o \
  69. rtw8852c_rfk.o \
  70. rtw8852c_rfk_table.o
  71. obj-m += rtw_8852ce.o
  72. rtw_8852ce-y := rtw8852ce.o
  73. #obj-m += rtw89debug.o
  74. #rtw89debug-y := debug.o
  75. obj-m += rtw89pci.o
  76. rtw89pci-y := pci.o
  77. #obj-m += rtw89usb.o
  78. #rtw89usb-y := usb.o
  79. ccflags-y += -D__CHECK_ENDIAN__
  80. .PHONY: all install uninstall clean sign sign-install
  81. all:
  82. $(MAKE) -C $(KSRC) M=$(PWD) modules
  83. install: all
  84. @rm -f $(MODDESTDIR)/rtw89*.ko
  85. @mkdir -p $(MODDESTDIR)
  86. @install -p -D -m 644 *.ko $(MODDESTDIR)
  87. ifeq ($(COMPRESS_GZIP), y)
  88. @gzip -f $(MODDESTDIR)/*.ko
  89. endif
  90. ifeq ($(COMPRESS_XZ), y)
  91. @xz -f $(MODDESTDIR)/*.ko
  92. endif
  93. @depmod -a $(KVER)
  94. @echo "Install rtw89 SUCCESS"
  95. uninstall:
  96. @rm -f $(MODDESTDIR)/rtw89*.ko
  97. @depmod -a
  98. @echo "Uninstall rtw89 SUCCESS"
  99. clean:
  100. @rm -fr *.mod.c *.mod *.o .*.cmd .*.o.cmd *.ko *~ .*.o.d .cache.mk
  101. @rm -fr .tmp_versions
  102. @rm -fr Modules.symvers
  103. @rm -fr Module.symvers
  104. @rm -fr Module.markers
  105. @rm -fr modules.order
  106. sign:
  107. ifeq ($(NO_SKIP_SIGN), y)
  108. @openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=Custom MOK/"
  109. @mokutil --import MOK.der
  110. else
  111. echo "Skipping key creation"
  112. endif
  113. @$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der rtw89core.ko
  114. @$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der rtw89pci.ko
  115. @$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der rtw_8851b.ko
  116. @$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der rtw_8851be.ko
  117. @$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der rtw_8852a.ko
  118. @$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der rtw_8852ae.ko
  119. @$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der rtw_8852b.ko
  120. @$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der rtw_8852be.ko
  121. @$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der rtw_8852c.ko
  122. @$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der rtw_8852ce.ko
  123. sign-install: all sign install