From b888ba0d3a67a6c4732faf2e07578663a213bd0c Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Sun, 20 Dec 2020 23:53:59 +0800 Subject: [PATCH] Revert "mtwifi: enable autoload by default" This reverts commit 546e593192a182e9e295608887d60a58627ccab7 due to the combination of mt603 and mt7615 will cause some modules to fail to load normally. --- package/lean/mt-drivers/mt7603e/Makefile | 1 - package/lean/mt-drivers/mt7612e/Makefile | 1 - package/lean/mt-drivers/mt7615d/Makefile | 2 -- package/lean/mt-drivers/mt_wifi/Makefile | 2 ++ package/lean/mt-drivers/mt_wifi/files/91_load_wifi.sh | 10 ++++++++++ 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 package/lean/mt-drivers/mt_wifi/files/91_load_wifi.sh diff --git a/package/lean/mt-drivers/mt7603e/Makefile b/package/lean/mt-drivers/mt7603e/Makefile index 17c0e3da09..e3cdd58272 100644 --- a/package/lean/mt-drivers/mt7603e/Makefile +++ b/package/lean/mt-drivers/mt7603e/Makefile @@ -39,7 +39,6 @@ define KernelPackage/mt7603e DEPENDS:=@TARGET_ramips FILES:=$(PKG_BUILD_DIR)/mt7603_wifi_ap/mt7603e.ko SUBMENU:=Wireless Drivers - AUTOLOAD:=$(call AutoLoad,91,mt7603e) MENU:=1 endef diff --git a/package/lean/mt-drivers/mt7612e/Makefile b/package/lean/mt-drivers/mt7612e/Makefile index 843cf19930..546ae28db1 100644 --- a/package/lean/mt-drivers/mt7612e/Makefile +++ b/package/lean/mt-drivers/mt7612e/Makefile @@ -27,7 +27,6 @@ define KernelPackage/mt76x2e DEPENDS:=@TARGET_ramips FILES:=$(PKG_BUILD_DIR)/mt76x2_ap/mt76x2_ap.ko SUBMENU:=Wireless Drivers - AUTOLOAD:=$(call AutoLoad,90,mt76x2_ap) MENU:=1 endef diff --git a/package/lean/mt-drivers/mt7615d/Makefile b/package/lean/mt-drivers/mt7615d/Makefile index a1af373014..931932d06d 100644 --- a/package/lean/mt-drivers/mt7615d/Makefile +++ b/package/lean/mt-drivers/mt7615d/Makefile @@ -184,10 +184,8 @@ define KernelPackage/mt7615d ifneq ($(CONFIG_MTK_WHNAT_SUPPORT), ) FILES:=$(PKG_BUILD_DIR)/mt_wifi_ap/mt_wifi.ko \ $(PKG_BUILD_DIR)/mt_wifi/embedded/tools/plug_in/whnat/mt_whnat.ko - AUTOLOAD:=$(call AutoProbe,mt_wifi mt_whnat) else FILES:=$(PKG_BUILD_DIR)/mt_wifi_ap/mt_wifi.ko - AUTOLOAD:=$(call AutoLoad,90,mt_wifi) endif SUBMENU:=Wireless Drivers MENU:=1 diff --git a/package/lean/mt-drivers/mt_wifi/Makefile b/package/lean/mt-drivers/mt_wifi/Makefile index d22a359eae..060a03a676 100644 --- a/package/lean/mt-drivers/mt_wifi/Makefile +++ b/package/lean/mt-drivers/mt_wifi/Makefile @@ -41,6 +41,7 @@ define Package/mt_wifi/install $(INSTALL_DIR) $(1)/lib/wifi/ $(INSTALL_DIR) $(1)/etc/wireless/mt7615/ $(INSTALL_DIR) $(1)/etc_ro/Wireless/RT2860AP/ + $(INSTALL_DIR) $(1)/lib/preinit/ ifeq ($(CONFIG_MTK_CHIP_MT7603E_MT7612E),y) $(INSTALL_BIN) ./files/7603_7612-l1profile.dat $(1)/etc/wireless/l1profile.dat $(INSTALL_BIN) ./files/mt7603.dat $(1)/etc/wireless/mt7615/mt7615.1.dat @@ -64,6 +65,7 @@ endif $(INSTALL_BIN) ./files/SingleSKU_BF.dat $(1)/etc_ro/Wireless/RT2860AP/ $(INSTALL_BIN) ./files/mt7615.lua $(1)/lib/wifi $(INSTALL_BIN) ./files/firmware.sh $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/91_load_wifi.sh $(1)/lib/preinit/ endef $(eval $(call BuildPackage,mt_wifi)) diff --git a/package/lean/mt-drivers/mt_wifi/files/91_load_wifi.sh b/package/lean/mt-drivers/mt_wifi/files/91_load_wifi.sh new file mode 100644 index 0000000000..ddbc7e7832 --- /dev/null +++ b/package/lean/mt-drivers/mt_wifi/files/91_load_wifi.sh @@ -0,0 +1,10 @@ +. /lib/functions.sh + +load_wifi() { + local kernel_version=$(uname -r) + [ -e "/lib/modules/$kernel_version/mt7603e.ko" ] && modprobe mt7603e + [ -e "/lib/modules/$kernel_version/mt76x2_ap.ko" ] && modprobe mt76x2_ap + [ -e "/lib/modules/$kernel_version/mt_wifi.ko" ] && modprobe mt_wifi +} + +boot_hook_add preinit_main load_wifi