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