From 413d8692d02ca323b4f538d76a6fc89ccfd0cd90 Mon Sep 17 00:00:00 2001 From: CN_SZTL <22235437+1715173329@users.noreply.github.com> Date: Wed, 5 Aug 2020 19:39:06 +0800 Subject: [PATCH 1/2] linux: improve exFAT support (#5249) * staging: remove staging exfat driver This will be replaced with the driver found in newer kernels. Signed-off-by: Rosen Penev * exfat: add out of tree module >From an email conversation with the person responsible for upstreaming the exFAT driver, it seems the staging one in kernel 5.4 is not so good. Excerpts below. Namjae Jeon: Hm... exfat in 5.4 kernel that we did crap shit long time ago is contributed by someone who we don't know. This version is unstable and low quality code. We have been improving it continuously. and staging version exfat is removed from linux 5.7 kernel. linux exfat oot version is a backport of exfat in linux 5.7 kernel to support lower version kernel, and it is a real. You can see the patch history fro linux-exfat-oot. this version support timezone and boot sector verification feature newly. and better filesystem structure and much clean code quality that reviewed by high profile kernel developers. and add many bug fixes. And this version is officially maintained by me and kernel guys. I would not recommend to use staging exfat version. Signed-off-by: Rosen Penev * automount: switch exFAT driver to high performance ver Co-authored-by: Rosen Penev --- package/kernel/exfat/Makefile | 55 +++++++++++++++++++ .../kernel/exfat/patches/010-fstream.patch | 23 ++++++++ package/kernel/linux/modules/fs.mk | 24 -------- package/lean/automount/Makefile | 2 +- 4 files changed, 79 insertions(+), 25 deletions(-) create mode 100644 package/kernel/exfat/Makefile create mode 100644 package/kernel/exfat/patches/010-fstream.patch diff --git a/package/kernel/exfat/Makefile b/package/kernel/exfat/Makefile new file mode 100644 index 00000000000000..f129da9410166a --- /dev/null +++ b/package/kernel/exfat/Makefile @@ -0,0 +1,55 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=exfat +PKG_VERSION:=5.8.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/namjaejeon/linux-exfat-oot/tar.gz/$(PKG_VERSION)? +PKG_HASH:=47162495bdf9a7e02d6142dfcd4364d7325a4cf75a0439926cf9e8a9d959627b + +PKG_MAINTAINER:= +PKG_LICENSE:=GPL-2.0-only + +#PKG_BUILD_PARALLEL:=1 +#PKG_USE_MIPS16:=0 + +# exfat-oot's makefile needs this to know where to build the kernel module +#export KERNELDIR:=$(LINUX_DIR) + +include $(INCLUDE_DIR)/package.mk +#include $(INCLUDE_DIR)/kernel-defaults.mk + +TAR_OPTIONS+= --strip-components 1 +TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) + +define KernelPackage/fs-exfat + SECTION:=kernel + CATEGORY:=Kernel modules + SUBMENU:=Filesystems + TITLE:=exFAT kernel module + FILES:=$(PKG_BUILD_DIR)/exfat.ko + AUTOLOAD:=$(call AutoProbe,exfat) + DEPENDS:=+kmod-nls-base +endef + +define KernelPackage/exfat/description + This package provides the kernel module for exfat. +endef + +define Build/Compile + $(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ + $(PKG_EXTRA_KCONFIG) \ + CONFIG_EXFAT_FS=m \ + modules +# $(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) M="$(PKG_BUILD_DIR)" modules +endef + +$(eval $(call KernelPackage,fs-exfat)) diff --git a/package/kernel/exfat/patches/010-fstream.patch b/package/kernel/exfat/patches/010-fstream.patch new file mode 100644 index 00000000000000..dc1221c61175cd --- /dev/null +++ b/package/kernel/exfat/patches/010-fstream.patch @@ -0,0 +1,23 @@ +--- a/super.c ++++ b/super.c +@@ -292,14 +292,14 @@ static const struct fs_parameter_spec exfat_param_specs[] = { + #endif + fsparam_flag("discard", Opt_discard), + fsparam_s32("time_offset", Opt_time_offset), +- __fsparam(NULL, "utf8", Opt_utf8, fs_param_deprecated, +- NULL), +- __fsparam(NULL, "debug", Opt_debug, fs_param_deprecated, +- NULL), ++ __fsparam(NULL, "utf8", Opt_utf8, fs_param_deprecated ++ ), ++ __fsparam(NULL, "debug", Opt_debug, fs_param_deprecated ++ ), + __fsparam(fs_param_is_u32, "namecase", Opt_namecase, +- fs_param_deprecated, NULL), ++ fs_param_deprecated), + __fsparam(fs_param_is_u32, "codepage", Opt_codepage, +- fs_param_deprecated, NULL), ++ fs_param_deprecated), + {} + }; + diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index 82f868511117eb..84dc498365dbef 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -163,30 +163,6 @@ endef $(eval $(call KernelPackage,fs-efivarfs)) -define KernelPackage/fs-exfat - SUBMENU:=$(FS_MENU) - TITLE:=exFAT filesystem support - KCONFIG:= \ - CONFIG_EXFAT_FS \ - CONFIG_EXFAT_DONT_MOUNT_VFAT=y \ - CONFIG_EXFAT_DISCARD=y \ - CONFIG_EXFAT_DELAYED_SYNC=n \ - CONFIG_EXFAT_KERNEL_DEBUG=n \ - CONFIG_EXFAT_DEBUG_MSG=n \ - CONFIG_EXFAT_DEFAULT_CODEPAGE=437 \ - CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8" - FILES:=$(LINUX_DIR)/drivers/staging/exfat/exfat.ko - AUTOLOAD:=$(call AutoLoad,30,exfat,1) - DEPENDS:=@!(LINUX_4_14||LINUX_4_19) +kmod-nls-base -endef - -define KernelPackage/fs-exfat/description - Kernel module for exFAT filesystem support -endef - -$(eval $(call KernelPackage,fs-exfat)) - - define KernelPackage/fs-exportfs SUBMENU:=$(FS_MENU) TITLE:=exportfs kernel server support diff --git a/package/lean/automount/Makefile b/package/lean/automount/Makefile index 4e44a40913bb45..1dd9f7d76d6ba5 100644 --- a/package/lean/automount/Makefile +++ b/package/lean/automount/Makefile @@ -17,7 +17,7 @@ include $(INCLUDE_DIR)/package.mk define Package/automount TITLE:=Mount autoconfig hotplug script. MAINTAINER:=Lean - DEPENDS:=+block-mount +kmod-usb-storage +kmod-usb-storage-extras +!TARGET_ramips:kmod-usb-storage-uas +kmod-fs-vfat +kmod-fs-ext4 +!LINUX_5_4:kmod-fs-exfat0 +LINUX_5_4:kmod-fs-exfat +antfs-mount + DEPENDS:=+block-mount +kmod-usb-storage +kmod-usb-storage-extras +!TARGET_ramips:kmod-usb-storage-uas +kmod-fs-vfat +kmod-fs-ext4 +kmod-fs-exfat +antfs-mount endef define Package/automount/description From 85808a075cb71726f5956261b44258836bbdd4de Mon Sep 17 00:00:00 2001 From: DoveKi <2290218900@qq.com> Date: Wed, 5 Aug 2020 19:40:13 +0800 Subject: [PATCH 2/2] ramips: use mt proprietary driver for XiaoMI MI R4 (#5244) --- .../linux/ramips/dts/mt7621_xiaomi_mir4.dts | 28 ++++++------------- target/linux/ramips/image/mt7621.mk | 2 +- .../mt7621/base-files/etc/board.d/02_network | 9 ++++-- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mir4.dts b/target/linux/ramips/dts/mt7621_xiaomi_mir4.dts index 721497d32d4359..08bd719bc7cd40 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mir4.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mir4.dts @@ -14,7 +14,7 @@ led-failsafe = &led_status_red; led-running = &led_status_blue; led-upgrade = &led_status_yellow; - label-mac-device = &gmac0; + label-mac-device = ðernet; }; chosen { @@ -161,30 +161,20 @@ }; }; -&gmac0 { +ðernet { + compatible = "mediatek,ralink-mt7621-eth"; + mediatek,switch = <&gsw>; mtd-mac-address = <&factory 0xe006>; }; &switch0 { - ports { - port@1 { - status = "okay"; - label = "lan1"; - }; - - port@2 { - status = "okay"; - label = "lan2"; - }; - - port@4 { - status = "okay"; - label = "wan"; - mtd-mac-address = <&factory 0xe000>; - }; - }; + /delete-property/ compatible; + phy-mode = "rgmii"; }; +&gsw { + compatible = "mediatek,ralink-mt7621-gsw"; +}; &state_default { gpio { diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 9435f652e6544e..3af2c4d48d60fe 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1037,7 +1037,7 @@ define Device/xiaomi_mir4 DEVICE_MODEL := Mi Router 4 SUPPORTED_DEVICES += R4 SUPPORTED_DEVICES += mir4 - DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 wpad-openssl uboot-envtools + DEVICE_PACKAGES := kmod-mt7603e kmod-mt76x2e luci-app-mtwifi uboot-envtools endef TARGET_DEVICES += xiaomi_mir4 diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 6f149146e17c9b..f0db051ca4aba7 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -15,8 +15,7 @@ ramips_setup_interfaces() asiarf,ap7621-nv1|\ lenovo,newifi-d1|\ mikrotik,routerboard-m33g|\ - xiaomi,mir3g-v2|\ - xiaomi,mir4) + xiaomi,mir3g-v2) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; d-team,newifi-d2) @@ -75,6 +74,11 @@ ramips_setup_interfaces() "2:lan:2" "3:lan:1" "1:wan" "6t@eth0" ucidef_set_interface_lan "eth0.1 ra0 rai0" ;; + xiaomi,mir4) + ucidef_add_switch "switch0" \ + "1:lan:1" "2:lan:2" "4:wan" "6t@eth0" + ucidef_set_interface_lan "eth0.1 ra0 rai0" + ;; xiaomi,mi-router-ac2100|\ xiaomi,redmi-router-ac2100) ucidef_add_switch "switch0" \ @@ -148,6 +152,7 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_binary factory 0xe006) ;; xiaomi,mir3g|\ + xiaomi,mir4|\ xiaomi,mi-router-ac2100|\ xiaomi,redmi-router-ac2100) lan_mac=$(cat /sys/class/net/eth0/address)