blob: e34efdfc5129b4ef40cb5d74194691f2e6ec6ea3 [file] [log] [blame]
developerf11ee162022-04-12 11:17:45 +08001DESCRIPTION = "Mediatek Wireless Drivers"
2SECTION = "kernel/modules"
3LICENSE = "GPLv2"
4LIC_FILES_CHKSUM = "file://COPYING;md5=c188eeeb69c0a05d0545816f1458a0c9"
5
6inherit module
7
developera20cdc22024-05-31 18:57:31 +08008require mt76-3x.inc
developerf11ee162022-04-12 11:17:45 +08009SRC_URI = " \
developer93e97202024-01-17 12:29:44 +080010 git://git@github.com/openwrt/mt76.git;protocol=https;branch=master \
developerf11ee162022-04-12 11:17:45 +080011 file://COPYING;subdir=git \
12 "
developerbc4d8032022-04-15 13:47:16 +080013SRC_URI += " \
14 file://src \
15 "
developerf11ee162022-04-12 11:17:45 +080016
developere6cee7d2022-11-16 18:00:20 +080017
18
developerf11ee162022-04-12 11:17:45 +080019DEPENDS += "virtual/kernel"
20DEPENDS += "linux-mac80211"
21
developere2cfb522022-12-08 18:09:45 +080022FILESEXTRAPATHS_prepend := "${THISDIR}/files/patches-${PV}:"
developerbc4d8032022-04-15 13:47:16 +080023FILESEXTRAPATHS_prepend := "${THISDIR}/src:"
developerf11ee162022-04-12 11:17:45 +080024
developer5f4cfb12022-12-15 16:48:11 +080025require files/patches-${PV}/patches.inc
developerfd901d92024-04-29 17:16:53 +080026SRC_URI_append += " \
27 file://5000-mt76-add-internal-wed_tiny-header-file.patch \
28 file://0118-fixup-wifi-mt76-mt7996-temp-support-for-single-wiphy.patch \
29 "
developerf11ee162022-04-12 11:17:45 +080030
developerf11ee162022-04-12 11:17:45 +080031S = "${WORKDIR}/git"
32
developere6cee7d2022-11-16 18:00:20 +080033
developerf11ee162022-04-12 11:17:45 +080034NOSTDINC_FLAGS = " \
35 -I${B} \
36 -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211-backport/uapi \
37 -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211-backport \
38 -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211/uapi \
39 -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211 \
40 -include backport/autoconf.h \
41 -include backport/backport.h \
42 "
43
44PKG_MAKE_FLAGS = " \
45 CONFIG_MAC80211_DEBUGFS=y \
46 CONFIG_NL80211_TESTMODE=y \
47 CONFIG_MT76_CONNAC_LIB=m \
developerf8dbcb32022-12-15 18:14:59 +080048 CONFIG_MT7996E=m \
developerf11ee162022-04-12 11:17:45 +080049 "
50
51NOSTDINC_FLAGS += " \
52 -DCONFIG_MAC80211_MESH \
53 -DCONFIG_NL80211_TESTMODE \
54 -DCONFIG_MAC80211_DEBUGFS \
developerf11ee162022-04-12 11:17:45 +080055 "
56
57EXTRA_OEMAKE = " \
58 -C ${STAGING_KERNEL_BUILDDIR}/ \
59 M=${S} \
60 ${PKG_MAKE_FLAGS} \
61 NOSTDINC_FLAGS="${NOSTDINC_FLAGS}" \
62 "
63
64MAKE_TARGETS = "modules"
65
66do_configure[noexec] = "1"
67
68# make_scripts requires kernel source directory to create
69# kernel scripts
70do_make_scripts[depends] += "virtual/kernel:do_shared_workdir"
71
72do_install() {
73 # Module
74 install -d ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/
developerf11ee162022-04-12 11:17:45 +080075 install -m 0644 ${B}/mt76.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/
76 install -m 0644 ${B}/mt76-connac-lib.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/
developerf8dbcb32022-12-15 18:14:59 +080077 install -m 0644 ${B}/mt7996/mt7996e.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/
developerf11ee162022-04-12 11:17:45 +080078}
79
developerbc4d8032022-04-15 13:47:16 +080080do_install_append () {
developerf8dbcb32022-12-15 18:14:59 +080081 install -d ${D}/${base_libdir}/firmware/mediatek/mt7996
developerc62da672022-12-26 16:10:38 +080082 install -m 644 ${WORKDIR}/src/firmware/mt7996/mt7996*.* ${D}${base_libdir}/firmware/mediatek/mt7996
developer813b9962024-03-15 14:45:44 +080083 install -m 644 ${WORKDIR}/src/firmware/mt7996/mt7992*.* ${D}${base_libdir}/firmware/mediatek/mt7996
developer6ba5f602022-11-24 13:04:49 +080084}
85
developerf8dbcb32022-12-15 18:14:59 +080086do_install_append_mt7988 () {
developer6ba5f602022-11-24 13:04:49 +080087 install -d ${D}/${base_libdir}/firmware/mediatek/
developerce673142022-08-30 10:54:58 +080088
developerd7066b02023-04-21 11:17:26 +080089 install -m 644 ${WORKDIR}/src/firmware/mtk_wo_0.bin ${D}${base_libdir}/firmware/mediatek/
90 install -m 644 ${WORKDIR}/src/firmware/mtk_wo_1.bin ${D}${base_libdir}/firmware/mediatek/
91 install -m 644 ${WORKDIR}/src/firmware/mtk_wo_2.bin ${D}${base_libdir}/firmware/mediatek/
developerbc4d8032022-04-15 13:47:16 +080092}
developer6ba5f602022-11-24 13:04:49 +080093
developer71d801e2022-11-02 18:14:41 +080094FILES_${PN} += "${base_libdir}/firmware/mediatek/*"
developerbc4d8032022-04-15 13:47:16 +080095
developerbc4d8032022-04-15 13:47:16 +080096# Make linux-mt76 depend on all of the split-out packages.
97python populate_packages_prepend () {
98 firmware_pkgs = oe.utils.packages_filter_out_system(d)
99 d.appendVar('RDEPENDS_linux-mt76', ' ' + ' '.join(firmware_pkgs))
100}
101
developer71d801e2022-11-02 18:14:41 +0800102#RPROVIDES_${PN} += "kernel-module-${PN}-${KERNEL_VERSION}"
103#RPROVIDES_${PN} += "kernel-module-${PN}-connac-lib-${KERNEL_VERSION}"
104
developerf8dbcb32022-12-15 18:14:59 +0800105KERNEL_MODULE_AUTOLOAD += "mt7996e"