From 2715aff5df836c1d3eb8cbf5afdb0c197902ee4b Mon Sep 17 00:00:00 2001 From: Jacob Aharon Date: Mon, 27 Mar 2023 12:12:48 +1100 Subject: [PATCH 01/16] ipq806x: Fix Linksys upgrade, restore config step It appears that the refactor of the upgrade process for NAND devices resulted in the nand_do_upgrade_success step not being called for devices using the linksys.sh script. As a result, configuration was not preserved over sysupgrade steps. This restores the preservation of configs for ipq806x devices using the linksys.sh script. Other devices and targets have not been examined. This commit uses the same functionality and terminology used in commit 8634c10 ("ipq40xx: Fix Linksys upgrade, restore config step") Fixes: e25e6d8 ("base-files: fix and clean up nand sysupgrade code") Tested-on: EA8500 Signed-off-by: Jacob Aharon --- target/linux/ipq806x/base-files/lib/upgrade/linksys.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh index 5f883637da5..b0ad1b43be6 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh @@ -94,7 +94,12 @@ platform_do_upgrade_linksys() { # complete std upgrade - nand_upgrade_tar "$1" + if nand_upgrade_tar "$1" ; then + nand_do_upgrade_success + else + nand_do_upgrade_failure + fi + } [ "$magic_long" = "27051956" ] && { get_image "$1" | mtd write - $part_label From 4467cf8e418e8003324990541b199d313b7c9235 Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Tue, 21 Mar 2023 11:39:21 +0200 Subject: [PATCH 02/16] tools/coreutils: update to 9.2 This resolves an error when building toolchain/musl on macOS due to improper hole-detection caused by a bug in macOS/APFS [1]. As long as we don't reconfigure, 001-m4.patch is not needed. If we keep it, it will force reconfigure the project, since m4 files are changed. This works, but may not be optimal, because the build should use files from coreutils/m4, but OpenWRT uses legacy files from staging_dir/host/share/aclocal [2]. backport a couple of upstream patches date: diagnose -f read errors copy: fix --reflink=auto to fallback in more cases [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61386 [2] https://github.com/openwrt/openwrt/pull/12233#issuecomment-1481097456 Co-developed-by: Michael Pratt Signed-off-by: Georgi Valkov --- tools/coreutils/Makefile | 5 +- ...flink-auto-to-fallback-in-more-cases.patch | 126 ++++++++++++++++++ tools/coreutils/patches/001-m4.patch | 95 ------------- .../002-date-diagnose-f-read-errors.patch | 20 +++ 4 files changed, 148 insertions(+), 98 deletions(-) create mode 100644 tools/coreutils/patches/001-copy-fix-reflink-auto-to-fallback-in-more-cases.patch delete mode 100644 tools/coreutils/patches/001-m4.patch create mode 100644 tools/coreutils/patches/002-date-diagnose-f-read-errors.patch diff --git a/tools/coreutils/Makefile b/tools/coreutils/Makefile index 2b7b40cddcb..23f2ea2cfbf 100644 --- a/tools/coreutils/Makefile +++ b/tools/coreutils/Makefile @@ -8,14 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=coreutils PKG_CPE_ID:=cpe:/a:gnu:coreutils -PKG_VERSION:=9.1 +PKG_VERSION:=9.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/coreutils -PKG_HASH:=61a1f410d78ba7e7f37a5a4f50e6d1320aca33375484a3255eddf17a38580423 +PKG_HASH:=6885ff47b9cdb211de47d368c17853f406daaf98b148aaecdf10de29cc04b0b3 HOST_BUILD_PARALLEL := 1 -PKG_FIXUP:=autoreconf BUILD_PROGRAMS = date readlink touch ln chown ginstall diff --git a/tools/coreutils/patches/001-copy-fix-reflink-auto-to-fallback-in-more-cases.patch b/tools/coreutils/patches/001-copy-fix-reflink-auto-to-fallback-in-more-cases.patch new file mode 100644 index 00000000000..5416177a15d --- /dev/null +++ b/tools/coreutils/patches/001-copy-fix-reflink-auto-to-fallback-in-more-cases.patch @@ -0,0 +1,126 @@ +From 093a8b4bfaba60005f14493ce7ef11ed665a0176 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Thu, 23 Mar 2023 13:19:04 +0000 +Subject: [PATCH] copy: fix --reflink=auto to fallback in more cases + +On restricted systems like android or some containers, +FICLONE could return EPERM, EACCES, or ENOTTY, +which would have induced the command to fail to copy +rather than falling back to a more standard copy. + +* src/copy.c (is_terminal_failure): A new function refactored +from handle_clone_fail(). +(is_CLONENOTSUP): Merge in the handling of EACCES, ENOTTY, EPERM +as they also pertain to determination of whether cloning is supported +if we ever use this function in that context. +(handle_clone_fail): Use is_terminal_failure() in all cases, +so that we assume a terminal failure in less errno cases. +* NEWS: Mention the bug fix. +Addresses https://bugs.gnu.org/62404 +--- +--- a/src/copy.c ++++ b/src/copy.c +@@ -278,15 +278,27 @@ create_hole (int fd, char const *name, b + } + + +-/* Whether the errno from FICLONE, or copy_file_range +- indicates operation is not supported for this file or file system. */ ++/* Whether the errno indicates the operation is a transient failure. ++ I.e., a failure that would indicate the operation _is_ supported, ++ but has failed in a terminal way. */ ++ ++static bool ++is_terminal_error (int err) ++{ ++ return err == EIO || err == ENOMEM || err == ENOSPC || err == EDQUOT; ++} ++ ++ ++/* Whether the errno from FICLONE, or copy_file_range indicates ++ the operation is not supported/allowed for this file or process. */ + + static bool + is_CLONENOTSUP (int err) + { +- return err == ENOSYS || is_ENOTSUP (err) ++ return err == ENOSYS || err == ENOTTY || is_ENOTSUP (err) + || err == EINVAL || err == EBADF +- || err == EXDEV || err == ETXTBSY; ++ || err == EXDEV || err == ETXTBSY ++ || err == EPERM || err == EACCES; + } + + +@@ -339,20 +351,18 @@ sparse_copy (int src_fd, int dest_fd, ch + { + copy_debug.offload = COPY_DEBUG_UNSUPPORTED; + +- if (is_CLONENOTSUP (errno)) +- break; +- +- /* copy_file_range might not be enabled in seccomp filters, +- so retry with a standard copy. EPERM can also occur +- for immutable files, but that would only be in the edge case +- where the file is made immutable after creating/truncating, ++ /* Consider operation unsupported only if no data copied. ++ For example, EPERM could occur if copy_file_range not enabled ++ in seccomp filters, so retry with a standard copy. EPERM can ++ also occur for immutable files, but that would only be in the ++ edge case where the file is made immutable after creating, + in which case the (more accurate) error is still shown. */ +- if (errno == EPERM && *total_n_read == 0) ++ if (*total_n_read == 0 && is_CLONENOTSUP (errno)) + break; + + /* ENOENT was seen sometimes across CIFS shares, resulting in + no data being copied, but subsequent standard copies succeed. */ +- if (errno == ENOENT && *total_n_read == 0) ++ if (*total_n_read == 0 && errno == ENOENT) + break; + + if (errno == EINTR) +@@ -1172,17 +1182,15 @@ handle_clone_fail (int dst_dirfd, char c + char const* src_name, char const* dst_name, + int dest_desc, bool new_dst, enum Reflink_type reflink_mode) + { +- /* If the clone operation is creating the destination, +- then don't try and cater for all non transient file system errors, +- and instead only cater for specific transient errors. */ +- bool transient_failure; +- if (dest_desc < 0) /* currently for fclonefileat(). */ +- transient_failure = errno == EIO || errno == ENOMEM +- || errno == ENOSPC || errno == EDQUOT; +- else /* currently for FICLONE. */ +- transient_failure = ! is_CLONENOTSUP (errno); ++ /* When the clone operation fails, report failure only with errno values ++ known to mean trouble when the clone is supported and called properly. ++ Do not report failure merely because !is_CLONENOTSUP (errno), ++ as systems may yield oddball errno values here with FICLONE. ++ Also is_CLONENOTSUP() is not appropriate for the range of errnos ++ possible from fclonefileat(), so it's more consistent to avoid. */ ++ bool report_failure = is_terminal_error (errno); + +- if (reflink_mode == REFLINK_ALWAYS || transient_failure) ++ if (reflink_mode == REFLINK_ALWAYS || report_failure) + error (0, errno, _("failed to clone %s from %s"), + quoteaf_n (0, dst_name), quoteaf_n (1, src_name)); + +@@ -1190,14 +1198,14 @@ handle_clone_fail (int dst_dirfd, char c + but cloned no data. */ + if (new_dst /* currently not for fclonefileat(). */ + && reflink_mode == REFLINK_ALWAYS +- && ((! transient_failure) || lseek (dest_desc, 0, SEEK_END) == 0) ++ && ((! report_failure) || lseek (dest_desc, 0, SEEK_END) == 0) + && unlinkat (dst_dirfd, dst_relname, 0) != 0 && errno != ENOENT) + error (0, errno, _("cannot remove %s"), quoteaf (dst_name)); + +- if (! transient_failure) ++ if (! report_failure) + copy_debug.reflink = COPY_DEBUG_UNSUPPORTED; + +- if (reflink_mode == REFLINK_ALWAYS || transient_failure) ++ if (reflink_mode == REFLINK_ALWAYS || report_failure) + return false; + + return true; diff --git a/tools/coreutils/patches/001-m4.patch b/tools/coreutils/patches/001-m4.patch deleted file mode 100644 index f3d70183328..00000000000 --- a/tools/coreutils/patches/001-m4.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- a/m4/gnulib-comp.m4 -+++ b/m4/gnulib-comp.m4 -@@ -2671,7 +2671,7 @@ changequote([, ])dnl - fi - gl_SYS_SOCKET_MODULE_INDICATOR([socket]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GNUTLS]) - gl_FUNC_STRERROR_R - AS_IF([test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1], [ - AC_LIBOBJ([strerror_r]) ---- a/m4/stdint.m4 -+++ b/m4/stdint.m4 -@@ -15,7 +15,7 @@ AC_DEFUN_ONCE([gl_STDINT_H], - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - - AC_REQUIRE([gl_LIMITS_H]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GNUTLS]) - - dnl For backward compatibility. Some packages may still be testing these - dnl macros. ---- a/m4/vasnprintf.m4 -+++ b/m4/vasnprintf.m4 -@@ -33,7 +33,7 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF], - AC_DEFUN([gl_PREREQ_PRINTF_ARGS], - [ - AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GNUTLS]) - ]) - - # Prerequisites of lib/printf-parse.h, lib/printf-parse.c. -@@ -41,7 +41,7 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], - [ - AC_REQUIRE([gl_FEATURES_H]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GNUTLS]) - AC_REQUIRE([AC_TYPE_SIZE_T]) - AC_CHECK_TYPE([ptrdiff_t], , - [AC_DEFINE([ptrdiff_t], [long], -@@ -55,7 +55,7 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], - [ - AC_REQUIRE([AC_FUNC_ALLOCA]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GNUTLS]) - AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) - dnl Use the _snprintf function only if it is declared (because on NetBSD it - dnl is defined as a weak alias of snprintf; we prefer to use the latter). ---- a/m4/wchar_h.m4 -+++ b/m4/wchar_h.m4 -@@ -27,7 +27,7 @@ AC_DEFUN_ONCE([gl_WCHAR_H], - - AC_REQUIRE([gl_FEATURES_H]) - -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GNUTLS]) - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else ---- a/m4/wctype_h.m4 -+++ b/m4/wctype_h.m4 -@@ -22,7 +22,7 @@ AC_DEFUN_ONCE([gl_WCTYPE_H], - fi - AC_SUBST([HAVE_ISWCNTRL]) - -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GNUTLS]) - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else ---- a/m4/wcwidth.m4 -+++ b/m4/wcwidth.m4 -@@ -13,7 +13,7 @@ AC_DEFUN([gl_FUNC_WCWIDTH], - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - - AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GNUTLS]) - - AC_CHECK_HEADERS_ONCE([wchar.h]) - AC_CHECK_FUNCS_ONCE([wcwidth]) ---- a/m4/wint_t.m4 -+++ b/m4/wint_t.m4 -@@ -9,7 +9,7 @@ dnl Test whether has the 'wint - dnl or would, if present, override 'wint_t'. - dnl Prerequisite: AC_PROG_CC - --AC_DEFUN([gt_TYPE_WINT_T], -+AC_DEFUN([gt_TYPE_WINT_T_GNUTLS], - [ - AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], - [AC_COMPILE_IFELSE( diff --git a/tools/coreutils/patches/002-date-diagnose-f-read-errors.patch b/tools/coreutils/patches/002-date-diagnose-f-read-errors.patch new file mode 100644 index 00000000000..5174af1aa0c --- /dev/null +++ b/tools/coreutils/patches/002-date-diagnose-f-read-errors.patch @@ -0,0 +1,20 @@ +From 9c5e542fd190a14431092e3b6cb45d18fe95f26f Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Tue, 28 Mar 2023 01:52:43 -0700 +Subject: [PATCH] date: diagnose -f read errors + +* src/date.c (batch_convert): Diagnose read errors, fixing Bug#62497. +--- +--- a/src/date.c ++++ b/src/date.c +@@ -368,7 +368,9 @@ batch_convert (char const *input_filenam + ssize_t line_length = getline (&line, &buflen, in_stream); + if (line_length < 0) + { +- /* FIXME: detect/handle error here. */ ++ if (ferror (in_stream)) ++ die (EXIT_FAILURE, errno, _("%s: read error"), ++ quotef (input_filename)); + break; + } + From d3b47909b199b876f67a0387b5545cb73bd6b815 Mon Sep 17 00:00:00 2001 From: Thomas Nixon Date: Sun, 26 Mar 2023 10:19:21 +0000 Subject: [PATCH 03/16] lantiq: nand: don't yield while holding spinlock The nand driver normally while waiting for the device to become ready; this is normally fine, but xway_nand holds the ebu_lock spinlock, and this can cause lockups if other threads which use ebu_lock are interleaved. Fix this by waiting instead of polling. This mainly showed up as crashes in ath9k_pci_owl_loader (see https://github.com/openwrt/openwrt/issues/9829 ), but turning on spinlock debugging shows this happening in other places too. This doesn't seem to measurably impact boot time. Tested on bt_homehub-v5a with 5.10 and 5.15. Signed-off-by: Thomas Nixon [Add commit description into patch] Signed-off-by: Hauke Mehrtens --- ...y-don-t-yield-while-holding-spinlock.patch | 38 +++++++++++++++++++ ...y-don-t-yield-while-holding-spinlock.patch | 38 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 target/linux/lantiq/patches-5.10/0400-mtd-rawnand-xway-don-t-yield-while-holding-spinlock.patch create mode 100644 target/linux/lantiq/patches-5.15/0400-mtd-rawnand-xway-don-t-yield-while-holding-spinlock.patch diff --git a/target/linux/lantiq/patches-5.10/0400-mtd-rawnand-xway-don-t-yield-while-holding-spinlock.patch b/target/linux/lantiq/patches-5.10/0400-mtd-rawnand-xway-don-t-yield-while-holding-spinlock.patch new file mode 100644 index 00000000000..edf06268609 --- /dev/null +++ b/target/linux/lantiq/patches-5.10/0400-mtd-rawnand-xway-don-t-yield-while-holding-spinlock.patch @@ -0,0 +1,38 @@ +From 416f25a948d11ef15733f2e31658d31b5cc7bef6 Mon Sep 17 00:00:00 2001 +From: Thomas Nixon +Date: Sun, 26 Mar 2023 11:08:49 +0100 +Subject: [PATCH] mtd: rawnand: xway: don't yield while holding spinlock + +The nand driver normally while waiting for the device to become ready; +this is normally fine, but xway_nand holds the ebu_lock spinlock, and +this can cause lockups if other threads which use ebu_lock are +interleaved. Fix this by waiting instead of polling. + +This mainly showed up as crashes in ath9k_pci_owl_loader (see +https://github.com/openwrt/openwrt/issues/9829 ), but turning on +spinlock debugging shows this happening in other places too. + +This doesn't seem to measurably impact boot time. + +Signed-off-by: Thomas Nixon +--- + drivers/mtd/nand/raw/xway_nand.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/nand/raw/xway_nand.c ++++ b/drivers/mtd/nand/raw/xway_nand.c +@@ -175,7 +175,13 @@ static void xway_cmd_ctrl(struct nand_ch + + static int xway_dev_ready(struct nand_chip *chip) + { +- return ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_RD; ++ /* ++ * wait until ready, as otherwise the driver will yield in nand_wait or ++ * nand_wait_ready, which is a bad idea when we're holding ebu_lock ++ */ ++ while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_RD) == 0) ++ cpu_relax(); ++ return 1; + } + + static unsigned char xway_read_byte(struct nand_chip *chip) diff --git a/target/linux/lantiq/patches-5.15/0400-mtd-rawnand-xway-don-t-yield-while-holding-spinlock.patch b/target/linux/lantiq/patches-5.15/0400-mtd-rawnand-xway-don-t-yield-while-holding-spinlock.patch new file mode 100644 index 00000000000..edf06268609 --- /dev/null +++ b/target/linux/lantiq/patches-5.15/0400-mtd-rawnand-xway-don-t-yield-while-holding-spinlock.patch @@ -0,0 +1,38 @@ +From 416f25a948d11ef15733f2e31658d31b5cc7bef6 Mon Sep 17 00:00:00 2001 +From: Thomas Nixon +Date: Sun, 26 Mar 2023 11:08:49 +0100 +Subject: [PATCH] mtd: rawnand: xway: don't yield while holding spinlock + +The nand driver normally while waiting for the device to become ready; +this is normally fine, but xway_nand holds the ebu_lock spinlock, and +this can cause lockups if other threads which use ebu_lock are +interleaved. Fix this by waiting instead of polling. + +This mainly showed up as crashes in ath9k_pci_owl_loader (see +https://github.com/openwrt/openwrt/issues/9829 ), but turning on +spinlock debugging shows this happening in other places too. + +This doesn't seem to measurably impact boot time. + +Signed-off-by: Thomas Nixon +--- + drivers/mtd/nand/raw/xway_nand.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/nand/raw/xway_nand.c ++++ b/drivers/mtd/nand/raw/xway_nand.c +@@ -175,7 +175,13 @@ static void xway_cmd_ctrl(struct nand_ch + + static int xway_dev_ready(struct nand_chip *chip) + { +- return ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_RD; ++ /* ++ * wait until ready, as otherwise the driver will yield in nand_wait or ++ * nand_wait_ready, which is a bad idea when we're holding ebu_lock ++ */ ++ while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_RD) == 0) ++ cpu_relax(); ++ return 1; + } + + static unsigned char xway_read_byte(struct nand_chip *chip) From dfd8e2c320688b93d7653c272e85d4f55577a328 Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Wed, 22 Mar 2023 13:20:23 +0800 Subject: [PATCH 04/16] tools/ccache: always disable documentation compilation Speed up compilation. Also remove useless include target.mk (b492e69bd2d09aaa2c3c76b52203cbb3527eb2f7). Signed-off-by: Linhui Liu --- tools/ccache/Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 6824dbddfd4..9b5731d5b9f 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -5,7 +5,6 @@ # See /LICENSE for more information. # include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/target.mk PKG_NAME:=ccache PKG_VERSION:=4.7.4 @@ -22,10 +21,7 @@ CMAKE_HOST_OPTIONS += \ -DCMAKE_CXX_COMPILER_LAUNCHER="" \ -DCMAKE_SKIP_RPATH=FALSE \ -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \ + -DENABLE_DOCUMENTATION=OFF -DREDIS_STORAGE_BACKEND=OFF -ifneq (docs-$(CONFIG_BUILD_DOCUMENTATION),docs-y) -CMAKE_HOST_OPTIONS += -DENABLE_DOCUMENTATION=OFF -endif - $(eval $(call HostBuild)) From d1bd18e0801983f609492e0b85beae9ae617e49a Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Fri, 17 Mar 2023 22:35:16 +0800 Subject: [PATCH 05/16] tools/ccache: bump to 4.8 Release Notes: https://ccache.dev/releasenotes.html#_ccache_4_8 Signed-off-by: Linhui Liu --- tools/ccache/Makefile | 4 ++-- tools/ccache/patches/100-honour-copts.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 9b5731d5b9f..74b2ae3b44c 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ccache -PKG_VERSION:=4.7.4 +PKG_VERSION:=4.8 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://github.com/ccache/ccache/releases/download/v$(PKG_VERSION) -PKG_HASH:=df0c64d15d3efaf0b4f6837dd6b1467e40eeaaa807db25ce79c3a08a46a84e36 +PKG_HASH:=b963ee3bf88d7266b8a0565e4ba685d5666357f0a7e364ed98adb0dc1191fcbb include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk diff --git a/tools/ccache/patches/100-honour-copts.patch b/tools/ccache/patches/100-honour-copts.patch index 5358d425c35..da72af922d0 100644 --- a/tools/ccache/patches/100-honour-copts.patch +++ b/tools/ccache/patches/100-honour-copts.patch @@ -1,6 +1,6 @@ --- a/src/ccache.cpp +++ b/src/ccache.cpp -@@ -1779,6 +1779,7 @@ get_manifest_key(Context& ctx, Hash& has +@@ -1813,6 +1813,7 @@ get_manifest_key(Context& ctx, Hash& has "CPLUS_INCLUDE_PATH", "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH", // clang From 8c445d56f12ffae8620fa99a3cf4a0ad82544efd Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Tue, 15 Mar 2022 19:29:59 +0100 Subject: [PATCH 06/16] uqmi: set IPv6 family explicitly in status check Some modems require CID to be set explicitly during IPv6 connection status check, others require IPv6 address family to be checked explicitly after establishing connection, in order to provide correct status. Set both fields in the request to satisfy them. Fixes: c8a88118af46 ("uqmi: set CID during 'query-data-status' operation") Signed-off-by: Lech Perczak --- package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index c2c5fc1eca0..5045ce04af5 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -326,7 +326,7 @@ proto_qmi_setup() { fi # Check data connection state - connstat=$(uqmi -s -d "$device" --set-client-id wds,"$cid_6" --get-data-status) + connstat=$(uqmi -s -d "$device" --set-client-id wds,"$cid_6" --set-ip-family ipv6 --get-data-status) [ "$connstat" == '"connected"' ] || { echo "No data link!" uqmi -s -d "$device" --set-client-id wds,"$cid_6" --release-client-id wds > /dev/null 2>&1 From 90603d443f56da034c8e8e4f1aeee4c8975413e6 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Tue, 15 Mar 2022 19:27:48 +0100 Subject: [PATCH 07/16] uqmi: explicitly disconnect IPv6 address family Some modems (namely, Telit LE910C4) require the IPv6 connection state to be cleared explicitly, to avoid reporting "no effect" if IPv6 connection is already connected through autoconnect mechanism, or during LTE default bearer attach, which would lead to established session, but without a way to inform protocol handler of the status. Signed-off-by: Lech Perczak --- package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index 5045ce04af5..c271cb86607 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -192,6 +192,7 @@ proto_qmi_setup() { # Cleanup current state if any uqmi -s -d "$device" --stop-network 0xffffffff --autoconnect > /dev/null 2>&1 + uqmi -s -d "$device" --set-ip-family ipv6 --stop-network 0xffffffff --autoconnect > /dev/null 2>&1 # Go online uqmi -s -d "$device" --set-device-operating-mode online > /dev/null 2>&1 From 6b66666da46dd50d4bd2cb1b94fd35ec7f10e54c Mon Sep 17 00:00:00 2001 From: Bin We Date: Fri, 23 Sep 2022 01:04:01 +0800 Subject: [PATCH 08/16] ramips: add support for OrayBox X1 Add support for OrayBox X1. It is a 802.11n router, based on MediaTek MT7628N. Specifications: SoC: MediaTek MT7628N (580MHz) RAM: 64 MiB Flash: 16 MiB NOR (Winbond W25Q128JVSIQ) Wireless: 802.11b/g/n 2x2 2.4GHz (Built In) Ethernet: 1x 100Mbps only USB: 1x USB Type-A 2.0 Host Port Button: 1x "Reset" button LED: 1x Blue LED + 1x Red LED + 1x White LED Power: 5V Micro-USB input Manufacturer Page: https://pgy.oray.com/router/x1.html/parameter Flash Layout: 0x000000000000-0x000000030000 : "u-boot" 0x000000030000-0x000000040000 : "kpanic" 0x000000040000-0x000000050000 : "factory" 0x000000050000-0x000000fe0000 : "firmware" 0x000000fe0000-0x000000ff0000 : "bdinfo" 0x000000ff0000-0x000001000000 : "reserve" Install via SSH: Original firmware is based on OpenWRT, but SSH is not start by default, You should enable it first 1. Login into web admin (10.168.1.1), default password is 'admin' 2. Open the following link, and the result should be {"code":0}; SSH is now started, username is root, password is same as web admin password http://10.168.1.1/cgi-bin/oraybox?_api=ssh_set&enabled=1 4. You can flash firmware via mtd: mtd write /tmp/firmware_image.bin firmware Signed-off-by: Bin We --- .../linux/ramips/dts/mt7628an_oraybox_x1.dts | 129 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 8 ++ .../mt76x8/base-files/etc/board.d/01_leds | 3 + .../mt76x8/base-files/etc/board.d/02_network | 4 + 4 files changed, 144 insertions(+) create mode 100644 target/linux/ramips/dts/mt7628an_oraybox_x1.dts diff --git a/target/linux/ramips/dts/mt7628an_oraybox_x1.dts b/target/linux/ramips/dts/mt7628an_oraybox_x1.dts new file mode 100644 index 00000000000..eb9a20aae05 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_oraybox_x1.dts @@ -0,0 +1,129 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "oraybox,x1", "mediatek,mt7628an-soc"; + model = "OrayBox X1"; + + aliases { + led-boot = &led_status_white; + led-failsafe = &led_status_red; + led-running = &led_status_white; + led-upgrade = &led_status_red; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_status_blue: status-blue { + label = "blue:status"; + gpios = <&gpio 37 GPIO_ACTIVE_HIGH>; + }; + + led_status_red: status-red { + label = "red:status"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + }; + + led_status_white: status-white { + label = "white:status"; + gpios = <&gpio 44 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "kpanic"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xf00000>; + }; + + bdinfo: partition@fe0000 { + label = "bdinfo"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + partition@ff0000 { + label = "reserve"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "wdt"; + function = "gpio"; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_bdinfo_9>; + nvmem-cell-names = "mac-address"; +}; + +&wmac { + status = "okay"; +}; + +&bdinfo { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_9: macaddr@9 { + reg = <0x9 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 296b80d03fe..fd16606f3ff 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -474,6 +474,14 @@ define Device/onion_omega2p endef TARGET_DEVICES += onion_omega2p +define Device/oraybox_x1 + IMAGE_SIZE := 15360k + DEVICE_VENDOR := OrayBox + DEVICE_MODEL := X1 + DEVICE_PACKAGES:= kmod-usb2 kmod-usb-ohci +endef +TARGET_DEVICES += oraybox_x1 + define Device/rakwireless_rak633 IMAGE_SIZE := 7872k DEVICE_VENDOR := Rakwireless diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index d972762dadc..792bd13ebc1 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -59,6 +59,9 @@ keenetic,kn-1613) mediatek,linkit-smart-7688) ucidef_set_led_wlan "wifi" "wifi" "orange:wifi" "phy0tpt" ;; +oraybox,x1) + ucidef_set_led_netdev "wifi" "wifi" "blue:status" "wlan0" + ;; rakwireless,rak633) ucidef_set_led_netdev "wifi_led" "wifi" "blue:wifi" "wlan0" ;; diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index bfd11fda2e6..6bcdea971b2 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -141,6 +141,10 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0" ;; + oraybox,x1) + ucidef_add_switch "switch0" \ + "3:lan" "6@eth0" + ;; rakwireless,rak633) ucidef_add_switch "switch0" \ "0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" From 3c3614cec4f4355a7c2f7fa5bc61f8bb07e55025 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Thu, 16 Feb 2023 15:25:12 +0100 Subject: [PATCH 09/16] tools/7z: Allow building on alpine When using alpine as host, things start to fail. Lets pull in the upstream alpine patches to make things work. This should not affect other hosts. Note, that Alpine has the '_GNU_SOURCE' define in the APKBUILD file, but here we add this flag to the needed fix flags patch, which does similar things too. Signed-off-by: Olliver Schinagl --- tools/7z/patches/7-zip-flags.patch | 27 ++++++++++++++ tools/7z/patches/7-zip-musl.patch | 59 ++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 tools/7z/patches/7-zip-flags.patch create mode 100644 tools/7z/patches/7-zip-musl.patch diff --git a/tools/7z/patches/7-zip-flags.patch b/tools/7z/patches/7-zip-flags.patch new file mode 100644 index 00000000000..ed5b5084018 --- /dev/null +++ b/tools/7z/patches/7-zip-flags.patch @@ -0,0 +1,27 @@ +--- a/CPP/7zip/7zip_gcc.mak ++++ b/CPP/7zip/7zip_gcc.mak +@@ -18,13 +18,13 @@ PROGPATH_STATIC = $(O)/$(PROG)s + + + ifneq ($(CC), xlc) +-CFLAGS_WARN_WALL = -Wall -Werror -Wextra ++CFLAGS_WARN_WALL = -Wall -Wextra + endif + + # for object file + CFLAGS_BASE_LIST = -c + # CFLAGS_BASE_LIST = -S +-CFLAGS_BASE = -O2 $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) \ ++CFLAGS_BASE = $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) -D_GNU_SOURCE \ + -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ + -fPIC + +@@ -192,7 +192,7 @@ all: $(O) $(PROGPATH) $(STATIC_TARGET) + $(O): + $(MY_MKDIR) $(O) + +-LFLAGS_ALL = -s $(MY_ARCH_2) $(LDFLAGS) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2) ++LFLAGS_ALL = $(MY_ARCH_2) $(LDFLAGS) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2) + $(PROGPATH): $(OBJS) + $(CXX) -o $(PROGPATH) $(LFLAGS_ALL) + diff --git a/tools/7z/patches/7-zip-musl.patch b/tools/7z/patches/7-zip-musl.patch new file mode 100644 index 00000000000..cf3386e4de3 --- /dev/null +++ b/tools/7z/patches/7-zip-musl.patch @@ -0,0 +1,59 @@ +--- a/C/CpuArch.c ++++ b/C/CpuArch.c +@@ -421,8 +421,6 @@ BoolInt CPU_IsSupported_AES (void) { ret + + #ifdef USE_HWCAP + +-#include +- + #define MY_HWCAP_CHECK_FUNC_2(name1, name2) \ + BoolInt CPU_IsSupported_ ## name1() { return (getauxval(AT_HWCAP) & (HWCAP_ ## name2)) ? 1 : 0; } + +--- a/C/Threads.c ++++ b/C/Threads.c +@@ -257,7 +257,7 @@ WRes Thread_Create_With_CpuSet(CThread * + */ + + // ret2 = +- pthread_attr_setaffinity_np(&attr, sizeof(*cpuSet), cpuSet); ++ //pthread_attr_setaffinity_np(&attr, sizeof(*cpuSet), cpuSet); + // if (ret2) ret = ret2; + #endif + } +@@ -267,14 +267,12 @@ WRes Thread_Create_With_CpuSet(CThread * + if (!ret) + { + p->_created = 1; +- /* + if (cpuSet) + { + // ret2 = + pthread_setaffinity_np(p->_tid, sizeof(*cpuSet), cpuSet); + // if (ret2) ret = ret2; + } +- */ + } + } + // ret2 = +--- a/C/Threads.h ++++ b/C/Threads.h +@@ -19,6 +19,7 @@ + #endif + + #include ++#include + + #endif + +--- a/CPP/Windows/SystemInfo.cpp ++++ b/CPP/Windows/SystemInfo.cpp +@@ -36,9 +36,6 @@ + #endif + */ + +-#ifdef MY_CPU_ARM_OR_ARM64 +-#include +-#endif + #endif + + #ifdef __linux__ From 4d9c38d654fdfb72ef641573bbf5b0f73f638f2e Mon Sep 17 00:00:00 2001 From: Maik Goette Date: Sun, 8 Jan 2023 18:35:10 +0100 Subject: [PATCH 10/16] lantiq: fix lzma-loader for Netgear DGN 3500(B) Fixes Uncompressing Kernel Image ... ERROR: LzmaDecode.c, 561 Fixes: #11701 for both 3500(B) Signed-off-by: Maik Goette --- target/linux/lantiq/image/Makefile | 19 ++++++++++++++----- target/linux/lantiq/image/ar9.mk | 4 ++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile index facc3fbe099..9fdb949392a 100644 --- a/target/linux/lantiq/image/Makefile +++ b/target/linux/lantiq/image/Makefile @@ -49,22 +49,31 @@ define Build/fullimage rm $@.tmp endef -define Build/loader-okli-compile +define Build/loader-common rm -rf $@.src $(MAKE) -C lzma-loader \ PKG_BUILD_DIR="$@.src" \ TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \ - PLATFORM="lantiq" \ + BOARD="$(BOARDNAME)" PLATFORM="lantiq" \ LZMA_TEXT_START=0x82000000 \ LOADADDR=0x80002000 \ - FLASH_START=0x10000000 \ - FLASH_OFFS=$(LOADER_FLASH_OFFS) \ - FLASH_MAX=0x0 \ $(1) compile loader.bin mv "$@.bin" "$@" rm -rf $@.src endef +define Build/loader-kernel + $(call Build/loader-common,LOADER_DATA="$@") +endef + +define Build/loader-okli-compile + $(call Build/loader-common, \ + FLASH_START=0x10000000 \ + FLASH_OFFS=$(LOADER_FLASH_OFFS) \ + FLASH_MAX=0x0 \ + ) +endef + define Build/prepend-loader-okli cat "$(KDIR)/loader-$(word 1,$(1)).bin" "$@" >> "$@.new" mv "$@.new" "$@" diff --git a/target/linux/lantiq/image/ar9.mk b/target/linux/lantiq/image/ar9.mk index 43f91d0ee45..5732a3432cb 100644 --- a/target/linux/lantiq/image/ar9.mk +++ b/target/linux/lantiq/image/ar9.mk @@ -90,6 +90,8 @@ define Device/netgear_dgn3500 DEVICE_MODEL := DGN3500 SOC := ar9 IMAGE_SIZE := 16000k + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none + KERNEL_INITRAMFS := $$(KERNEL) IMAGES := \ sysupgrade-na.bin sysupgrade.bin \ factory-na.img factory.img @@ -121,6 +123,8 @@ define Device/netgear_dgn3500b DEVICE_MODEL := DGN3500B SOC := ar9 IMAGE_SIZE := 16000k + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none + KERNEL_INITRAMFS := $$(KERNEL) IMAGES += factory.img IMAGE/sysupgrade.bin := \ append-kernel | append-rootfs | dgn3500-sercom-footer 0x0 "DE" | \ From 658b45ce48d2e96c3bca20343272465e295ccb92 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 3 Apr 2023 00:06:46 +0100 Subject: [PATCH 11/16] generic: add quirk for HG MXPD-483II 2500M fiber SFP The HG MXPD-483II 1310nm SFP module is meant to operate with 2500Base-X, however, in their EEPROM they incorrectly specify: Transceiver type : Ethernet: 1000BASE-LX ... BR, Nominal : 2600MBd Use sfp_quirk_2500basex for this module to allow 2500Base-X mode anyway. https://forum.banana-pi.org/t/bpi-r3-sfp-module-compatibility/14573/60 X-Patchwork-Id: 13197378 X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Reported-by: chowtom Tested-by: chowtom Signed-off-by: Daniel Golle --- .../hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch | 6 +++--- .../701-net-sfp-add-quirk-for-MXPD-483II.patch | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 target/linux/generic/pending-5.15/701-net-sfp-add-quirk-for-MXPD-483II.patch diff --git a/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch b/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch index 83b2c304e2d..8ad43c0fe90 100644 --- a/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch +++ b/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch @@ -26,7 +26,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -373,6 +373,11 @@ static const struct sfp_quirk sfp_quirks +@@ -377,6 +377,11 @@ static const struct sfp_quirk sfp_quirks .modes = sfp_quirk_2500basex, .fixup = sfp_fixup_ignore_tx_fault, }, { @@ -38,7 +38,7 @@ Signed-off-by: Daniel Golle // Lantech 8330-262D-E can operate at 2500base-X, but // incorrectly report 2500MBd NRZ in their EEPROM .vendor = "Lantech", -@@ -2306,7 +2311,8 @@ static void sfp_sm_main(struct sfp *sfp, +@@ -2310,7 +2315,8 @@ static void sfp_sm_main(struct sfp *sfp, * or t_start_up, so assume there is a fault. */ sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT, @@ -48,7 +48,7 @@ Signed-off-by: Daniel Golle } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) { init_done: sfp->sm_phy_retries = R_PHY_RETRY; -@@ -2529,10 +2535,12 @@ static void sfp_check_state(struct sfp * +@@ -2533,10 +2539,12 @@ static void sfp_check_state(struct sfp * mutex_lock(&sfp->st_mutex); state = sfp_get_state(sfp); changed = state ^ sfp->state; diff --git a/target/linux/generic/pending-5.15/701-net-sfp-add-quirk-for-MXPD-483II.patch b/target/linux/generic/pending-5.15/701-net-sfp-add-quirk-for-MXPD-483II.patch new file mode 100644 index 00000000000..86a665fd0a3 --- /dev/null +++ b/target/linux/generic/pending-5.15/701-net-sfp-add-quirk-for-MXPD-483II.patch @@ -0,0 +1,13 @@ +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -366,6 +366,10 @@ static const struct sfp_quirk sfp_quirks + .part = "HL-GSFP", + .fixup = sfp_fixup_halny_gsfp, + }, { ++ .vendor = "HG GENUINE", ++ .part = "MXPD-483II", ++ .modes = sfp_quirk_2500basex, ++ }, { + // Huawei MA5671A can operate at 2500base-X, but report 1.2GBd + // NRZ in their EEPROM + .vendor = "HUAWEI", From f003217ddfa1e3400b6b813410c8dd4aedf5d92a Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 3 Apr 2023 03:06:45 +0200 Subject: [PATCH 12/16] Revert "mpc85xx: remove Watchguard T10 MAC override" This reverts commit aa4a9058fbf4d2ca7ef3af9ebb5bbec896625e93. The assumption the bootloader fills out the MAC-address is not correct. The MAC-address has to be set from userspace based on information found in the device_id partition. Signed-off-by: David Bauer --- .../linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh index 462a9e9dd8e..0d9058420b7 100644 --- a/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh @@ -7,6 +7,11 @@ preinit_set_mac_address() { ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr) ip link set dev eth1 address $(mtd_get_mac_ascii cfg1 eth1addr) ;; + watchguard,firebox-t10) + ip link set dev eth0 address "$(mtd_get_mac_text "device_id" 0x1830)" + ip link set dev eth1 address "$(mtd_get_mac_text "device_id" 0x1844)" + ip link set dev eth2 address "$(mtd_get_mac_text "device_id" 0x1858)" + ;; esac } From 5a8741aee9dcc9bbd0c2fb847f1fa31f8998fc0f Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 3 Apr 2023 02:29:17 +0100 Subject: [PATCH 13/16] realtek: refresh patches Refresh patches which were no longer applying cleanly after a recently added SFP quirk. Fixes: 658b45ce48 ("generic: add quirk for HG MXPD-483II 2500M fiber SFP") Signed-off-by: Daniel Golle --- .../710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch | 2 +- .../patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch b/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch index b269f7e1040..3a21dff079a 100644 --- a/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch +++ b/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch @@ -10,7 +10,7 @@ Signed-off-by: Antoine Tenart --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -2147,6 +2147,13 @@ static void sfp_sm_module(struct sfp *sf +@@ -2151,6 +2151,13 @@ static void sfp_sm_module(struct sfp *sf return; } diff --git a/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch b/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch index 1f0b74a17c9..ed5b26ae6f0 100644 --- a/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch +++ b/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch @@ -10,7 +10,7 @@ Signed-off-by: Antoine Tenart --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -539,32 +539,72 @@ static int sfp_i2c_write(struct sfp *sfp +@@ -543,32 +543,72 @@ static int sfp_i2c_write(struct sfp *sfp return ret == ARRAY_SIZE(msgs) ? len : 0; } From db37999170639e03ccaa303a59055b629f812327 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Wed, 8 Feb 2023 23:40:02 +0800 Subject: [PATCH 14/16] generic: interface mode switch for RTL8221B PHY Add dynamic interface mode update for the rtl8221 phy to match various wire speeds. 10M/100M/1000M use SGMII, 2500M uses 2500Base-X. Signed-off-by: Chukun Pan Signed-off-by: Daniel Golle --- ...support-switching-between-SGMII-and-.patch | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 target/linux/generic/pending-5.15/722-net-phy-realtek-support-switching-between-SGMII-and-.patch diff --git a/target/linux/generic/pending-5.15/722-net-phy-realtek-support-switching-between-SGMII-and-.patch b/target/linux/generic/pending-5.15/722-net-phy-realtek-support-switching-between-SGMII-and-.patch new file mode 100644 index 00000000000..f4e87f52de3 --- /dev/null +++ b/target/linux/generic/pending-5.15/722-net-phy-realtek-support-switching-between-SGMII-and-.patch @@ -0,0 +1,61 @@ +From 312753d0aadba0f58841ae513b80fdbabc887523 Mon Sep 17 00:00:00 2001 +From: Chukun Pan +Date: Wed, 8 Feb 2023 16:32:18 +0800 +Subject: [PATCH] net: phy: realtek: support switching between SGMII and + 2500BASE-X for RTL822x series + +After commit ace6aba ("net: phy: realtek: rtl8221: allow to configure +SERDES mode"), the rtl8221 phy can work in SGMII and 2500base-x modes +respectively. So add interface automatic switching for rtl8221 phy to +match various wire speeds. + +Signed-off-by: Chukun Pan +--- + drivers/net/phy/realtek.c | 26 ++++++++++++++++++++++++-- + 1 file changed, 24 insertions(+), 2 deletions(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -676,6 +676,25 @@ static int rtl822x_config_aneg(struct ph + return __genphy_config_aneg(phydev, ret); + } + ++static void rtl822x_update_interface(struct phy_device *phydev) ++{ ++ /* Automatically switch SERDES interface between ++ * SGMII and 2500-BaseX according to speed. ++ */ ++ switch (phydev->speed) { ++ case SPEED_2500: ++ phydev->interface = PHY_INTERFACE_MODE_2500BASEX; ++ break; ++ case SPEED_1000: ++ case SPEED_100: ++ case SPEED_10: ++ phydev->interface = PHY_INTERFACE_MODE_SGMII; ++ break; ++ default: ++ break; ++ } ++} ++ + static int rtl822x_read_status(struct phy_device *phydev) + { + int ret; +@@ -694,11 +713,14 @@ static int rtl822x_read_status(struct ph + phydev->lp_advertising, lpadv & RTL_LPADV_2500FULL); + } + +- ret = genphy_read_status(phydev); ++ ret = rtlgen_read_status(phydev); + if (ret < 0) + return ret; + +- return rtlgen_get_speed(phydev); ++ if (phydev->link) ++ rtl822x_update_interface(phydev); ++ ++ return 0; + } + + static bool rtlgen_supports_2_5gbps(struct phy_device *phydev) From 7e3284eef7f6d2bf270941fc0a94c95307db1ca5 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 3 Apr 2023 01:20:28 +0300 Subject: [PATCH 15/16] generic: use genphy_soft_reset for RealTek 2.5G PHYs Some vendor bootloaders do weird things with those PHYs which result in link modes being reported wrongly. Start from a clean sheet by resetting the PHY. Reported-by: Yevhen Kolomeiko Signed-off-by: Daniel Golle --- ...-use-genphy_soft_reset-for-2.5G-PHYs.patch | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 target/linux/generic/pending-5.15/724-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch diff --git a/target/linux/generic/pending-5.15/724-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch b/target/linux/generic/pending-5.15/724-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch new file mode 100644 index 00000000000..c8032788354 --- /dev/null +++ b/target/linux/generic/pending-5.15/724-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch @@ -0,0 +1,65 @@ +From 85cd45580f5e3b26068cccb7d6173f200e754dc0 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sun, 2 Apr 2023 23:56:16 +0100 +Subject: [PATCH 1/2] net: phy: realtek: use genphy_soft_reset for 2.5G PHYs + +Some vendor bootloaders do weird things with those PHYs which result in +link modes being reported wrongly. Start from a clean sheet by resetting +the PHY. + +Reported-by: Yevhen Kolomeiko +Signed-off-by: Daniel Golle +--- + drivers/net/phy/realtek.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -1013,6 +1013,7 @@ static struct phy_driver realtek_drvs[] + .write_page = rtl821x_write_page, + .read_mmd = rtl822x_read_mmd, + .write_mmd = rtl822x_write_mmd, ++ .soft_reset = genphy_soft_reset, + }, { + PHY_ID_MATCH_EXACT(0x001cc840), + .name = "RTL8226B_RTL8221B 2.5Gbps PHY", +@@ -1025,6 +1026,7 @@ static struct phy_driver realtek_drvs[] + .write_page = rtl821x_write_page, + .read_mmd = rtl822x_read_mmd, + .write_mmd = rtl822x_write_mmd, ++ .soft_reset = genphy_soft_reset, + }, { + PHY_ID_MATCH_EXACT(0x001cc838), + .name = "RTL8226-CG 2.5Gbps PHY", +@@ -1035,6 +1037,7 @@ static struct phy_driver realtek_drvs[] + .resume = rtlgen_resume, + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, ++ .soft_reset = genphy_soft_reset, + }, { + PHY_ID_MATCH_EXACT(0x001cc848), + .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", +@@ -1045,6 +1048,7 @@ static struct phy_driver realtek_drvs[] + .resume = rtlgen_resume, + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, ++ .soft_reset = genphy_soft_reset, + }, { + PHY_ID_MATCH_EXACT(0x001cc849), + .name = "RTL8221B-VB-CG 2.5Gbps PHY", +@@ -1056,6 +1060,7 @@ static struct phy_driver realtek_drvs[] + .resume = rtlgen_resume, + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, ++ .soft_reset = genphy_soft_reset, + }, { + PHY_ID_MATCH_EXACT(0x001cc84a), + .name = "RTL8221B-VM-CG 2.5Gbps PHY", +@@ -1067,6 +1072,7 @@ static struct phy_driver realtek_drvs[] + .resume = rtlgen_resume, + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, ++ .soft_reset = genphy_soft_reset, + }, { + PHY_ID_MATCH_EXACT(0x001cc961), + .name = "RTL8366RB Gigabit Ethernet", From d98c8fc06ddd36f4b47c0eef8094e68257b92f87 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 3 Apr 2023 01:21:57 +0300 Subject: [PATCH 16/16] generic: disable SGMII in-band AN for RealTek 2.5G PHYs MAC drivers don't use SGMII in-band autonegotiation unless told to do so in device tree using 'managed = "in-band-status"'. When using MDIO to access a PHY, in-band-status is unneeded as we have link-status via MDIO. Switch off SGMII in-band autonegotiation using magic values. Reported-by: Chen Minqiang Reported-by: Chukun Pan Reported-by: Yevhen Kolomeiko Tested-by: Yevhen Kolomeiko Signed-off-by: Daniel Golle --- ...sable-SGMII-in-band-AN-for-2-5G-PHYs.patch | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 target/linux/generic/pending-5.15/725-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch diff --git a/target/linux/generic/pending-5.15/725-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch b/target/linux/generic/pending-5.15/725-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch new file mode 100644 index 00000000000..7f2174e4d2b --- /dev/null +++ b/target/linux/generic/pending-5.15/725-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch @@ -0,0 +1,43 @@ +From 2b1b8c4c215af7988136401c902338d091d408a1 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 01:21:57 +0300 +Subject: [PATCH 2/2] net: phy: realtek: disable SGMII in-band AN for 2.5G PHYs + +MAC drivers don't use SGMII in-band autonegotiation unless told to do so +in device tree using 'managed = "in-band-status"'. When using MDIO to +access a PHY, in-band-status is unneeded as we have link-status via +MDIO. Switch off SGMII in-band autonegotiation using magic values. + +Reported-by: Chen Minqiang +Reported-by: Chukun Pan +Reported-by: Yevhen Kolomeiko +Tested-by: Yevhen Kolomeiko +Signed-off-by: Daniel Golle +--- + drivers/net/phy/realtek.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -875,6 +875,7 @@ static irqreturn_t rtl9000a_handle_inter + static int rtl8221b_config_init(struct phy_device *phydev) + { + u16 option_mode; ++ int val; + + switch (phydev->interface) { + case PHY_INTERFACE_MODE_SGMII: +@@ -906,6 +907,13 @@ static int rtl8221b_config_init(struct p + break; + } + ++ /* Disable SGMII AN */ ++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7588, 0x2); ++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7589, 0x71d0); ++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7587, 0x3); ++ phy_read_mmd_poll_timeout(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7587, val, ++ !(val & BIT(0)), 500, 100000, false); ++ + return 0; + } +