From 2db7fe792e52bc9ebec0e8f1ff771934c6112197 Mon Sep 17 00:00:00 2001 From: Ilya Lipnitskiy Date: Mon, 15 Mar 2021 22:29:55 -0700 Subject: [PATCH 01/15] kernel: backports: mt7530: fix TRGMII mode after reset Backport upstream patch that fixes TRGMII mode now that mt7530 is actually resetting the switch on ramips devices. Patches apply to both Linux 5.4 and 5.10, since TRGMII is broken on both. Fixes: 69551a244292 ("ramips: manage low reset lines") Signed-off-by: Ilya Lipnitskiy (cherry picked from commit 680f91d0e5444d58815af03bf41c12592438f9d8) --- ...setup-core-clock-even-in-TRGMII-mode.patch | 84 +++++++++++++++++++ ...-net-dsa-mt7530-Support-EEE-features.patch | 6 +- 2 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 target/linux/generic/backport-5.4/780-net-dsa-mt7530-setup-core-clock-even-in-TRGMII-mode.patch diff --git a/target/linux/generic/backport-5.4/780-net-dsa-mt7530-setup-core-clock-even-in-TRGMII-mode.patch b/target/linux/generic/backport-5.4/780-net-dsa-mt7530-setup-core-clock-even-in-TRGMII-mode.patch new file mode 100644 index 0000000000..d48d797294 --- /dev/null +++ b/target/linux/generic/backport-5.4/780-net-dsa-mt7530-setup-core-clock-even-in-TRGMII-mode.patch @@ -0,0 +1,84 @@ +From c3b8e07909dbe67b0d580416c1a5257643a73be7 Mon Sep 17 00:00:00 2001 +From: Ilya Lipnitskiy +Date: Fri, 12 Mar 2021 00:07:03 -0800 +Subject: [PATCH] net: dsa: mt7530: setup core clock even in TRGMII mode + +A recent change to MIPS ralink reset logic made it so mt7530 actually +resets the switch on platforms such as mt7621 (where bit 2 is the reset +line for the switch). That exposed an issue where the switch would not +function properly in TRGMII mode after a reset. + +Reconfigure core clock in TRGMII mode to fix the issue. + +Tested on Ubiquiti ER-X (MT7621) with TRGMII mode enabled. + +Fixes: 3f9ef7785a9c ("MIPS: ralink: manage low reset lines") +Signed-off-by: Ilya Lipnitskiy +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 52 +++++++++++++++++++--------------------- + 1 file changed, 25 insertions(+), 27 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -427,34 +427,32 @@ mt7530_pad_clk_setup(struct dsa_switch * + TD_DM_DRVP(8) | TD_DM_DRVN(8)); + + /* Setup core clock for MT7530 */ +- if (!trgint) { +- /* Disable MT7530 core clock */ +- core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); +- +- /* Disable PLL, since phy_device has not yet been created +- * provided for phy_[read,write]_mmd_indirect is called, we +- * provide our own core_write_mmd_indirect to complete this +- * function. +- */ +- core_write_mmd_indirect(priv, +- CORE_GSWPLL_GRP1, +- MDIO_MMD_VEND2, +- 0); +- +- /* Set core clock into 500Mhz */ +- core_write(priv, CORE_GSWPLL_GRP2, +- RG_GSWPLL_POSDIV_500M(1) | +- RG_GSWPLL_FBKDIV_500M(25)); +- +- /* Enable PLL */ +- core_write(priv, CORE_GSWPLL_GRP1, +- RG_GSWPLL_EN_PRE | +- RG_GSWPLL_POSDIV_200M(2) | +- RG_GSWPLL_FBKDIV_200M(32)); +- +- /* Enable MT7530 core clock */ +- core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); +- } ++ /* Disable MT7530 core clock */ ++ core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); ++ ++ /* Disable PLL, since phy_device has not yet been created ++ * provided for phy_[read,write]_mmd_indirect is called, we ++ * provide our own core_write_mmd_indirect to complete this ++ * function. ++ */ ++ core_write_mmd_indirect(priv, ++ CORE_GSWPLL_GRP1, ++ MDIO_MMD_VEND2, ++ 0); ++ ++ /* Set core clock into 500Mhz */ ++ core_write(priv, CORE_GSWPLL_GRP2, ++ RG_GSWPLL_POSDIV_500M(1) | ++ RG_GSWPLL_FBKDIV_500M(25)); ++ ++ /* Enable PLL */ ++ core_write(priv, CORE_GSWPLL_GRP1, ++ RG_GSWPLL_EN_PRE | ++ RG_GSWPLL_POSDIV_200M(2) | ++ RG_GSWPLL_FBKDIV_200M(32)); ++ ++ /* Enable MT7530 core clock */ ++ core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); + + /* Setup the MT7530 TRGMII Tx Clock */ + core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); diff --git a/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch b/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch index 1822647ff1..b9ca691f6f 100644 --- a/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch +++ b/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch @@ -9,7 +9,7 @@ Content-Transfer-Encoding: 8bit Signed-off-by: René van Dorst --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -1419,9 +1419,13 @@ static void mt7530_phylink_mac_config(st +@@ -1417,9 +1417,13 @@ static void mt7530_phylink_mac_config(st switch (state->speed) { case SPEED_1000: mcr_new |= PMCR_FORCE_SPEED_1000; @@ -23,7 +23,7 @@ Signed-off-by: René van Dorst break; } if (state->duplex == DUPLEX_FULL) { -@@ -1557,6 +1561,54 @@ mt7530_phylink_mac_link_state(struct dsa +@@ -1555,6 +1559,54 @@ mt7530_phylink_mac_link_state(struct dsa return 1; } @@ -78,7 +78,7 @@ Signed-off-by: René van Dorst static const struct dsa_switch_ops mt7530_switch_ops = { .get_tag_protocol = mtk_get_tag_protocol, .setup = mt7530_setup, -@@ -1584,6 +1636,8 @@ static const struct dsa_switch_ops mt753 +@@ -1582,6 +1634,8 @@ static const struct dsa_switch_ops mt753 .phylink_mac_config = mt7530_phylink_mac_config, .phylink_mac_link_down = mt7530_phylink_mac_link_down, .phylink_mac_link_up = mt7530_phylink_mac_link_up, From 7939d4a1b13b0c44dbfa4cd03180fe4cd5b2fe6b Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Thu, 25 Mar 2021 22:47:36 -0700 Subject: [PATCH 02/15] firewall3: update to latest git HEAD This includes several improvements and fixes: 61db17e rules: fix device and chain usage for DSCP/MARK targets 7b844f4 zone: avoid duplicates in devices list c2c72c6 firewall3: remove last remaining sprintf() 12f6f14 iptables: fix serializing multiple weekdays 00f27ab firewall3: fix duplicate defaults section detection e8f2d8f ipsets: allow blank/commented lines with loadfile 8c2f9fa fw3: zones: limit zone names to 11 bytes 78d52a2 options: fix parsing of boolean attributes Signed-off-by: Tony Ambardar (cherry picked from commit 0d75aa27d4093625c85f2d2233dd5392a7e2aa32) --- package/network/config/firewall/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index bda9267130..2c0ae5b86a 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git -PKG_SOURCE_DATE:=2020-09-05 -PKG_SOURCE_VERSION:=8c2f9fad9ca644af911e0d4113a890c3c84aa738 -PKG_MIRROR_HASH:=424a7906ed8957de3e85046248608dec7146078946161a517f8a5af9f536bad1 +PKG_SOURCE_DATE:=2021-03-23 +PKG_SOURCE_VERSION:=61db17edddb1f05e8107f0dbef6f7d060ce67483 +PKG_MIRROR_HASH:=b2eb09816640e14e2dae21fb54ea05c33858fe0004844fe8d99e541a2e19e9c0 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 8458ebe18b84702039020c523018e39f564ccf6c Mon Sep 17 00:00:00 2001 From: Tad Davanzo Date: Fri, 5 Feb 2021 22:38:03 -0500 Subject: [PATCH 03/15] mvebu: mamba resize kernel to 4MB mamba has a 3MB kernel partition as specified by the DTS. 3MB is not sufficient for building with many kernel modules or newer kernel versions. mamba uboot however as set from factory will load up to 4MB. This can be observed by looking a uboot log: NAND read: device 0 offset 0xa00000, size 0x400000 4194304 bytes read: OK and from uboot environment variables: $ fw_printenv | grep "pri_kern_size"; pri_kern_size=0x400000 Resize the root partitions from 37MB to 36MB to let kernel expand into it another 1MB. And set kernel target size to 4MB. Lastly add a compatibility version message: kernel-size-migration. And set it on mamba to prevent sysupgrading without first reinstalling from a factory image. Signed-off-by: Tad Davanzo (cherry picked from commit 10415d5e7016b69dc71c5f1b03e8e17b586f8edd) --- .../etc/uci-defaults/05_fix-compat-version | 10 +++++ target/linux/mvebu/image/cortexa9.mk | 10 ++++- ...rmada-xp-linksys-mamba-resize-kernel.patch | 37 +++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version create mode 100644 target/linux/mvebu/patches-5.4/318-armada-xp-linksys-mamba-resize-kernel.patch diff --git a/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version new file mode 100644 index 0000000000..70e0e9ef95 --- /dev/null +++ b/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version @@ -0,0 +1,10 @@ +. /lib/functions.sh + +case "$(board_name)" in + linksys,wrt1900ac-v1) + uci set system.@system[0].compat_version="2.0" + uci commit system + ;; +esac + +exit 0 diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 61f4d17813..780b1a18c8 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -8,6 +8,12 @@ define Device/dsa-migration DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA endef +define Device/kernel-size-migration + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := Partition design has changed compared to older versions (up to 19.07) due to kernel size restrictions. \ + Upgrade via sysupgrade mechanism is not possible, so new installation via factory style image is required. +endef + define Device/buffalo_ls421de $(Device/NAND-128K) DEVICE_VENDOR := Buffalo @@ -108,14 +114,14 @@ TARGET_DEVICES += linksys_wrt1900acs define Device/linksys_wrt1900ac-v1 $(call Device/linksys) - $(Device/dsa-migration) + $(Device/kernel-size-migration) DEVICE_MODEL := WRT1900AC DEVICE_VARIANT := v1 DEVICE_ALT0_VENDOR := Linksys DEVICE_ALT0_MODEL := Mamba DEVICE_DTS := armada-xp-linksys-mamba DEVICE_PACKAGES += mwlwifi-firmware-88w8864 - KERNEL_SIZE := 3072k + KERNEL_SIZE := 4096k SUPPORTED_DEVICES += armada-xp-linksys-mamba linksys,mamba DEFAULT := n endef diff --git a/target/linux/mvebu/patches-5.4/318-armada-xp-linksys-mamba-resize-kernel.patch b/target/linux/mvebu/patches-5.4/318-armada-xp-linksys-mamba-resize-kernel.patch new file mode 100644 index 0000000000..f1fddceff4 --- /dev/null +++ b/target/linux/mvebu/patches-5.4/318-armada-xp-linksys-mamba-resize-kernel.patch @@ -0,0 +1,37 @@ +From 258233f00bcd013050efee00c5d9128ef8cd62dd Mon Sep 17 00:00:00 2001 +From: Tad +Date: Fri, 5 Feb 2021 22:32:11 -0500 +Subject: [PATCH] ARM: dts: armada-xp-linksys-mamba: Increase kernel + partition to 4MB + +Signed-off-by: Tad Davanzo +--- + arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts ++++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts +@@ -456,9 +456,9 @@ + reg = <0xa00000 0x2800000>; /* 40MB */ + }; + +- partition@d00000 { ++ partition@e00000 { + label = "rootfs1"; +- reg = <0xd00000 0x2500000>; /* 37MB */ ++ reg = <0xe00000 0x2400000>; /* 36MB */ + }; + + /* kernel2 overlaps with rootfs2 by design */ +@@ -467,9 +467,9 @@ + reg = <0x3200000 0x2800000>; /* 40MB */ + }; + +- partition@3500000 { ++ partition@3600000 { + label = "rootfs2"; +- reg = <0x3500000 0x2500000>; /* 37MB */ ++ reg = <0x3600000 0x2400000>; /* 36MB */ + }; + + /* From 5a3b1e5b5765208990e45c852c0412f210d63594 Mon Sep 17 00:00:00 2001 From: Tad Davanzo Date: Fri, 5 Feb 2021 22:42:47 -0500 Subject: [PATCH 04/15] mvebu: venom resize kernel to 6MB venom has a 3MB kernel partition as specified by the DTS. 3MB is not sufficient for building with many kernel modules or newer kernel versions. venom uboot however as set from factory will load up to 6MB. This can be observed by looking a uboot log: NAND read: device 0 offset 0x900000, size 0x600000 6291456 bytes read: OK and from uboot environment variables: $ fw_printenv | grep "priKernSize"; priKernSize=0x0600000 Resize the root partitions from 120MB to 117MB to let kernel expand into it another 3MB. And set kernel target size to 6MB. Lastly set the kernel-size-migration compatibility version on venom to prevent sysupgrading without first reinstalling from a factory image. Signed-off-by: Tad Davanzo (cherry picked from commit 15309f5133d55e92bec3ed91dfb3ac9d124f6a96) --- .../base-files/etc/uci-defaults/05_fix-compat-version | 3 ++- .../files/arch/arm/boot/dts/armada-385-linksys-venom.dts | 8 ++++---- target/linux/mvebu/image/cortexa9.mk | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version index 70e0e9ef95..8856bf23a4 100644 --- a/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version +++ b/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version @@ -1,7 +1,8 @@ . /lib/functions.sh case "$(board_name)" in - linksys,wrt1900ac-v1) + linksys,wrt1900ac-v1|\ + linksys,wrt32x) uci set system.@system[0].compat_version="2.0" uci commit system ;; diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-linksys-venom.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-linksys-venom.dts index de81600a80..a2ca3158cf 100644 --- a/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-linksys-venom.dts +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-linksys-venom.dts @@ -157,9 +157,9 @@ reg = <0x900000 0x7b00000>; /* 123MB */ }; - partition@c00000 { + partition@f00000 { label = "rootfs1"; - reg = <0xc00000 0x7800000>; /* 120MB */ + reg = <0xf00000 0x7500000>; /* 117MB */ }; /* kernel2 overlaps with rootfs2 by design */ @@ -168,9 +168,9 @@ reg = <0x8400000 0x7b00000>; /* 123MB */ }; - partition@8700000 { + partition@8a00000 { label = "rootfs2"; - reg = <0x8700000 0x7800000>; /* 120MB */ + reg = <0x8a00000 0x7500000>; /* 117MB */ }; /* last MB is for the BBT, not writable */ diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 780b1a18c8..3937890116 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -154,13 +154,13 @@ TARGET_DEVICES += linksys_wrt3200acm define Device/linksys_wrt32x $(call Device/linksys) - $(Device/dsa-migration) + $(Device/kernel-size-migration) DEVICE_MODEL := WRT32X DEVICE_ALT0_VENDOR := Linksys DEVICE_ALT0_MODEL := Venom DEVICE_DTS := armada-385-linksys-venom DEVICE_PACKAGES += kmod-btmrvl kmod-mwifiex-sdio mwlwifi-firmware-88w8964 - KERNEL_SIZE := 3072k + KERNEL_SIZE := 6144k KERNEL := kernel-bin | append-dtb SUPPORTED_DEVICES += armada-385-linksys-venom linksys,venom DEFAULT := n From 9ce0f2b90c2da573e258acb945822ba73b628d6b Mon Sep 17 00:00:00 2001 From: Tad Davanzo Date: Tue, 9 Feb 2021 17:42:54 -0500 Subject: [PATCH 05/15] mvebu: enable WRT1900AC v1 and WRT32X for buildbots Kernel size limits have been dealt with. Effective revert of a1eb2c46 and ac9730c4. Signed-off-by: Tad Davanzo (cherry picked from commit b4f76d9f0d61779b5e04228d1eb3f2ba412ffd26) --- target/linux/mvebu/image/cortexa9.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 3937890116..c712ad6a33 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -123,7 +123,6 @@ define Device/linksys_wrt1900ac-v1 DEVICE_PACKAGES += mwlwifi-firmware-88w8864 KERNEL_SIZE := 4096k SUPPORTED_DEVICES += armada-xp-linksys-mamba linksys,mamba - DEFAULT := n endef TARGET_DEVICES += linksys_wrt1900ac-v1 @@ -163,7 +162,6 @@ define Device/linksys_wrt32x KERNEL_SIZE := 6144k KERNEL := kernel-bin | append-dtb SUPPORTED_DEVICES += armada-385-linksys-venom linksys,venom - DEFAULT := n endef TARGET_DEVICES += linksys_wrt32x From 7bb8aded105792eaa24319a3c52b1f92d8c93860 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 25 Mar 2021 13:26:15 +0100 Subject: [PATCH 06/15] mvebu: Add button support for GL.iNet GL-MV1000 The original patch to support this device advertised support for the reset button and the "switch" in the commit message. But neither were actually integrated in the device tree or documented anywere. The button itself is now used to trigger a reset (as described in the official GL.iNet documentation). The switch itself is registered as BTN_0 like other devices from GL.iNet in ath79. Fixes: 050c24f05c85 ("mvebu: add support for GL.iNet GL-MV1000") Signed-off-by: Sven Eckelmann (cherry picked from commit 01b911a9381426314762822f97e3a7e658295f50) --- .../boot/dts/marvell/armada-3720-gl-mv1000.dts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts index 0e15debdea..7c85ab4a9d 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts @@ -2,6 +2,7 @@ /dts-v1/; #include +#include #include "armada-372x.dtsi" / { @@ -37,6 +38,22 @@ enable-active-high; }; + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpionb 14 GPIO_ACTIVE_LOW>; + }; + + switch { + label = "switch"; + linux,code = ; + gpios = <&gpiosb 22 GPIO_ACTIVE_LOW>; + }; + }; + leds { compatible = "gpio-leds"; From eb98c88f66d6d419d47ab951c2624ed6b18b4088 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 25 Mar 2021 13:26:15 +0100 Subject: [PATCH 07/15] mvebu: Fix mac addresses for GL.iNet GL-MV1000 The original GL.iNet firmware has two different mac addresses in the factory/art partition. The first one is for the WAN interface only and the second one is for both lan0 and lan1. But the original submission for OpenWrt didn't initialize the mac addresses of the LAN ports for the DSA device at all. The ethernet mac address was then used for all DSA ports. Fixes: 050c24f05c85 ("mvebu: add support for GL.iNet GL-MV1000") Signed-off-by: Sven Eckelmann (cherry picked from commit c20ac84803242e5a6451184009dabc36ba83b96e) --- .../arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts index 7c85ab4a9d..80b078cfaa 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts @@ -168,12 +168,16 @@ reg = <2>; label = "lan0"; phy-handle = <&switch0phy1>; + + mtd-mac-address = <&factory 0x6>; }; port@3 { reg = <3>; label = "lan1"; phy-handle = <&switch0phy2>; + + mtd-mac-address = <&factory 0x6>; }; }; From 290b28664d2522654dd304c40122beeb85f565a6 Mon Sep 17 00:00:00 2001 From: Russell Senior Date: Tue, 16 Mar 2021 01:24:18 -0700 Subject: [PATCH 08/15] busybox: udhcpc, allow zero length dhcp options This patch skips zero length DHCP options instead of failing. Signed-off-by: Russell Senior (cherry picked from commit 1c0436507156dc136d9e2668507817395434109e) --- ...205-udhcpc_allow_zero_length_options.patch | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 package/utils/busybox/patches/205-udhcpc_allow_zero_length_options.patch diff --git a/package/utils/busybox/patches/205-udhcpc_allow_zero_length_options.patch b/package/utils/busybox/patches/205-udhcpc_allow_zero_length_options.patch new file mode 100644 index 0000000000..abe8baf54f --- /dev/null +++ b/package/utils/busybox/patches/205-udhcpc_allow_zero_length_options.patch @@ -0,0 +1,49 @@ +From 7eed119b84b0f7efb7ef351940dd895dc2379eb3 Mon Sep 17 00:00:00 2001 +From: Russell Senior +Date: Mon, 15 Mar 2021 23:27:58 -0700 +Subject: [PATCH v2] udhcpc: ignore zero-length DHCP options + +Discovered that the DHCP server on a TrendNet router (unknown model) +provides a zero-length option 12 (Host Name) in the DHCP ACK message. This +has the effect of causing udhcpc to drop the rest of the options, including +option 51 (IP Address Lease Time), 3 (Router), and 6 (Domain Name Server), +most importantly leaving the OpenWrt device with no default gateway. + +The TrendNet behavior violates RFC 2132, which in Section 3.14 declares that +option 12 has a miniumum length of 1 octet. It is perhaps not a cosmic coincidence +that I found this behavior on Pi Day. + +This patch allows zero length options without bailing out, by simply skipping them. + +v2 changelog: +* advance the optionptr by two bytes, not one; +* add a message to warn about the rfc violation; + +Signed-off-by: Russell Senior +--- + networking/udhcp/common.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c +index 4bc719001..a16fd85d0 100644 +--- a/networking/udhcp/common.c ++++ b/networking/udhcp/common.c +@@ -277,8 +277,13 @@ uint8_t* FAST_FUNC udhcp_scan_options(struct dhcp_packet *packet, struct dhcp_sc + goto complain; /* complain and return NULL */ + len = 2 + scan_state->optionptr[OPT_LEN]; + scan_state->rem -= len; +- /* So far no valid option with length 0 known. */ +- if (scan_state->rem < 0 || scan_state->optionptr[OPT_LEN] == 0) ++ /* skip any options with zero length */ ++ if (scan_state->optionptr[OPT_LEN] == 0) { ++ scan_state->optionptr += 2; ++ bb_simple_error_msg("warning: zero length DHCP option violates rfc2132, skipping"); ++ continue; ++ } ++ if (scan_state->rem < 0) + goto complain; /* complain and return NULL */ + + if (scan_state->optionptr[OPT_CODE] == DHCP_OPTION_OVERLOAD) { +-- +2.30.1 + From b89accdfbc771e9936abf33dd5cfcd6882841564 Mon Sep 17 00:00:00 2001 From: Eike Ritter Date: Sun, 14 Mar 2021 18:50:21 +0000 Subject: [PATCH 09/15] ppp: compile fix: unset FILTER variable in Makefile If the environment variable FILTER is set before compilation, compilation of the ppp-package will fail with the error message Package ppp is missing dependencies for the following libraries: libpcap.so.1 The reason is that the OpenWrt-patch for the Makefile only comments out the line FILTER=y. Hence the pcap-library will be dynamically linked if the environment variable FILTER is set elsewhere, which causes compilation to fail. The fix consists on explicitly unsetting the variable FILTER instead. Signed-off-by: Eike Ritter (cherry picked from commit 46cd0765d0c585dc0b48c8c0a3f116ef83cd580f) --- .../services/ppp/patches/610-pppd_compile_fix.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 package/network/services/ppp/patches/610-pppd_compile_fix.patch diff --git a/package/network/services/ppp/patches/610-pppd_compile_fix.patch b/package/network/services/ppp/patches/610-pppd_compile_fix.patch new file mode 100644 index 0000000000..474f11832a --- /dev/null +++ b/package/network/services/ppp/patches/610-pppd_compile_fix.patch @@ -0,0 +1,12 @@ +--- a/pppd/Makefile.linux ++++ b/pppd/Makefile.linux +@@ -48,7 +48,8 @@ MPPE=y + # Uncomment the next line to include support for PPP packet filtering. + # This requires that the libpcap library and headers be installed + # and that the kernel driver support PPP packet filtering. +-#FILTER=y ++# libpcap statically linked in OpenWRT, hence disabled here. ++FILTER= + + # Support for precompiled filters + PRECOMPILED_FILTER=y From eb1509a9383ac5905f62ea83812d22bc2ab21fde Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Wed, 3 Mar 2021 22:46:50 +0100 Subject: [PATCH 10/15] lantiq: set maximum kernel size for ARV7519RW22 Some users report that current snapshot producies non-bootable images. Stock uboot can boot images if the kernel is smaller than 2MB. Set maximum kernel size and disable image building for this board. Ref: https://forum.openwrt.org/t/astoria-arv7519rw22-bootloops-after-upgrade/89843 Signed-off-by: Aleksander Jan Bajkowski (cherry picked from commit c027dbac5a5222e6be4706a7a6a0effefce8ae76) --- target/linux/lantiq/image/vr9.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index d3420bb2b9..1f045ee594 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -17,9 +17,11 @@ define Device/arcadyan_arv7519rw22 DEVICE_ALT0_VARIANT := 2.1 DEVICE_ALT1_VENDOR := Astoria Networks DEVICE_ALT1_MODEL := ARV7519RW22 + KERNEL_SIZE := 2048k IMAGE_SIZE := 31232k DEVICE_PACKAGES := kmod-usb-dwc2 SUPPORTED_DEVICES += ARV7519RW22 + DEFAULT := n endef TARGET_DEVICES += arcadyan_arv7519rw22 From c61d4eeedb6588cca3ac4e2e51d939f607c96f37 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 17 Mar 2021 03:39:51 +0000 Subject: [PATCH 11/15] ath79: fix RS-485 on Teltonika RUT-955 DTR GPIO isn't actually needed and triggers boot warning. TX pin was off by one (GPIO 19 instead of GPIO 18). Reported-by: @tophirsch Fixes: d1130ad265 ("ath79: add support for Teltonika RUT955") Signed-off-by: Daniel Golle (cherry picked from commit 53a7d5d614050a38a4e78f5a9e153e7612d587f0) --- .../ath79/dts/ar9344_teltonika_rut955-h7v3c0.dts | 4 ---- target/linux/ath79/dts/ar9344_teltonika_rut955.dts | 4 ---- target/linux/ath79/dts/ar9344_teltonika_rut9xx.dtsi | 12 ++++++------ 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_teltonika_rut955-h7v3c0.dts b/target/linux/ath79/dts/ar9344_teltonika_rut955-h7v3c0.dts index f61f2bf628..eb9606e58b 100644 --- a/target/linux/ath79/dts/ar9344_teltonika_rut955-h7v3c0.dts +++ b/target/linux/ath79/dts/ar9344_teltonika_rut955-h7v3c0.dts @@ -159,10 +159,6 @@ }; }; -&hs_uart { - dtr-gpios = <&gpio_ext 15 GPIO_ACTIVE_HIGH>; -}; - ð0 { status = "okay"; diff --git a/target/linux/ath79/dts/ar9344_teltonika_rut955.dts b/target/linux/ath79/dts/ar9344_teltonika_rut955.dts index 7914928aa0..ba840a05d3 100644 --- a/target/linux/ath79/dts/ar9344_teltonika_rut955.dts +++ b/target/linux/ath79/dts/ar9344_teltonika_rut955.dts @@ -158,10 +158,6 @@ }; }; -&hs_uart { - dtr-gpios = <&gpio_ext 13 GPIO_ACTIVE_HIGH>; -}; - ð0 { status = "okay"; diff --git a/target/linux/ath79/dts/ar9344_teltonika_rut9xx.dtsi b/target/linux/ath79/dts/ar9344_teltonika_rut9xx.dtsi index 88b9170fc0..d9c66d2745 100644 --- a/target/linux/ath79/dts/ar9344_teltonika_rut9xx.dtsi +++ b/target/linux/ath79/dts/ar9344_teltonika_rut9xx.dtsi @@ -154,20 +154,20 @@ &pinmux { pmx_spi: spi { // SPI_CS1 on GPIO 3 - pinctrl-single,bits = <0x0 0x07000000 0xff000000>; + pinctrl-single,bits = <0x0 0x07000000 0xff000000>; }; pmx_leds_switch: leds_switch { // switch port LEDs on GPIO 1, GPIO 13, GPIO 14 and GPIO 22 - pinctrl-single,bits = <0x0 0x00002d00 0x0000ff00>, - <0xc 0x002c2b00 0x00ffff00>, + pinctrl-single,bits = <0x00 0x00002d00 0x0000ff00>, + <0x0c 0x002c2b00 0x00ffff00>, <0x14 0x002a0000 0x00ff0000>; }; pmx_uart2: uart2 { // UART1_DTR on GPIO 0, UART1_RD on GPIO 11, UART1_TD on GPIO 18 - pinctrl-single,bits = <0x0 0x0 0xff>, - <0x10 0x4f000000 0xff000000>, - <0x3c 0x000b0000 0x00ff0000>; + pinctrl-single,bits = <0x00 0x00000000 0x000000ff>, + <0x10 0x004f0000 0x00ff0000>, + <0x3c 0x000b0000 0x00ff0000>; }; }; From f0ab4b17e66cef75ab6d407c65b9224a3629d0d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 8 Mar 2021 10:46:06 +0100 Subject: [PATCH 12/15] gitignore: add .vscode for VS Code users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For Visual Studio Code users, .vscode is created inside the workspace. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 12dbad1a86ebdbb4c9bd71b14eec245bc6373844) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b6bfe1a525..9647daa5a4 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ git-src .project .cproject .ccache +.vscode From 6b2bcd2597688484007349243ac4cd835b2a5cd2 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Mon, 1 Mar 2021 01:07:45 -0800 Subject: [PATCH 13/15] bpftools: fix libbpf pkgconfig file The pkgconfig file hardcodes a host library directory which cannot be overridden by OpenWrt during builds. Use SED to fix this and potential include directory problems, as is done with several other packages. This fixes a strange issue intermittently seen building iproute2 on the oxnas target: iptables modules directory: /usr/lib/iptables libc has setns: yes SELinux support: no libbpf support: no libbpf version 0.3.0 is too low, please update it to at least 0.1.0 LIBBPF_FORCE=on set, but couldn't find a usable libbpf Fixes: 2f0d672088c3 ("bpftools: add utility and library packages supporting eBPF usage") Reported-by: Russell Senior Signed-off-by: Tony Ambardar (cherry picked from commit 9e64e4ce26719ea81637b0e3d9754bd5190f0c21) --- package/network/utils/bpftools/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/network/utils/bpftools/Makefile b/package/network/utils/bpftools/Makefile index 7a25b35755..ab1e4aa0c4 100644 --- a/package/network/utils/bpftools/Makefile +++ b/package/network/utils/bpftools/Makefile @@ -145,6 +145,10 @@ define Build/InstallDev/libbpf $(INSTALL_DIR) $(1)/usr/lib/pkgconfig $(CP) $(PKG_INSTALL_DIR)/usr/lib$(LIB_SUFFIX)/pkgconfig/libbpf.pc \ $(1)/usr/lib/pkgconfig/ + $(SED) 's,/usr/include,$$$${prefix}/include,g' \ + $(1)/usr/lib/pkgconfig/libbpf.pc + $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' \ + $(1)/usr/lib/pkgconfig/libbpf.pc endef ifeq ($(BUILD_VARIANT),lib) From da7ef7f41434f4f49f8f76319f8043135108b9c0 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Thu, 4 Mar 2021 12:38:31 +0100 Subject: [PATCH 14/15] ipq40xx: net: phy: qca807x: fix GPIO driver While rebasing into setting bits instead of magic values, I accidentally forgot to actually set the force bit. Without it using the pins as GPIO-s did not actually work. Fixes: b5c93ed ("ipq40xx: add Qualcomm QCA807x driver") Signed-off-by: Robert Marko (cherry picked from commit 7f2d9ccd09a1d3034aaf9c943747fc1631da5cac) --- target/linux/ipq40xx/files/drivers/net/phy/qca807x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq40xx/files/drivers/net/phy/qca807x.c b/target/linux/ipq40xx/files/drivers/net/phy/qca807x.c index 10d38d94a6..16d7a80455 100644 --- a/target/linux/ipq40xx/files/drivers/net/phy/qca807x.c +++ b/target/linux/ipq40xx/files/drivers/net/phy/qca807x.c @@ -356,6 +356,7 @@ static void qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int valu val = phy_read_mmd(priv->phy, MDIO_MMD_AN, qca807x_gpio_get_reg(offset)); val &= ~QCA807X_GPIO_FORCE_MODE_MASK; + val |= QCA807X_GPIO_FORCE_EN; val |= FIELD_PREP(QCA807X_GPIO_FORCE_MODE_MASK, value); phy_write_mmd(priv->phy, MDIO_MMD_AN, qca807x_gpio_get_reg(offset), val); From b2c9a8741ff2ea4c6689482aece0f35e15b428c8 Mon Sep 17 00:00:00 2001 From: Donald Hoskins Date: Sun, 14 Feb 2021 15:35:45 -0500 Subject: [PATCH 15/15] libunwind: Add MIPS64 dep check libunwind dependency check does not allow for MIPS64 arch. Add MIPS64 awareness. libunwind seems to support MIPS64 without issues, it was limited by the dep arch check in the Makefile. Used to compile Suricata6/Rust locally without issue. Signed-off-by: Donald Hoskins (cherry picked from commit ea6d4bdde20a3fecbfc44b99f53373e1d0666e34) --- package/libs/libunwind/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/libs/libunwind/Makefile b/package/libs/libunwind/Makefile index 89e6f84ff5..7f79996d25 100644 --- a/package/libs/libunwind/Makefile +++ b/package/libs/libunwind/Makefile @@ -32,7 +32,7 @@ define Package/libunwind CATEGORY:=Libraries TITLE:=The libunwind project URL:=http://www.nongnu.org/libunwind/ - DEPENDS:=@((mips||mipsel||x86_64||arm||aarch64)||(USE_GLIBC&&(powerpc||i386))) +zlib + DEPENDS:=@((mips||mipsel||mips64||x86_64||arm||aarch64)||(USE_GLIBC&&(powerpc||i386))) +zlib ABI_VERSION:=8 endef