mt76: Add firmware package for MT7922
[openwrt/openwrt.git] / package / kernel / mt76 / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=mt76
4 PKG_RELEASE=1
5
6 PKG_LICENSE:=GPLv2
7 PKG_LICENSE_FILES:=
8
9 PKG_SOURCE_URL:=https://github.com/openwrt/mt76
10 PKG_SOURCE_PROTO:=git
11 PKG_SOURCE_DATE:=2023-09-18
12 PKG_SOURCE_VERSION:=2afc7285f75dca5a0583fd917285bf33f1429cc6
13 PKG_MIRROR_HASH:=2c9556b298246277ac2d65415e4449f98e6d5fdb99e0d0a92262f162df772bbc
14
15 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
16 PKG_USE_NINJA:=0
17 PKG_BUILD_PARALLEL:=1
18
19 PKG_CONFIG_DEPENDS += \
20 CONFIG_PACKAGE_kmod-mt76-usb \
21 CONFIG_PACKAGE_kmod-mt76x02-common \
22 CONFIG_PACKAGE_kmod-mt76x0-common \
23 CONFIG_PACKAGE_kmod-mt76x0u \
24 CONFIG_PACKAGE_kmod-mt76x2-common \
25 CONFIG_PACKAGE_kmod-mt76x2 \
26 CONFIG_PACKAGE_kmod-mt76x2u \
27 CONFIG_PACKAGE_kmod-mt7603 \
28 CONFIG_PACKAGE_CFG80211_TESTMODE
29
30 STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
31
32 include $(INCLUDE_DIR)/kernel.mk
33 include $(INCLUDE_DIR)/package.mk
34 include $(INCLUDE_DIR)/cmake.mk
35
36 CMAKE_SOURCE_DIR:=$(PKG_BUILD_DIR)/tools
37 CMAKE_BINARY_DIR:=$(PKG_BUILD_DIR)/tools
38
39 define KernelPackage/mt76-default
40 SUBMENU:=Wireless Drivers
41 DEPENDS:= \
42 +kmod-mac80211 \
43 +@DRIVER_11AC_SUPPORT \
44 +@KERNEL_PAGE_POOL
45 endef
46
47 define KernelPackage/mt76
48 SUBMENU:=Wireless Drivers
49 TITLE:=MediaTek MT76x2/MT7603 wireless driver (metapackage)
50 DEPENDS:= \
51 +kmod-mt76-core +kmod-mt76x2 +kmod-mt7603
52 endef
53
54 define KernelPackage/mt76-core
55 $(KernelPackage/mt76-default)
56 TITLE:=MediaTek MT76xx wireless driver
57 HIDDEN:=1
58 FILES:=\
59 $(PKG_BUILD_DIR)/mt76.ko
60 endef
61
62 define KernelPackage/mt76-usb
63 $(KernelPackage/mt76-default)
64 TITLE:=MediaTek MT76xx wireless driver USB support
65 DEPENDS += +kmod-usb-core +kmod-mt76-core
66 HIDDEN:=1
67 FILES:=\
68 $(PKG_BUILD_DIR)/mt76-usb.ko
69 endef
70
71 define KernelPackage/mt76x02-usb
72 $(KernelPackage/mt76-default)
73 TITLE:=MediaTek MT76x0/MT76x2 USB wireless driver common code
74 DEPENDS+=+kmod-mt76-usb +kmod-mt76x02-common
75 HIDDEN:=1
76 FILES:=$(PKG_BUILD_DIR)/mt76x02-usb.ko
77 endef
78
79 define KernelPackage/mt76x02-common
80 $(KernelPackage/mt76-default)
81 TITLE:=MediaTek MT76x0/MT76x2 wireless driver common code
82 DEPENDS+=+kmod-mt76-core
83 HIDDEN:=1
84 FILES:=$(PKG_BUILD_DIR)/mt76x02-lib.ko
85 endef
86
87 define KernelPackage/mt76x0-common
88 $(KernelPackage/mt76-default)
89 TITLE:=MediaTek MT76x0 wireless driver common code
90 DEPENDS+=+kmod-mt76x02-common
91 HIDDEN:=1
92 FILES:=$(PKG_BUILD_DIR)/mt76x0/mt76x0-common.ko
93 endef
94
95 define KernelPackage/mt76x0e
96 $(KernelPackage/mt76-default)
97 TITLE:=MediaTek MT76x0E wireless driver
98 DEPENDS+=@PCI_SUPPORT +kmod-mt76x0-common
99 FILES:=\
100 $(PKG_BUILD_DIR)/mt76x0/mt76x0e.ko
101 AUTOLOAD:=$(call AutoProbe,mt76x0e)
102 endef
103
104 define KernelPackage/mt76x0u
105 $(KernelPackage/mt76-default)
106 TITLE:=MediaTek MT76x0U wireless driver
107 DEPENDS+=+kmod-mt76x0-common +kmod-mt76x02-usb
108 FILES:=\
109 $(PKG_BUILD_DIR)/mt76x0/mt76x0u.ko
110 AUTOLOAD:=$(call AutoProbe,mt76x0u)
111 endef
112
113 define KernelPackage/mt76x2-common
114 $(KernelPackage/mt76-default)
115 TITLE:=MediaTek MT76x2 wireless driver common code
116 DEPENDS+=+kmod-mt76-core +kmod-mt76x02-common
117 HIDDEN:=1
118 FILES:=$(PKG_BUILD_DIR)/mt76x2/mt76x2-common.ko
119 endef
120
121 define KernelPackage/mt76x2u
122 $(KernelPackage/mt76-default)
123 TITLE:=MediaTek MT76x2U wireless driver
124 DEPENDS+=+kmod-mt76x2-common +kmod-mt76x02-usb
125 FILES:=\
126 $(PKG_BUILD_DIR)/mt76x2/mt76x2u.ko
127 AUTOLOAD:=$(call AutoProbe,mt76x2u)
128 endef
129
130 define KernelPackage/mt76x2
131 $(KernelPackage/mt76-default)
132 TITLE:=MediaTek MT76x2 wireless driver
133 DEPENDS+=@PCI_SUPPORT +kmod-mt76x2-common
134 FILES:=\
135 $(PKG_BUILD_DIR)/mt76x2/mt76x2e.ko
136 AUTOLOAD:=$(call AutoProbe,mt76x2e)
137 endef
138
139 define KernelPackage/mt7603
140 $(KernelPackage/mt76-default)
141 TITLE:=MediaTek MT7603 wireless driver
142 DEPENDS+=@PCI_SUPPORT +kmod-mt76-core
143 FILES:=\
144 $(PKG_BUILD_DIR)/mt7603/mt7603e.ko
145 AUTOLOAD:=$(call AutoProbe,mt7603e)
146 endef
147
148 define KernelPackage/mt76-connac
149 $(KernelPackage/mt76-default)
150 TITLE:=MediaTek MT7615/MT79xx wireless driver common code
151 HIDDEN:=1
152 DEPENDS+=+kmod-mt76-core
153 FILES:= $(PKG_BUILD_DIR)/mt76-connac-lib.ko
154 endef
155
156 define KernelPackage/mt76-sdio
157 $(KernelPackage/mt76-default)
158 TITLE:=MediaTek MT7615/MT79xx SDIO driver common code
159 HIDDEN:=1
160 DEPENDS+=+kmod-mt76-core +kmod-mmc
161 FILES:= $(PKG_BUILD_DIR)/mt76-sdio.ko
162 endef
163
164 define KernelPackage/mt7615-common
165 $(KernelPackage/mt76-default)
166 TITLE:=MediaTek MT7615 wireless driver common code
167 HIDDEN:=1
168 DEPENDS+=@PCI_SUPPORT +kmod-mt76-core +kmod-mt76-connac +kmod-hwmon-core
169 FILES:= $(PKG_BUILD_DIR)/mt7615/mt7615-common.ko
170 endef
171
172 define KernelPackage/mt7615-firmware
173 $(KernelPackage/mt76-default)
174 TITLE:=MediaTek MT7615e firmware
175 DEPENDS+=+kmod-mt7615e
176 endef
177
178 define KernelPackage/mt7615e
179 $(KernelPackage/mt76-default)
180 TITLE:=MediaTek MT7615e wireless driver
181 DEPENDS+=@PCI_SUPPORT +kmod-mt7615-common
182 FILES:= $(PKG_BUILD_DIR)/mt7615/mt7615e.ko
183 AUTOLOAD:=$(call AutoProbe,mt7615e)
184 endef
185
186 define KernelPackage/mt7622-firmware
187 $(KernelPackage/mt76-default)
188 TITLE:=MediaTek MT7622 firmware
189 DEPENDS+=+kmod-mt7615e
190 endef
191
192 define KernelPackage/mt7663-firmware-ap
193 $(KernelPackage/mt76-default)
194 TITLE:=MediaTek MT7663e firmware (optimized for AP)
195 endef
196
197 define KernelPackage/mt7663-firmware-sta
198 $(KernelPackage/mt76-default)
199 TITLE:=MediaTek MT7663e firmware (client mode offload)
200 endef
201
202 define KernelPackage/mt7663-usb-sdio
203 $(KernelPackage/mt76-default)
204 TITLE:=MediaTek MT7663 USB/SDIO shared code
205 DEPENDS+=+kmod-mt7615-common
206 HIDDEN:=1
207 FILES:= \
208 $(PKG_BUILD_DIR)/mt7615/mt7663-usb-sdio-common.ko
209 endef
210
211 define KernelPackage/mt7663s
212 $(KernelPackage/mt76-default)
213 TITLE:=MediaTek MT7663s wireless driver
214 DEPENDS+=+kmod-mt76-sdio +kmod-mt7615-common +kmod-mt7663-usb-sdio
215 FILES:= \
216 $(PKG_BUILD_DIR)/mt7615/mt7663s.ko
217 AUTOLOAD:=$(call AutoProbe,mt7663s)
218 endef
219
220 define KernelPackage/mt7663u
221 $(KernelPackage/mt76-default)
222 TITLE:=MediaTek MT7663u wireless driver
223 DEPENDS+=+kmod-mt76-usb +kmod-mt7615-common +kmod-mt7663-usb-sdio
224 FILES:= $(PKG_BUILD_DIR)/mt7615/mt7663u.ko
225 AUTOLOAD:=$(call AutoProbe,mt7663u)
226 endef
227
228 define KernelPackage/mt7915-firmware
229 $(KernelPackage/mt76-default)
230 TITLE:=MediaTek MT7915 firmware
231 DEPENDS+=+kmod-mt7915e
232 endef
233
234 define KernelPackage/mt7915e
235 $(KernelPackage/mt76-default)
236 TITLE:=MediaTek MT7915e wireless driver
237 DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core +kmod-thermal +@DRIVER_11AX_SUPPORT +@KERNEL_RELAY
238 FILES:= $(PKG_BUILD_DIR)/mt7915/mt7915e.ko
239 AUTOLOAD:=$(call AutoProbe,mt7915e)
240 endef
241
242 define KernelPackage/mt7916-firmware
243 $(KernelPackage/mt76-default)
244 DEPENDS+=+kmod-mt7915e
245 TITLE:=MediaTek MT7916 firmware
246 endef
247
248 define KernelPackage/mt7981-firmware
249 $(KernelPackage/mt76-default)
250 DEPENDS:=@TARGET_mediatek_filogic
251 TITLE:=MediaTek MT7981 firmware
252 endef
253
254 define KernelPackage/mt7986-firmware
255 $(KernelPackage/mt76-default)
256 DEPENDS:=@TARGET_mediatek_filogic
257 TITLE:=MediaTek MT7986 firmware
258 endef
259
260 define KernelPackage/mt7921-firmware
261 $(KernelPackage/mt76-default)
262 TITLE:=MediaTek MT7921 firmware
263 endef
264
265 define KernelPackage/mt7922-firmware
266 $(KernelPackage/mt76-default)
267 TITLE:=MediaTek MT7922 firmware
268 endef
269
270 define KernelPackage/mt792x-common
271 $(KernelPackage/mt76-default)
272 TITLE:=MediaTek MT792x wireless driver common code
273 HIDDEN:=1
274 DEPENDS+=+kmod-mt76-connac +@DRIVER_11AX_SUPPORT
275 FILES:= $(PKG_BUILD_DIR)/mt792x-lib.ko
276 endef
277
278 define KernelPackage/mt792x-usb
279 $(KernelPackage/mt76-default)
280 TITLE:=MediaTek MT792x wireless driver USB code
281 HIDDEN:=1
282 DEPENDS+=+kmod-mt792x-common +kmod-mt76-usb +@DRIVER_11AX_SUPPORT
283 FILES:= $(PKG_BUILD_DIR)/mt792x-usb.ko
284 endef
285
286 define KernelPackage/mt7921-common
287 $(KernelPackage/mt76-default)
288 TITLE:=MediaTek MT7921 wireless driver common code
289 HIDDEN:=1
290 DEPENDS+=+kmod-mt792x-common +kmod-mt7921-firmware +@DRIVER_11AX_SUPPORT +kmod-hwmon-core
291 FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921-common.ko
292 endef
293
294 define KernelPackage/mt7921u
295 $(KernelPackage/mt76-default)
296 TITLE:=MediaTek MT7921U wireless driver
297 DEPENDS+=+kmod-mt792x-usb +kmod-mt7921-common
298 FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921u.ko
299 AUTOLOAD:=$(call AutoProbe,mt7921u)
300 endef
301
302 define KernelPackage/mt7921s
303 $(KernelPackage/mt76-default)
304 TITLE:=MediaTek MT7921S wireless driver
305 DEPENDS+=+kmod-mt76-sdio +kmod-mt7921-common
306 FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921s.ko
307 AUTOLOAD:=$(call AutoProbe,mt7921s)
308 endef
309
310 define KernelPackage/mt7921e
311 $(KernelPackage/mt76-default)
312 TITLE:=MediaTek MT7921e wireless driver
313 DEPENDS+=@PCI_SUPPORT +kmod-mt7921-common
314 FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921e.ko
315 AUTOLOAD:=$(call AutoProbe,mt7921e)
316 endef
317
318 define KernelPackage/mt7996e
319 $(KernelPackage/mt76-default)
320 TITLE:=MediaTek MT7996E wireless driver
321 DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac
322 FILES:= $(PKG_BUILD_DIR)/mt7996/mt7996e.ko
323 AUTOLOAD:=$(call AutoProbe,mt7996e)
324 endef
325
326 define KernelPackage/mt7925-common
327 $(KernelPackage/mt76-default)
328 TITLE:=MediaTek MT7925 wireless driver common code
329 HIDDEN:=1
330 DEPENDS+=+kmod-mt792x-common +@DRIVER_11AX_SUPPORT +kmod-hwmon-core
331 FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925-common.ko
332 endef
333
334 define KernelPackage/mt7925u
335 $(KernelPackage/mt76-default)
336 TITLE:=MediaTek MT7925U wireless driver
337 DEPENDS+=+kmod-mt792x-usb +kmod-mt7925-common
338 FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925u.ko
339 AUTOLOAD:=$(call AutoProbe,mt7921u)
340 endef
341
342 define KernelPackage/mt7925e
343 $(KernelPackage/mt76-default)
344 TITLE:=MediaTek MT7925e wireless driver
345 DEPENDS+=@PCI_SUPPORT +kmod-mt7925-common
346 FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925e.ko
347 AUTOLOAD:=$(call AutoProbe,mt7921e)
348 endef
349
350 define Package/mt76-test
351 SECTION:=devel
352 CATEGORY:=Development
353 TITLE:=mt76 testmode CLI
354 DEPENDS:=kmod-mt76-core +libnl-tiny
355 endef
356
357 TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
358
359 NOSTDINC_FLAGS := \
360 $(KERNEL_NOSTDINC_FLAGS) \
361 -I$(PKG_BUILD_DIR) \
362 -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
363 -I$(STAGING_DIR)/usr/include/mac80211-backport \
364 -I$(STAGING_DIR)/usr/include/mac80211/uapi \
365 -I$(STAGING_DIR)/usr/include/mac80211 \
366 -include backport/autoconf.h \
367 -include backport/backport.h
368
369 ifdef CONFIG_PACKAGE_MAC80211_MESH
370 NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
371 endif
372
373 ifdef CONFIG_PACKAGE_CFG80211_TESTMODE
374 NOSTDINC_FLAGS += -DCONFIG_NL80211_TESTMODE
375 PKG_MAKE_FLAGS += CONFIG_NL80211_TESTMODE=y
376 endif
377
378 ifdef CONFIG_PACKAGE_kmod-mt76-usb
379 PKG_MAKE_FLAGS += CONFIG_MT76_USB=m
380 endif
381 ifdef CONFIG_PACKAGE_kmod-mt76x02-common
382 PKG_MAKE_FLAGS += CONFIG_MT76x02_LIB=m
383 endif
384 ifdef CONFIG_PACKAGE_kmod-mt76x02-usb
385 PKG_MAKE_FLAGS += CONFIG_MT76x02_USB=m
386 endif
387 ifdef CONFIG_PACKAGE_kmod-mt76x0-common
388 PKG_MAKE_FLAGS += CONFIG_MT76x0_COMMON=m
389 endif
390 ifdef CONFIG_PACKAGE_kmod-mt76x0e
391 PKG_MAKE_FLAGS += CONFIG_MT76x0E=m
392 endif
393 ifdef CONFIG_PACKAGE_kmod-mt76x0u
394 PKG_MAKE_FLAGS += CONFIG_MT76x0U=m
395 endif
396 ifdef CONFIG_PACKAGE_kmod-mt76x2-common
397 PKG_MAKE_FLAGS += CONFIG_MT76x2_COMMON=m
398 endif
399 ifdef CONFIG_PACKAGE_kmod-mt76x2
400 PKG_MAKE_FLAGS += CONFIG_MT76x2E=m
401 endif
402 ifdef CONFIG_PACKAGE_kmod-mt76x2u
403 PKG_MAKE_FLAGS += CONFIG_MT76x2U=m
404 endif
405 ifdef CONFIG_PACKAGE_kmod-mt7603
406 PKG_MAKE_FLAGS += CONFIG_MT7603E=m
407 endif
408 ifdef CONFIG_PACKAGE_kmod-mt76-connac
409 PKG_MAKE_FLAGS += CONFIG_MT76_CONNAC_LIB=m
410 endif
411 ifdef CONFIG_PACKAGE_kmod-mt76-sdio
412 PKG_MAKE_FLAGS += CONFIG_MT76_SDIO=m
413 endif
414 ifdef CONFIG_PACKAGE_kmod-mt7615-common
415 PKG_MAKE_FLAGS += CONFIG_MT7615_COMMON=m
416 endif
417 ifdef CONFIG_PACKAGE_kmod-mt7615e
418 PKG_MAKE_FLAGS += CONFIG_MT7615E=m
419 ifdef CONFIG_TARGET_mediatek_mt7622
420 PKG_MAKE_FLAGS += CONFIG_MT7622_WMAC=y
421 NOSTDINC_FLAGS += -DCONFIG_MT7622_WMAC
422 endif
423 endif
424 ifdef CONFIG_PACKAGE_kmod-mt7663-usb-sdio
425 PKG_MAKE_FLAGS += CONFIG_MT7663_USB_SDIO_COMMON=m
426 endif
427 ifdef CONFIG_PACKAGE_kmod-mt7663s
428 PKG_MAKE_FLAGS += CONFIG_MT7663S=m
429 endif
430 ifdef CONFIG_PACKAGE_kmod-mt7663u
431 PKG_MAKE_FLAGS += CONFIG_MT7663U=m
432 endif
433 ifdef CONFIG_PACKAGE_kmod-mt7915e
434 PKG_MAKE_FLAGS += CONFIG_MT7915E=m
435 ifdef CONFIG_TARGET_mediatek_filogic
436 PKG_MAKE_FLAGS += CONFIG_MT798X_WMAC=y
437 NOSTDINC_FLAGS += -DCONFIG_MT798X_WMAC
438 endif
439 endif
440 ifdef CONFIG_PACKAGE_kmod-mt792x-common
441 PKG_MAKE_FLAGS += CONFIG_MT792x_LIB=m
442 endif
443 ifdef CONFIG_PACKAGE_kmod-mt792x-usb
444 PKG_MAKE_FLAGS += CONFIG_MT792x_USB=m
445 endif
446 ifdef CONFIG_PACKAGE_kmod-mt7921-common
447 PKG_MAKE_FLAGS += CONFIG_MT7921_COMMON=m
448 endif
449 ifdef CONFIG_PACKAGE_kmod-mt7921u
450 PKG_MAKE_FLAGS += CONFIG_MT7921U=m
451 endif
452 ifdef CONFIG_PACKAGE_kmod-mt7921s
453 PKG_MAKE_FLAGS += CONFIG_MT7921S=m
454 endif
455 ifdef CONFIG_PACKAGE_kmod-mt7921e
456 PKG_MAKE_FLAGS += CONFIG_MT7921E=m
457 endif
458 ifdef CONFIG_PACKAGE_kmod-mt7996e
459 PKG_MAKE_FLAGS += CONFIG_MT7996E=m
460 endif
461 ifdef CONFIG_PACKAGE_kmod-mt7925-common
462 PKG_MAKE_FLAGS += CONFIG_MT7925_COMMON=m
463 endif
464 ifdef CONFIG_PACKAGE_kmod-mt7925u
465 PKG_MAKE_FLAGS += CONFIG_MT7925U=m
466 endif
467 ifdef CONFIG_PACKAGE_kmod-mt7925e
468 PKG_MAKE_FLAGS += CONFIG_MT7925E=m
469 endif
470
471 define Build/Compile
472 +$(KERNEL_MAKE) $(PKG_JOBS) \
473 $(PKG_MAKE_FLAGS) \
474 M="$(PKG_BUILD_DIR)" \
475 NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
476 modules
477 $(MAKE) -C $(PKG_BUILD_DIR)/tools
478 endef
479
480 define Build/Install
481 :
482 endef
483
484 define Package/kmod-mt76/install
485 true
486 endef
487
488 define KernelPackage/mt76x0-common/install
489 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
490 cp \
491 $(PKG_BUILD_DIR)/firmware/mt7610e.bin \
492 $(1)/lib/firmware/mediatek
493 endef
494
495 define KernelPackage/mt76x2-common/install
496 $(INSTALL_DIR) $(1)/lib/firmware
497 cp \
498 $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
499 $(PKG_BUILD_DIR)/firmware/mt7662.bin \
500 $(1)/lib/firmware
501 endef
502
503 define KernelPackage/mt76x0u/install
504 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
505 ln -sf mt7610e.bin $(1)/lib/firmware/mediatek/mt7610u.bin
506 endef
507
508 define KernelPackage/mt76x2u/install
509 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
510 ln -sf ../mt7662.bin $(1)/lib/firmware/mediatek/mt7662u.bin
511 ln -sf ../mt7662_rom_patch.bin $(1)/lib/firmware/mediatek/mt7662u_rom_patch.bin
512 endef
513
514 define KernelPackage/mt7603/install
515 $(INSTALL_DIR) $(1)/lib/firmware
516 cp $(if $(CONFIG_TARGET_ramips_mt76x8), \
517 $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
518 $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
519 ,\
520 $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
521 $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
522 ) \
523 $(1)/lib/firmware
524 endef
525
526 define KernelPackage/mt7615-firmware/install
527 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
528 cp \
529 $(PKG_BUILD_DIR)/firmware/mt7615_cr4.bin \
530 $(PKG_BUILD_DIR)/firmware/mt7615_n9.bin \
531 $(PKG_BUILD_DIR)/firmware/mt7615_rom_patch.bin \
532 $(1)/lib/firmware/mediatek
533 endef
534
535 define KernelPackage/mt7622-firmware/install
536 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
537 cp \
538 $(PKG_BUILD_DIR)/firmware/mt7622_n9.bin \
539 $(PKG_BUILD_DIR)/firmware/mt7622_rom_patch.bin \
540 $(1)/lib/firmware/mediatek
541 endef
542
543 define KernelPackage/mt7663-firmware-ap/install
544 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
545 cp \
546 $(PKG_BUILD_DIR)/firmware/mt7663_n9_rebb.bin \
547 $(PKG_BUILD_DIR)/firmware/mt7663pr2h_rebb.bin \
548 $(1)/lib/firmware/mediatek
549 endef
550
551 define KernelPackage/mt7663-firmware-sta/install
552 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
553 cp \
554 $(PKG_BUILD_DIR)/firmware/mt7663_n9_v3.bin \
555 $(PKG_BUILD_DIR)/firmware/mt7663pr2h.bin \
556 $(1)/lib/firmware/mediatek
557 endef
558
559 define KernelPackage/mt7915-firmware/install
560 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
561 cp \
562 $(PKG_BUILD_DIR)/firmware/mt7915_wa.bin \
563 $(PKG_BUILD_DIR)/firmware/mt7915_wm.bin \
564 $(PKG_BUILD_DIR)/firmware/mt7915_rom_patch.bin \
565 $(1)/lib/firmware/mediatek
566 endef
567
568 define KernelPackage/mt7916-firmware/install
569 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
570 cp \
571 $(PKG_BUILD_DIR)/firmware/mt7916_wa.bin \
572 $(PKG_BUILD_DIR)/firmware/mt7916_wm.bin \
573 $(PKG_BUILD_DIR)/firmware/mt7916_rom_patch.bin \
574 $(1)/lib/firmware/mediatek
575 endef
576
577 define KernelPackage/mt7981-firmware/install
578 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
579 cp \
580 $(PKG_BUILD_DIR)/firmware/mt7981_wa.bin \
581 $(PKG_BUILD_DIR)/firmware/mt7981_wm.bin \
582 $(PKG_BUILD_DIR)/firmware/mt7981_rom_patch.bin \
583 $(1)/lib/firmware/mediatek
584 endef
585
586 define KernelPackage/mt7986-firmware/install
587 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
588 cp \
589 $(PKG_BUILD_DIR)/firmware/mt7986_wa.bin \
590 $(PKG_BUILD_DIR)/firmware/mt7986_wm_mt7975.bin \
591 $(PKG_BUILD_DIR)/firmware/mt7986_wm.bin \
592 $(PKG_BUILD_DIR)/firmware/mt7986_rom_patch_mt7975.bin \
593 $(PKG_BUILD_DIR)/firmware/mt7986_rom_patch.bin \
594 $(1)/lib/firmware/mediatek
595 endef
596
597 define KernelPackage/mt7921-firmware/install
598 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
599 cp \
600 $(PKG_BUILD_DIR)/firmware/WIFI_MT7961_patch_mcu_1_2_hdr.bin \
601 $(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7961_1.bin \
602 $(1)/lib/firmware/mediatek
603 endef
604
605 define KernelPackage/mt7922-firmware/install
606 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
607 cp \
608 $(PKG_BUILD_DIR)/firmware/WIFI_MT7922_patch_mcu_1_1_hdr.bin \
609 $(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7922_1.bin \
610 $(1)/lib/firmware/mediatek
611 endef
612
613 define Package/mt76-test/install
614 mkdir -p $(1)/usr/sbin
615 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin
616 endef
617
618 $(eval $(call KernelPackage,mt76-core))
619 $(eval $(call KernelPackage,mt76-usb))
620 $(eval $(call KernelPackage,mt76x02-usb))
621 $(eval $(call KernelPackage,mt76x02-common))
622 $(eval $(call KernelPackage,mt76x0-common))
623 $(eval $(call KernelPackage,mt76x0e))
624 $(eval $(call KernelPackage,mt76x0u))
625 $(eval $(call KernelPackage,mt76x2-common))
626 $(eval $(call KernelPackage,mt76x2u))
627 $(eval $(call KernelPackage,mt76x2))
628 $(eval $(call KernelPackage,mt7603))
629 $(eval $(call KernelPackage,mt76-connac))
630 $(eval $(call KernelPackage,mt76-sdio))
631 $(eval $(call KernelPackage,mt7615-common))
632 $(eval $(call KernelPackage,mt7615-firmware))
633 $(eval $(call KernelPackage,mt7622-firmware))
634 $(eval $(call KernelPackage,mt7615e))
635 $(eval $(call KernelPackage,mt7663-firmware-ap))
636 $(eval $(call KernelPackage,mt7663-firmware-sta))
637 $(eval $(call KernelPackage,mt7663-usb-sdio))
638 $(eval $(call KernelPackage,mt7663u))
639 $(eval $(call KernelPackage,mt7663s))
640 $(eval $(call KernelPackage,mt7915-firmware))
641 $(eval $(call KernelPackage,mt7915e))
642 $(eval $(call KernelPackage,mt7916-firmware))
643 $(eval $(call KernelPackage,mt7981-firmware))
644 $(eval $(call KernelPackage,mt7986-firmware))
645 $(eval $(call KernelPackage,mt7921-firmware))
646 $(eval $(call KernelPackage,mt7922-firmware))
647 $(eval $(call KernelPackage,mt792x-common))
648 $(eval $(call KernelPackage,mt792x-usb))
649 $(eval $(call KernelPackage,mt7921-common))
650 $(eval $(call KernelPackage,mt7925-common))
651 $(eval $(call KernelPackage,mt7921u))
652 $(eval $(call KernelPackage,mt7921s))
653 $(eval $(call KernelPackage,mt7921e))
654 $(eval $(call KernelPackage,mt7925u))
655 $(eval $(call KernelPackage,mt7925e))
656 $(eval $(call KernelPackage,mt7996e))
657 $(eval $(call KernelPackage,mt76))
658 $(eval $(call BuildPackage,mt76-test))