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