From 06c887d3b1806725f735b84f8c40a3a3b2b911b7 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Feb 15 2022 15:35:30 +0000 Subject: import kmod-redhat-mt7921-4.18.0_363_dup8.5-2.el8_5 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea15279 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/mt7921-redhat-4.18.0_363_dup8.5.tar.bz2 diff --git a/.kmod-redhat-mt7921.metadata b/.kmod-redhat-mt7921.metadata new file mode 100644 index 0000000..cc0a389 --- /dev/null +++ b/.kmod-redhat-mt7921.metadata @@ -0,0 +1 @@ +e1054ed9ea73391a1abada6427ec349f7c979de3 SOURCES/mt7921-redhat-4.18.0_363_dup8.5.tar.bz2 diff --git a/SOURCES/0001-mt76-connac-do-not-schedule-mac_work-if-the-device-i.patch b/SOURCES/0001-mt76-connac-do-not-schedule-mac_work-if-the-device-i.patch new file mode 100644 index 0000000..c20d8d9 --- /dev/null +++ b/SOURCES/0001-mt76-connac-do-not-schedule-mac_work-if-the-device-i.patch @@ -0,0 +1,50 @@ +From 964125ac411b6b5cf34322887ee16d3e500c8d52 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= +Date: Tue, 21 Dec 2021 14:23:22 +0100 +Subject: [PATCH] mt76: connac: do not schedule mac_work if the device is not + running +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Bugzilla: http://bugzilla.redhat.com/2041422 + +commit 6061fcf4820a2036189d0a6215f75a913f0fb5a1 +Author: Lorenzo Bianconi +Date: Fri Apr 23 16:27:11 2021 +0200 + + mt76: connac: do not schedule mac_work if the device is not running + + Do not run ieee80211_queue_delayed_work for mac work if the worqueue is + not initialized yet + + Fixes: b1bd7bb8121d ("mt76: connac: unschedule mac_work before going to sleep") + Signed-off-by: Lorenzo Bianconi + Signed-off-by: Kalle Valo + Link: https://lore.kernel.org/r/5bfd36a75799c37b12fcb54d17e77fbc2c7a0558.1619187875.git.lorenzo@kernel.org + +Signed-off-by: Íñigo Huguet +--- + drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 5 +++-- + drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 5 +++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +index 214bd1859792..decf2d5f0ce3 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +@@ -1404,8 +1404,9 @@ void mt7921_pm_wake_work(struct work_struct *work) + napi_schedule(&dev->mt76.napi[i]); + mt76_connac_pm_dequeue_skbs(mphy, &dev->pm); + mt7921_tx_cleanup(dev); +- ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work, +- MT7921_WATCHDOG_TIME); ++ if (test_bit(MT76_STATE_RUNNING, &mphy->state)) ++ ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work, ++ MT7921_WATCHDOG_TIME); + } + + ieee80211_wake_queues(mphy->hw); +-- +2.13.6 + diff --git a/SOURCES/0002-mt76-mt7921-continue-to-probe-driver-when-fw-already.patch b/SOURCES/0002-mt76-mt7921-continue-to-probe-driver-when-fw-already.patch new file mode 100644 index 0000000..2f42c15 --- /dev/null +++ b/SOURCES/0002-mt76-mt7921-continue-to-probe-driver-when-fw-already.patch @@ -0,0 +1,56 @@ +From d866e32d4b1449883bdf16d27a88173e7e3eff08 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= +Date: Tue, 21 Dec 2021 14:23:33 +0100 +Subject: [PATCH] mt76: mt7921: continue to probe driver when fw already + downloaded +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Bugzilla: http://bugzilla.redhat.com/2041422 + +commit c34269041185dad1bab7a34f42ef9fab967a1684 +Author: Aaron Ma +Date: Thu Jul 8 21:17:10 2021 +0800 + + mt76: mt7921: continue to probe driver when fw already downloaded + + When reboot system, no power cycles, firmware is already downloaded, + return -EIO will break driver as error: + mt7921e: probe of 0000:03:00.0 failed with error -5 + + Skip firmware download and continue to probe. + + Signed-off-by: Aaron Ma + Fixes: 1c099ab44727c ("mt76: mt7921: add MCU support") + Signed-off-by: David S. Miller + +Signed-off-by: Íñigo Huguet +--- + drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +index 5f3d56d570a5..3fdb4c0895c9 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +@@ -907,7 +907,7 @@ static int mt7921_load_firmware(struct mt7921_dev *dev) + ret = mt76_get_field(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_N9_RDY); + if (ret) { + dev_dbg(dev->mt76.dev, "Firmware is already download\n"); +- return -EIO; ++ goto fw_loaded; + } + + ret = mt7921_load_patch(dev); +@@ -925,6 +925,7 @@ static int mt7921_load_firmware(struct mt7921_dev *dev) + return -EIO; + } + ++fw_loaded: + mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_FWDL], false); + + #ifdef CONFIG_PM +-- +2.13.6 + diff --git a/SOURCES/9000-force-enable-mt7921.patch b/SOURCES/9000-force-enable-mt7921.patch new file mode 100644 index 0000000..7d94294 --- /dev/null +++ b/SOURCES/9000-force-enable-mt7921.patch @@ -0,0 +1,55 @@ +Index: src/drivers/net/wireless/mediatek/mt76/mt7921/Makefile +=================================================================== +--- src.orig/drivers/net/wireless/mediatek/mt76/mt7921/Makefile 2022-01-30 05:38:12.755480439 +0100 ++++ src/drivers/net/wireless/mediatek/mt76/mt7921/Makefile 2022-01-30 05:39:05.150986998 +0100 +@@ -1,5 +1,7 @@ + #SPDX-License-Identifier: ISC + ++CONFIG_MT7921E := m ++ + obj-$(CONFIG_MT7921E) += mt7921e.o + + CFLAGS_trace.o := -I$(src) +Index: src/drivers/net/wireless/mediatek/mt76/Makefile +=================================================================== +--- src.orig/drivers/net/wireless/mediatek/mt76/Makefile 2022-01-30 05:38:12.755480439 +0100 ++++ src/drivers/net/wireless/mediatek/mt76/Makefile 2022-01-30 05:41:43.749493377 +0100 +@@ -1,9 +1,8 @@ + # SPDX-License-Identifier: GPL-2.0-only ++CONFIG_MT76_CONNAC_LIB := m ++CONFIG_MT7921E := m ++ + obj-$(CONFIG_MT76_CORE) += mt76.o +-obj-$(CONFIG_MT76_USB) += mt76-usb.o +-obj-$(CONFIG_MT76_SDIO) += mt76-sdio.o +-obj-$(CONFIG_MT76x02_LIB) += mt76x02-lib.o +-obj-$(CONFIG_MT76x02_USB) += mt76x02-usb.o + obj-$(CONFIG_MT76_CONNAC_LIB) += mt76-connac-lib.o + + mt76-y := \ +@@ -13,25 +12,8 @@ + mt76-$(CONFIG_PCI) += pci.o + mt76-$(CONFIG_NL80211_TESTMODE) += testmode.o + +-mt76-usb-y := usb.o usb_trace.o +-mt76-sdio-y := sdio.o +- + CFLAGS_trace.o := -I$(src) +-CFLAGS_usb_trace.o := -I$(src) +-CFLAGS_mt76x02_trace.o := -I$(src) +- +-mt76x02-lib-y := mt76x02_util.o mt76x02_mac.o mt76x02_mcu.o \ +- mt76x02_eeprom.o mt76x02_phy.o mt76x02_mmio.o \ +- mt76x02_txrx.o mt76x02_trace.o mt76x02_debugfs.o \ +- mt76x02_dfs.o mt76x02_beacon.o +- +-mt76x02-usb-y := mt76x02_usb_mcu.o mt76x02_usb_core.o + + mt76-connac-lib-y := mt76_connac_mcu.o mt76_connac_mac.o + +-obj-$(CONFIG_MT76x0_COMMON) += mt76x0/ +-obj-$(CONFIG_MT76x2_COMMON) += mt76x2/ +-obj-$(CONFIG_MT7603E) += mt7603/ +-obj-$(CONFIG_MT7615_COMMON) += mt7615/ +-obj-$(CONFIG_MT7915E) += mt7915/ + obj-$(CONFIG_MT7921E) += mt7921/ diff --git a/SOURCES/9001-add-driver-version.patch b/SOURCES/9001-add-driver-version.patch new file mode 100644 index 0000000..8d49235 --- /dev/null +++ b/SOURCES/9001-add-driver-version.patch @@ -0,0 +1,27 @@ +Index: src/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +=================================================================== +--- src.orig/drivers/net/wireless/mediatek/mt76/mt7921/pci.c 2022-01-30 05:39:36.484691909 +0100 ++++ src/drivers/net/wireless/mediatek/mt76/mt7921/pci.c 2022-01-30 05:42:27.098085136 +0100 +@@ -320,3 +320,4 @@ + MODULE_AUTHOR("Sean Wang "); + MODULE_AUTHOR("Lorenzo Bianconi "); + MODULE_LICENSE("Dual BSD/GPL"); ++MODULE_VERSION("4.18.0_363_dup8.5"); +Index: src/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +=================================================================== +--- src.orig/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c 2022-01-30 05:39:36.484691909 +0100 ++++ src/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c 2022-01-30 05:42:27.100085118 +0100 +@@ -2050,3 +2050,4 @@ + + MODULE_AUTHOR("Lorenzo Bianconi "); + MODULE_LICENSE("Dual BSD/GPL"); ++MODULE_VERSION("4.18.0_363_dup8.5"); +Index: src/drivers/net/wireless/mediatek/mt76/util.c +=================================================================== +--- src.orig/drivers/net/wireless/mediatek/mt76/util.c 2022-01-30 05:38:51.384116649 +0100 ++++ src/drivers/net/wireless/mediatek/mt76/util.c 2022-01-30 05:43:41.935380347 +0100 +@@ -139,3 +139,4 @@ + EXPORT_SYMBOL_GPL(__mt76_worker_fn); + + MODULE_LICENSE("Dual BSD/GPL"); ++MODULE_VERSION("4.18.0_363_dup8.5"); diff --git a/SOURCES/9002-change-firmware-path.patch b/SOURCES/9002-change-firmware-path.patch new file mode 100644 index 0000000..181968a --- /dev/null +++ b/SOURCES/9002-change-firmware-path.patch @@ -0,0 +1,15 @@ +Index: src/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +=================================================================== +--- src.orig/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h 2022-01-26 22:13:12.922460591 +0100 ++++ src/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h 2022-01-26 22:28:36.722090977 +0100 +@@ -30,8 +30,8 @@ + + #define MT7921_DRV_OWN_RETRY_COUNT 10 + +-#define MT7921_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7961_1.bin" +-#define MT7921_ROM_PATCH "mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin" ++#define MT7921_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7961_1_dup8.5.bin" ++#define MT7921_ROM_PATCH "mediatek/WIFI_MT7961_patch_mcu_1_2_hdr_dup8.5.bin" + + #define MT7921_EEPROM_SIZE 3584 + #define MT7921_TOKEN_SIZE 8192 diff --git a/SPECS/kmod-redhat-mt7921.spec b/SPECS/kmod-redhat-mt7921.spec new file mode 100644 index 0000000..b356a1e --- /dev/null +++ b/SPECS/kmod-redhat-mt7921.spec @@ -0,0 +1,340 @@ +%define kmod_name mt7921 +%define kmod_vendor redhat +%define kmod_rpm_name kmod-redhat-mt7921 +%define kmod_driver_version 4.18.0_363_dup8.5 +%define kmod_driver_epoch %{nil} +%define kmod_rpm_release 2 +%define kmod_kernel_version 4.18.0-348.el8 +%define kmod_kernel_version_min %{nil} +%define kmod_kernel_version_dep %{nil} +%define kmod_kbuild_dir drivers/net/wireless/mediatek/mt76 +%define kmod_dependencies %{nil} +%define kmod_dist_build_deps %{nil} +%define kmod_build_dependencies %{nil} +%define kmod_provides %{nil} +%define kmod_devel_package 1 +%define kmod_devel_src_paths %{nil} +%define kmod_install_path extra/kmod-redhat-mt7921 +%define kmod_files_package 0 +%define kmod_files_noarch 1 +%define kernel_pkg kernel +%define kernel_devel_pkg kernel-devel +%define kernel_modules_pkg kernel-modules + +%{!?dist: %define dist .el8_5} +%{!?make_build: %define make_build make} + +%if "%{kmod_kernel_version_dep}" == "" +%define kmod_kernel_version_dep %{kmod_kernel_version} +%endif + +%if "%{kmod_dist_build_deps}" == "" +%if (0%{?rhel} > 7) || (0%{?centos} > 7) +%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists elfutils-libelf-devel kernel-rpm-macros kmod +%else +%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists +%endif +%endif + +Source0: %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}.tar.bz2 +# Source code patches +Patch0: 0001-mt76-connac-do-not-schedule-mac_work-if-the-device-i.patch +Patch1: 0002-mt76-mt7921-continue-to-probe-driver-when-fw-already.patch +Patch2: 9000-force-enable-mt7921.patch +Patch3: 9001-add-driver-version.patch +Patch4: 9002-change-firmware-path.patch + +%define findpat %( echo "%""P" ) +%define __find_requires /usr/lib/rpm/redhat/find-requires.ksyms +%define __find_provides /usr/lib/rpm/redhat/find-provides.ksyms %{kmod_name} %{?epoch:%{epoch}:}%{version}-%{release} +%define sbindir %( if [ -d "/sbin" -a \! -h "/sbin" ]; then echo "/sbin"; else echo %{_sbindir}; fi ) +%define dup_state_dir %{_localstatedir}/lib/rpm-state/kmod-dups +%define kver_state_dir %{dup_state_dir}/kver +%define kver_state_file %{kver_state_dir}/%{kmod_kernel_version}.%(arch) +%define dup_module_list %{dup_state_dir}/rpm-kmod-%{kmod_name}-modules + +Name: kmod-redhat-mt7921 +Version: %{kmod_driver_version} +Release: %{kmod_rpm_release}%{?dist} +%if "%{kmod_driver_epoch}" != "" +Epoch: %{kmod_driver_epoch} +%endif +Summary: mt7921 kernel module for Driver Update Program +Group: System/Kernel +License: GPLv2 +URL: https://www.kernel.org/ +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +BuildRequires: %kernel_devel_pkg = %kmod_kernel_version +%if "%{kmod_dist_build_deps}" != "" +BuildRequires: %{kmod_dist_build_deps} +%endif +ExclusiveArch: x86_64 +%global kernel_source() /usr/src/kernels/%{kmod_kernel_version}.$(arch) + +%global _use_internal_dependency_generator 0 +%if "%{?kmod_kernel_version_min}" != "" +Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu} +%else +Provides: %kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu} +%endif +Provides: kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires(post): %{sbindir}/weak-modules +Requires(postun): %{sbindir}/weak-modules +Requires: kernel >= 4.18.0-348.el8 + +Requires: kernel < 4.18.0-349.el8 +%if 1 +Requires: firmware(%{kmod_name}) = 20211119_105.gitf5d51956_dup8.5 +%endif +%if "%{kmod_build_dependencies}" != "" +BuildRequires: %{kmod_build_dependencies} +%endif +%if "%{kmod_dependencies}" != "" +Requires: %{kmod_dependencies} +%endif +%if "%{kmod_provides}" != "" +Provides: %{kmod_provides} +%endif +# if there are multiple kmods for the same driver from different vendors, +# they should conflict with each other. +Conflicts: kmod-%{kmod_name} + +%description +mt7921 kernel module for Driver Update Program + +%if 1 + +%package -n kmod-redhat-mt7921-firmware +Version: 20211119_105.gitf5d51956_dup8.5 +Summary: mt7921 firmware for Driver Update Program +Provides: firmware(%{kmod_name}) = 20211119_105.gitf5d51956_dup8.5 +%if "%{kmod_kernel_version_min}" != "" +Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu} +%else +Provides: %kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu} +%endif +%description -n kmod-redhat-mt7921-firmware +mt7921 firmware for Driver Update Program + + +%files -n kmod-redhat-mt7921-firmware +%defattr(644,root,root,755) +/lib/firmware/mediatek/WIFI_MT7961_patch_mcu_1_2_hdr_dup8.5.bin +/lib/firmware/mediatek/WIFI_RAM_CODE_MT7961_1_dup8.5.bin + + +%endif + +# Development package +%if 0%{kmod_devel_package} +%package -n kmod-redhat-mt7921-devel +Version: %{kmod_driver_version} +Requires: kernel >= 4.18.0-348.el8 + +Requires: kernel < 4.18.0-349.el8 +Summary: mt7921 development files for Driver Update Program + +%description -n kmod-redhat-mt7921-devel +mt7921 development files for Driver Update Program + + +%files -n kmod-redhat-mt7921-devel +%defattr(644,root,root,755) +/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/ +%endif + +# Extra files package +%if 0%{kmod_files_package} +%package -n kmod-redhat-mt7921-files +Version: %{kmod_driver_version} +Summary: mt7921 additional files for Driver Update Program +%if 0%{kmod_files_noarch} +BuildArch: noarch +%endif +%if "%{?kmod_kernel_version_min}" != "" +Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu} +%else +Provides: %kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu} +%endif + +%description -n kmod-redhat-mt7921-files +mt7921 additional files for Driver Update Program + + +%files -n kmod-redhat-mt7921-files +%defattr(644,root,root,755) +/etc/dracut.conf.d/kmod-redhat-mt7921_dup85.conf +%endif + +%post +modules=( $(find /lib/modules/%{kmod_kernel_version}.%(arch)/%{kmod_install_path} | grep '\.ko$') ) +printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --add-modules --no-initramfs + +mkdir -p "%{kver_state_dir}" +touch "%{kver_state_file}" + +exit 0 + +%posttrans +# We have to re-implement part of weak-modules here because it doesn't allow +# calling initramfs regeneration separately +if [ -f "%{kver_state_file}" ]; then + kver_base="%{kmod_kernel_version_dep}" + kvers=$(ls -d "/lib/modules/${kver_base%%.*}"*) + + for k_dir in $kvers; do + k="${k_dir#/lib/modules/}" + + tmp_initramfs="/boot/initramfs-$k.tmp" + dst_initramfs="/boot/initramfs-$k.img" + + # The same check as in weak-modules: we assume that the kernel present + # if the symvers file exists. + if [ -e "/boot/symvers-$k.gz" ] || [ -e "$k_dir/symvers.gz" ]; then + /usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1 + cmp -s "$tmp_initramfs" "$dst_initramfs" + if [ "$?" = 1 ]; then + mv "$tmp_initramfs" "$dst_initramfs" + else + rm -f "$tmp_initramfs" + fi + fi + done + + rm -f "%{kver_state_file}" + rmdir "%{kver_state_dir}" 2> /dev/null +fi + +rmdir "%{dup_state_dir}" 2> /dev/null + +exit 0 + +%preun +if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then + mkdir -p "%{kver_state_dir}" + touch "%{kver_state_file}" +fi + +mkdir -p "%{dup_state_dir}" +rpm -ql kmod-redhat-mt7921-%{kmod_driver_version}-%{kmod_rpm_release}%{?dist}.$(arch) | \ + grep '\.ko$' > "%{dup_module_list}" + +%postun +if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then + initramfs_opt="--no-initramfs" +else + initramfs_opt="" +fi + +modules=( $(cat "%{dup_module_list}") ) +rm -f "%{dup_module_list}" +printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --remove-modules $initramfs_opt + +rmdir "%{dup_state_dir}" 2> /dev/null + +exit 0 + +%files +%defattr(644,root,root,755) +/lib/modules/%{kmod_kernel_version}.%(arch) +/etc/depmod.d/%{kmod_name}.conf +%doc /usr/share/doc/%{kmod_rpm_name}/greylist.txt +%if !0%{kmod_files_package} +/etc/dracut.conf.d/kmod-redhat-mt7921_dup85.conf +%endif + +%prep +%setup -n %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version} + +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +set -- * +mkdir source +mv "$@" source/ +mkdir obj + +%build +rm -rf obj +cp -r source obj + +PWD_PATH="$PWD" +%if "%{workaround_no_pwd_rel_path}" != "1" +PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD") +%endif +%{make_build} -C %{kernel_source} V=1 M="$PWD_PATH/obj/%{kmod_kbuild_dir}" \ + NOSTDINC_FLAGS="-I$PWD_PATH/obj/include -I$PWD_PATH/obj/include/uapi %{nil}" \ + EXTRA_CFLAGS="%{nil}" \ + %{nil} +# mark modules executable so that strip-to-file can strip them +find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' + + +whitelist="/lib/modules/kabi-current/kabi_whitelist_%{_target_cpu}" +for modules in $( find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do + # update depmod.conf + module_weak_path=$(echo "$modules" | sed 's/[\/]*[^\/]*$//') + if [ -z "$module_weak_path" ]; then + module_weak_path=%{name} + else + module_weak_path=%{name}/$module_weak_path + fi + echo "override $(echo $modules | sed 's/.*\///')" \ + "$(echo "%{kmod_kernel_version_dep}" | + sed 's/\.[^\.]*$//; + s/\([.+?^$\/\\|()\[]\|\]\)/\\\0/g').*" \ + "weak-updates/$module_weak_path" >> source/depmod.conf + + # update greylist + nm -u obj/%{kmod_kbuild_dir}/$modules.ko | sed 's/.*U //' | sed 's/^\.//' | sort -u | while read -r symbol; do + grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> source/greylist + done +done +sort -u source/greylist | uniq > source/greylist.txt + +%install +export INSTALL_MOD_PATH=$RPM_BUILD_ROOT +export INSTALL_MOD_DIR=%{kmod_install_path} +PWD_PATH="$PWD" +%if "%{workaround_no_pwd_rel_path}" != "1" +PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD") +%endif +make -C %{kernel_source} modules_install \ + M=$PWD_PATH/obj/%{kmod_kbuild_dir} +# Cleanup unnecessary kernel-generated module dependency files. +find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \; + +install -m 644 -D source/depmod.conf $RPM_BUILD_ROOT/etc/depmod.d/%{kmod_name}.conf +install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/%{kmod_rpm_name}/greylist.txt +%if 1 +install -m 644 -D source/firmware/mediatek/WIFI_MT7961_patch_mcu_1_2_hdr_dup8.5.bin $RPM_BUILD_ROOT/lib/firmware/mediatek/WIFI_MT7961_patch_mcu_1_2_hdr_dup8.5.bin +install -m 644 -D source/firmware/mediatek/WIFI_RAM_CODE_MT7961_1_dup8.5.bin $RPM_BUILD_ROOT/lib/firmware/mediatek/WIFI_RAM_CODE_MT7961_1_dup8.5.bin + +%endif +%if 0%{kmod_devel_package} +install -m 644 -D $PWD/obj/%{kmod_kbuild_dir}/Module.symvers $RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/Module.symvers + +if [ -n "%{kmod_devel_src_paths}" ]; then + for i in %{kmod_devel_src_paths}; do + mkdir -p "$RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/$(dirname "$i")" + cp -rv "$PWD/source/$i" \ + "$RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/$i" + done +fi +%endif +install -m 664 -D source/extra//etc/dracut.conf.d/kmod-redhat-mt7921_dup85.conf $RPM_BUILD_ROOT//etc/dracut.conf.d/kmod-redhat-mt7921_dup85.conf + + +%clean +rm -rf $RPM_BUILD_ROOT + +%changelog +* Wed Feb 09 2022 Eugene Syromiatnikov 4.18.0_363_dup8.5-2 +- Bump release due to "Package build kmod-redhat-mt7921-4.18.0_363_dup8.5-1.el8_5 + kept gated because not onboarded to gating". + +* Wed Feb 09 2022 Eugene Syromiatnikov 4.18.0_363_dup8.5-1 +- 9dc660bf1362f5a22a908e61004498cf7ec063a8 +- mt7921 kernel module for Driver Update Program +- Resolves: #bz2051885