blob: b9a69c7de75a8be5d5540e6c24e070d8b95eaeed [file] [log] [blame]
developerec4ebe42022-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
developere35b8e42023-10-16 11:04:00 +08008require mt76.inc
developerec4ebe42022-04-12 11:17:45 +08009SRC_URI = " \
10 git://git@github.com/openwrt/mt76.git;protocol=https \
11 file://COPYING;subdir=git \
12 "
developerbc7ed682022-04-15 13:47:16 +080013SRC_URI += " \
14 file://src \
15 "
developerec4ebe42022-04-12 11:17:45 +080016
developerddae1502022-11-16 18:00:20 +080017
18
developerec4ebe42022-04-12 11:17:45 +080019DEPENDS += "virtual/kernel"
20DEPENDS += "linux-mac80211"
21
developer6a1998b2022-12-08 18:09:45 +080022FILESEXTRAPATHS_prepend := "${THISDIR}/files/patches-${PV}:"
developerbc7ed682022-04-15 13:47:16 +080023FILESEXTRAPATHS_prepend := "${THISDIR}/src:"
developerec4ebe42022-04-12 11:17:45 +080024
developerd4e2b9d2022-12-15 16:48:11 +080025require files/patches-${PV}/patches.inc
26SRC_URI_append += "file://5000-mt76-add-internal-wed_tiny-header-file.patch"
developerec4ebe42022-04-12 11:17:45 +080027
developerec4ebe42022-04-12 11:17:45 +080028S = "${WORKDIR}/git"
29
developerddae1502022-11-16 18:00:20 +080030
developerec4ebe42022-04-12 11:17:45 +080031NOSTDINC_FLAGS = " \
32 -I${B} \
33 -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211-backport/uapi \
34 -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211-backport \
35 -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211/uapi \
36 -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211 \
37 -include backport/autoconf.h \
38 -include backport/backport.h \
39 "
40
41PKG_MAKE_FLAGS = " \
42 CONFIG_MAC80211_DEBUGFS=y \
43 CONFIG_NL80211_TESTMODE=y \
44 CONFIG_MT76_CONNAC_LIB=m \
developer2627faa2022-12-15 18:14:59 +080045 CONFIG_MT7996E=m \
developerec4ebe42022-04-12 11:17:45 +080046 "
47
48NOSTDINC_FLAGS += " \
49 -DCONFIG_MAC80211_MESH \
50 -DCONFIG_NL80211_TESTMODE \
51 -DCONFIG_MAC80211_DEBUGFS \
developerec4ebe42022-04-12 11:17:45 +080052 "
53
54EXTRA_OEMAKE = " \
55 -C ${STAGING_KERNEL_BUILDDIR}/ \
56 M=${S} \
57 ${PKG_MAKE_FLAGS} \
58 NOSTDINC_FLAGS="${NOSTDINC_FLAGS}" \
59 "
60
61MAKE_TARGETS = "modules"
62
63do_configure[noexec] = "1"
64
65# make_scripts requires kernel source directory to create
66# kernel scripts
67do_make_scripts[depends] += "virtual/kernel:do_shared_workdir"
68
69do_install() {
70 # Module
71 install -d ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/
72 install -d ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/mt7615/
73 install -d ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/mt7915/
74 install -m 0644 ${B}/mt76.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/
75 install -m 0644 ${B}/mt76-connac-lib.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/
developer2627faa2022-12-15 18:14:59 +080076 install -m 0644 ${B}/mt7996/mt7996e.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/
developerec4ebe42022-04-12 11:17:45 +080077}
78
developerbc7ed682022-04-15 13:47:16 +080079do_install_append () {
80 install -d ${D}/${base_libdir}/firmware/mediatek/
81
82 install -m 644 ${WORKDIR}/src/firmware/mt7915_rom_patch.bin ${D}${base_libdir}/firmware/mediatek/
83 install -m 644 ${WORKDIR}/src/firmware/mt7915_wa.bin ${D}${base_libdir}/firmware/mediatek/
84 install -m 644 ${WORKDIR}/src/firmware/mt7915_wm.bin ${D}${base_libdir}/firmware/mediatek/
85 install -m 644 ${WORKDIR}/src/firmware/mt7915_eeprom.bin ${D}${base_libdir}/firmware/mediatek/
86 install -m 644 ${WORKDIR}/src/firmware/mt7915_eeprom_dbdc.bin ${D}${base_libdir}/firmware/mediatek/
87
developerf8dda1f2022-08-30 10:54:58 +080088 install -m 644 ${WORKDIR}/src/firmware/mt7916_rom_patch.bin ${D}${base_libdir}/firmware/mediatek/
89 install -m 644 ${WORKDIR}/src/firmware/mt7916_wa.bin ${D}${base_libdir}/firmware/mediatek/
90 install -m 644 ${WORKDIR}/src/firmware/mt7916_wm.bin ${D}${base_libdir}/firmware/mediatek/
91 install -m 644 ${WORKDIR}/src/firmware/mt7916_eeprom.bin ${D}${base_libdir}/firmware/mediatek/
developer2627faa2022-12-15 18:14:59 +080092
93 install -d ${D}/${base_libdir}/firmware/mediatek/mt7996
developer7af62e72022-12-26 16:10:38 +080094 install -m 644 ${WORKDIR}/src/firmware/mt7996/mt7996*.* ${D}${base_libdir}/firmware/mediatek/mt7996
developer5e697a22022-11-24 13:04:49 +080095}
96
developer2627faa2022-12-15 18:14:59 +080097do_install_append_mt7988 () {
developer5e697a22022-11-24 13:04:49 +080098 install -d ${D}/${base_libdir}/firmware/mediatek/
developerf8dda1f2022-08-30 10:54:58 +080099
developer08748a42023-04-21 11:17:26 +0800100 install -m 644 ${WORKDIR}/src/firmware/mtk_wo_0.bin ${D}${base_libdir}/firmware/mediatek/
101 install -m 644 ${WORKDIR}/src/firmware/mtk_wo_1.bin ${D}${base_libdir}/firmware/mediatek/
102 install -m 644 ${WORKDIR}/src/firmware/mtk_wo_2.bin ${D}${base_libdir}/firmware/mediatek/
developerbc7ed682022-04-15 13:47:16 +0800103}
developer5e697a22022-11-24 13:04:49 +0800104
developerca2d55d2022-11-02 18:14:41 +0800105FILES_${PN} += "${base_libdir}/firmware/mediatek/*"
developerbc7ed682022-04-15 13:47:16 +0800106
developerbc7ed682022-04-15 13:47:16 +0800107# Make linux-mt76 depend on all of the split-out packages.
108python populate_packages_prepend () {
109 firmware_pkgs = oe.utils.packages_filter_out_system(d)
110 d.appendVar('RDEPENDS_linux-mt76', ' ' + ' '.join(firmware_pkgs))
111}
112
developerca2d55d2022-11-02 18:14:41 +0800113#RPROVIDES_${PN} += "kernel-module-${PN}-${KERNEL_VERSION}"
114#RPROVIDES_${PN} += "kernel-module-${PN}-connac-lib-${KERNEL_VERSION}"
115
developer2627faa2022-12-15 18:14:59 +0800116#KERNEL_MODULE_AUTOLOAD += "mt7915e"
117KERNEL_MODULE_AUTOLOAD += "mt7996e"