developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 1 | DESCRIPTION = "Mediatek Wireless Drivers" |
| 2 | SECTION = "kernel/modules" |
| 3 | LICENSE = "GPLv2" |
| 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=c188eeeb69c0a05d0545816f1458a0c9" |
| 5 | |
| 6 | inherit module |
| 7 | |
developer | 17bb0a8 | 2022-12-13 15:52:04 +0800 | [diff] [blame] | 8 | require mt76.inc |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 9 | SRC_URI = " \ |
| 10 | git://git@github.com/openwrt/mt76.git;protocol=https \ |
| 11 | file://COPYING;subdir=git \ |
developer | e6cee7d | 2022-11-16 18:00:20 +0800 | [diff] [blame] | 12 | file://0001-mt76-add-internal-wed_tiny-header-file.patch;apply=no \ |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 13 | " |
developer | bc4d803 | 2022-04-15 13:47:16 +0800 | [diff] [blame] | 14 | SRC_URI += " \ |
| 15 | file://src \ |
| 16 | " |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 17 | |
developer | e6cee7d | 2022-11-16 18:00:20 +0800 | [diff] [blame] | 18 | |
| 19 | |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 20 | DEPENDS += "virtual/kernel" |
| 21 | DEPENDS += "linux-mac80211" |
| 22 | |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 23 | FILESEXTRAPATHS_prepend := "${THISDIR}/files/patches-${PV}:" |
developer | bc4d803 | 2022-04-15 13:47:16 +0800 | [diff] [blame] | 24 | FILESEXTRAPATHS_prepend := "${THISDIR}/src:" |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 25 | |
developer | e6cee7d | 2022-11-16 18:00:20 +0800 | [diff] [blame] | 26 | SRC_URI += "file://*.patch;apply=no" |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 27 | |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 28 | S = "${WORKDIR}/git" |
| 29 | |
developer | e6cee7d | 2022-11-16 18:00:20 +0800 | [diff] [blame] | 30 | do_mtk_patches() { |
| 31 | cd ${S} |
| 32 | |
| 33 | DISTRO_FlowBlock_ENABLED="${@bb.utils.contains('DISTRO_FEATURES','flow_offload','true','false',d)}" |
| 34 | |
| 35 | if [ ! -e mtk_wifi_patch_applied ]; then |
| 36 | for i in ${WORKDIR}/*.patch |
| 37 | do |
| 38 | if [ $DISTRO_FlowBlock_ENABLED = 'true' ]; then |
| 39 | patch -p1 < $i; |
| 40 | else |
| 41 | prefix=$(echo -n "${WORKDIR}"|wc -c) |
| 42 | patch_number_start=$(expr $prefix + 2) |
| 43 | patch_number_end=$(expr $patch_number_start + 3 ) |
| 44 | patch_number=$(echo "$i" | cut -c"$patch_number_start"-"$patch_number_end") |
| 45 | |
| 46 | if [ "$patch_number" -ge "3000" ]; then |
| 47 | continue; |
| 48 | else |
| 49 | patch -p1 < $i; |
| 50 | fi |
| 51 | fi |
| 52 | done |
| 53 | fi |
| 54 | touch mtk_wifi_patch_applied |
| 55 | } |
| 56 | addtask mtk_patches after do_patch before do_configure |
| 57 | |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 58 | NOSTDINC_FLAGS = " \ |
| 59 | -I${B} \ |
| 60 | -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211-backport/uapi \ |
| 61 | -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211-backport \ |
| 62 | -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211/uapi \ |
| 63 | -I${STAGING_KERNEL_BUILDDIR}/usr/include/mac80211 \ |
| 64 | -include backport/autoconf.h \ |
| 65 | -include backport/backport.h \ |
| 66 | " |
| 67 | |
| 68 | PKG_MAKE_FLAGS = " \ |
| 69 | CONFIG_MAC80211_DEBUGFS=y \ |
| 70 | CONFIG_NL80211_TESTMODE=y \ |
| 71 | CONFIG_MT76_CONNAC_LIB=m \ |
developer | f8dbcb3 | 2022-12-15 18:14:59 +0800 | [diff] [blame^] | 72 | CONFIG_MT7996E=m \ |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 73 | " |
| 74 | |
| 75 | NOSTDINC_FLAGS += " \ |
| 76 | -DCONFIG_MAC80211_MESH \ |
| 77 | -DCONFIG_NL80211_TESTMODE \ |
| 78 | -DCONFIG_MAC80211_DEBUGFS \ |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 79 | " |
| 80 | |
| 81 | EXTRA_OEMAKE = " \ |
| 82 | -C ${STAGING_KERNEL_BUILDDIR}/ \ |
| 83 | M=${S} \ |
| 84 | ${PKG_MAKE_FLAGS} \ |
| 85 | NOSTDINC_FLAGS="${NOSTDINC_FLAGS}" \ |
| 86 | " |
| 87 | |
| 88 | MAKE_TARGETS = "modules" |
| 89 | |
| 90 | do_configure[noexec] = "1" |
| 91 | |
| 92 | # make_scripts requires kernel source directory to create |
| 93 | # kernel scripts |
| 94 | do_make_scripts[depends] += "virtual/kernel:do_shared_workdir" |
| 95 | |
| 96 | do_install() { |
| 97 | # Module |
| 98 | install -d ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/ |
| 99 | install -d ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/mt7615/ |
| 100 | install -d ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/mt7915/ |
| 101 | install -m 0644 ${B}/mt76.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/ |
| 102 | install -m 0644 ${B}/mt76-connac-lib.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/ |
developer | f8dbcb3 | 2022-12-15 18:14:59 +0800 | [diff] [blame^] | 103 | install -m 0644 ${B}/mt7996/mt7996e.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/drivers/net/wireless/mediatek/mt76/ |
developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 104 | } |
| 105 | |
developer | bc4d803 | 2022-04-15 13:47:16 +0800 | [diff] [blame] | 106 | do_install_append () { |
| 107 | install -d ${D}/${base_libdir}/firmware/mediatek/ |
| 108 | |
| 109 | install -m 644 ${WORKDIR}/src/firmware/mt7915_rom_patch.bin ${D}${base_libdir}/firmware/mediatek/ |
| 110 | install -m 644 ${WORKDIR}/src/firmware/mt7915_wa.bin ${D}${base_libdir}/firmware/mediatek/ |
| 111 | install -m 644 ${WORKDIR}/src/firmware/mt7915_wm.bin ${D}${base_libdir}/firmware/mediatek/ |
| 112 | install -m 644 ${WORKDIR}/src/firmware/mt7915_eeprom.bin ${D}${base_libdir}/firmware/mediatek/ |
| 113 | install -m 644 ${WORKDIR}/src/firmware/mt7915_eeprom_dbdc.bin ${D}${base_libdir}/firmware/mediatek/ |
| 114 | |
developer | ce67314 | 2022-08-30 10:54:58 +0800 | [diff] [blame] | 115 | install -m 644 ${WORKDIR}/src/firmware/mt7916_rom_patch.bin ${D}${base_libdir}/firmware/mediatek/ |
| 116 | install -m 644 ${WORKDIR}/src/firmware/mt7916_wa.bin ${D}${base_libdir}/firmware/mediatek/ |
| 117 | install -m 644 ${WORKDIR}/src/firmware/mt7916_wm.bin ${D}${base_libdir}/firmware/mediatek/ |
| 118 | install -m 644 ${WORKDIR}/src/firmware/mt7916_eeprom.bin ${D}${base_libdir}/firmware/mediatek/ |
developer | f8dbcb3 | 2022-12-15 18:14:59 +0800 | [diff] [blame^] | 119 | |
| 120 | install -d ${D}/${base_libdir}/firmware/mediatek/mt7996 |
| 121 | install -m 644 ${WORKDIR}/src/firmware/mt7996_wa.bin ${D}${base_libdir}/firmware/mediatek/mt7996 |
| 122 | install -m 644 ${WORKDIR}/src/firmware/mt7996_wm.bin ${D}${base_libdir}/firmware/mediatek/mt7996 |
| 123 | install -m 644 ${WORKDIR}/src/firmware/mt7996_rom_patch.bin ${D}${base_libdir}/firmware/mediatek/mt7996 |
| 124 | install -m 644 ${WORKDIR}/src/firmware/mt7996_eeprom.bin ${D}${base_libdir}/firmware/mediatek/mt7996 |
developer | 6ba5f60 | 2022-11-24 13:04:49 +0800 | [diff] [blame] | 125 | } |
| 126 | |
developer | f8dbcb3 | 2022-12-15 18:14:59 +0800 | [diff] [blame^] | 127 | do_install_append_mt7988 () { |
developer | 6ba5f60 | 2022-11-24 13:04:49 +0800 | [diff] [blame] | 128 | install -d ${D}/${base_libdir}/firmware/mediatek/ |
developer | ce67314 | 2022-08-30 10:54:58 +0800 | [diff] [blame] | 129 | |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 130 | install -m 644 ${WORKDIR}/src/firmware/mt7986_wo_0.bin ${D}${base_libdir}/firmware/mediatek/ |
| 131 | install -m 644 ${WORKDIR}/src/firmware/mt7986_wo_1.bin ${D}${base_libdir}/firmware/mediatek/ |
developer | bc4d803 | 2022-04-15 13:47:16 +0800 | [diff] [blame] | 132 | } |
developer | 6ba5f60 | 2022-11-24 13:04:49 +0800 | [diff] [blame] | 133 | |
developer | 71d801e | 2022-11-02 18:14:41 +0800 | [diff] [blame] | 134 | FILES_${PN} += "${base_libdir}/firmware/mediatek/*" |
developer | bc4d803 | 2022-04-15 13:47:16 +0800 | [diff] [blame] | 135 | |
developer | bc4d803 | 2022-04-15 13:47:16 +0800 | [diff] [blame] | 136 | # Make linux-mt76 depend on all of the split-out packages. |
| 137 | python populate_packages_prepend () { |
| 138 | firmware_pkgs = oe.utils.packages_filter_out_system(d) |
| 139 | d.appendVar('RDEPENDS_linux-mt76', ' ' + ' '.join(firmware_pkgs)) |
| 140 | } |
| 141 | |
developer | 71d801e | 2022-11-02 18:14:41 +0800 | [diff] [blame] | 142 | #RPROVIDES_${PN} += "kernel-module-${PN}-${KERNEL_VERSION}" |
| 143 | #RPROVIDES_${PN} += "kernel-module-${PN}-connac-lib-${KERNEL_VERSION}" |
| 144 | |
developer | f8dbcb3 | 2022-12-15 18:14:59 +0800 | [diff] [blame^] | 145 | #KERNEL_MODULE_AUTOLOAD += "mt7915e" |
| 146 | KERNEL_MODULE_AUTOLOAD += "mt7996e" |