forked from lwfinger/rtw88
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
131 lines (111 loc) · 3.19 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
SHELL := /bin/sh
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/rtw88
else
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/rtw88
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
EXTRA_CFLAGS += -O2
EXTRA_CFLAGS += -DCONFIG_RTW88_8822BE=1
EXTRA_CFLAGS += -DCONFIG_RTW88_8821CE=1
EXTRA_CFLAGS += -DCONFIG_RTW88_8822CE=1
EXTRA_CFLAGS += -DCONFIG_RTW88_8723DE=1
EXTRA_CFLAGS += -DCONFIG_RTW88_DEBUG=1
EXTRA_CFLAGS += -DCONFIG_RTW88_DEBUGFS=1
EXTRA_CFLAGS += -DCONFIG_RTW88_REGD_USER_REG_HINTS
obj-m += rtw_core.o
rtw_core-objs += main.o \
mac80211.o \
util.o \
debug.o \
tx.o \
rx.o \
mac.o \
phy.o \
coex.o \
efuse.o \
fw.o \
ps.o \
sec.o \
wow.o \
bf.o \
regd.o
obj-m += rtw_8822b.o
rtw_8822b-objs := rtw8822b.o rtw8822b_table.o
obj-m += rtw_8822be.o
rtw_8822be-objs := rtw8822be.o
obj-m += rtw_8822c.o
rtw_8822c-objs := rtw8822c.o rtw8822c_table.o
obj-m += rtw_8822ce.o
rtw_8822ce-objs := rtw8822ce.o
obj-m += rtw_8723d.o
rtw_8723d-objs := rtw8723d.o rtw8723d_table.o
obj-m += rtw_8723de.o
rtw_8723de-objs := rtw8723de.o
obj-m += rtw_8821c.o
rtw_8821c-objs := rtw8821c.o rtw8821c_table.o
obj-m += rtw_8821ce.o
rtw_8821ce-objs := rtw8821ce.o
obj-m += rtw_pci.o
rtw_pci-objs := pci.o
ccflags-y += -D__CHECK_ENDIAN__
all:
$(MAKE) -C $(KSRC) M=$(PWD) modules
install: all
ifeq (,$(wildcard ./backup_drivers.tar))
@echo Making backups
@tar cPf backup_drivers.tar $(MODDESTDIR)
@modprobe -rf rtwpci
@modprobe -rf rtw88
@rm -f $(MODDESTDIR)/rtw88*.ko*
@rm -f $(MODDESTDIR)/rtwpci.ko*
endif
@mkdir -p $(MODDESTDIR)
@install -p -D -m 644 *.ko $(MODDESTDIR)
@mkdir -p /lib/firmware/rtw88
@cp *.bin /lib/firmware/rtw88/.
ifeq ($(COMPRESS_GZIP), y)
@gzip -f $(MODDESTDIR)/*.ko
endif
ifeq ($(COMPRESS_XZ), y)
@xz -f $(MODDESTDIR)/*.ko
endif
@depmod -a $(KVER)
@#copy firmware images to target folder
@mkdir -p $(FIRMWAREDIR)/rtw88/
@cp -f *.bin $(FIRMWAREDIR)/rtw88/
@mv $(FIRMWAREDIR)/rtw88/rtl8822cu_fw.bin $(FIRMWAREDIR)rtl_bt/.
@echo "Install rtw88 SUCCESS"
uninstall:
@modprobe -r rtw_8822be
@modprobe -r rtw_8822ce
@modprobe -r rtw_8723de
@rm -f $(MODDESTDIR)/rtw_*.ko
@rm -f $(MODDESTDIR)/rtw_core.ko
ifneq (,$(wildcard ./backup_drivers.tar))
@echo Restoring backups
@tar xPf backup_drivers.tar
@rm backup_drivers.tar
endif
@depmod -a
@echo "Uninstall rtw88 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