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