From 0052daae6044cac4c05e1a7f63cff1ee1c6c5df8 Mon Sep 17 00:00:00 2001 From: Ilya Lipnitskiy Date: Sun, 14 Feb 2021 16:46:23 -0800 Subject: [PATCH 01/25] tools/patchelf: bump to use latest master Recent ABI_VERSION commits make use of patchelf. It was discovered that with patchelf 0.10(and even 0.12) various big endian targets fail to link against libubox SO that was processed through patchelf. Using latest master patchelf fixes those link errors. Potential commits affecting big-endian processing https://github.com/NixOS/patchelf/commit/884eccc4f061a3dbdbe63a4c73f1cc9bbf77fa7d https://github.com/NixOS/patchelf/commit/d148bae6c1291b93d660a156a1756670069cd8cc Recent builds with failures: http://buildbot.openwrt.org/master/images/builders/lantiq%2Fxrx200/builds/682 http://buildbot.openwrt.org/master/images/builders/ath79%2Fmikrotik/builds/449 Cc: Hauke Mehrtens Signed-off-by: Ilya Lipnitskiy Signed-off-by: Felix Fietkau --- tools/patchelf/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/patchelf/Makefile b/tools/patchelf/Makefile index 1b54fbb611..7c88f8dc45 100644 --- a/tools/patchelf/Makefile +++ b/tools/patchelf/Makefile @@ -7,11 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=patchelf -PKG_VERSION:=0.10 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=http://nixos.org/releases/patchelf/patchelf-$(PKG_VERSION) -PKG_HASH:=f670cd462ac7161588c28f45349bc20fb9bd842805e3f71387a320e7a9ddfcf3 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/NixOS/patchelf.git +PKG_SOURCE_VERSION:=f34751b88bd07d7f44f5cd3200fb4122bf916c7e +PKG_SOURCE_DATE:=2020-12-07 +PKG_MIRROR_HASH:=ac746930b919b97da40f259cfc9ab7bbd48a0c9cbf2eebd8cee5ae19a94356fd HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf From 43dc26af6381f720adf4fe1dd2ea72ff0e45bb40 Mon Sep 17 00:00:00 2001 From: Ilya Lipnitskiy Date: Sat, 13 Feb 2021 20:41:03 -0800 Subject: [PATCH 02/25] fakeroot: fix to work with glibc 2.33 The following commit removed _STAT_VER definitions from glibc: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=8ed005daf0ab03e142500324a34087ce179ae78e That subsequently broke fakeroot: https://bugs.archlinux.org/task/69572 https://bugzilla.redhat.com/show_bug.cgi?id=1889862#c13 https://forum.openwrt.org/t/unable-to-build-toolchain-fakeroot-fails-perhaps-others-after-it/87966 Make the patch based on Jan Pazdziora's suggestion from here: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/SMQ3RYXEYTVZH6PLQMKNB3NM4XLPMNZO/ Add wrappers for newly exported symbols in glibc. Apply patch from Debian to fix warnings in fts_read and fts_children: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=676428 https://sources.debian.org/patches/fakeroot/1.25.3-1.1/eglibc-fts-without-LFS/ Fix __xmknod{,at} dev pointer argument. Switch default to assume * and not the absence of *. On glibc 2.33+, there is no definition for these functions in header files, so the compile test doesn't work. But, we can default to using the pointer (as is the case with newer glibc), and use the header file on older platforms to fail the test and use no pointer. Tested on my x86_64 Arch Linux machine, fakeroot unit tests pass. Also tested by building various .ipks and examining the tar contents, to ensure that the owner uid/gid was 0/0. Signed-off-by: Ilya Lipnitskiy --- .../300-glibc-2.33-compatibility.patch | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 tools/fakeroot/patches/300-glibc-2.33-compatibility.patch diff --git a/tools/fakeroot/patches/300-glibc-2.33-compatibility.patch b/tools/fakeroot/patches/300-glibc-2.33-compatibility.patch new file mode 100644 index 0000000000..a460cace0c --- /dev/null +++ b/tools/fakeroot/patches/300-glibc-2.33-compatibility.patch @@ -0,0 +1,145 @@ +--- a/libfakeroot.c ++++ b/libfakeroot.c +@@ -90,6 +90,16 @@ + #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b) + #endif + ++#ifndef _STAT_VER ++ #if defined (__aarch64__) ++ #define _STAT_VER 0 ++ #elif defined (__x86_64__) ++ #define _STAT_VER 1 ++ #else ++ #define _STAT_VER 3 ++ #endif ++#endif ++ + /* + These INT_* (which stands for internal) macros should always be used when + the fakeroot library owns the storage of the stat variable. +@@ -1358,6 +1368,54 @@ int renameat(int olddir_fd, const char * + #endif /* HAVE_FSTATAT */ + + ++#if defined(__GLIBC__) && __GLIBC_PREREQ(2,33) ++/* Glibc 2.33 exports symbols for these functions in the shared lib */ ++ int lstat(const char *file_name, struct stat *statbuf) { ++ return WRAP_LSTAT LSTAT_ARG(_STAT_VER, file_name, statbuf); ++ } ++ int stat(const char *file_name, struct stat *st) { ++ return WRAP_STAT STAT_ARG(_STAT_VER, file_name, st); ++ } ++ int fstat(int fd, struct stat *st) { ++ return WRAP_FSTAT FSTAT_ARG(_STAT_VER, fd, st); ++ } ++ ++ #ifdef HAVE_FSTATAT ++ int fstatat(int dir_fd, const char *path, struct stat *st, int flags) { ++ return WRAP_FSTATAT FSTATAT_ARG(_STAT_VER, dir_fd, path, st, flags); ++ } ++ #endif ++ ++ #ifdef STAT64_SUPPORT ++ int lstat64(const char *file_name, struct stat64 *st) { ++ return WRAP_LSTAT64 LSTAT64_ARG(_STAT_VER, file_name, st); ++ } ++ int stat64(const char *file_name, struct stat64 *st) { ++ return WRAP_STAT64 STAT64_ARG(_STAT_VER, file_name, st); ++ } ++ int fstat64(int fd, struct stat64 *st) { ++ return WRAP_FSTAT64 FSTAT64_ARG(_STAT_VER, fd, st); ++ } ++ ++ #ifdef HAVE_FSTATAT ++ int fstatat64(int dir_fd, const char *path, struct stat64 *st, int flags) { ++ return WRAP_FSTATAT64 FSTATAT64_ARG(_STAT_VER, dir_fd, path, st, flags); ++ } ++ #endif ++ #endif ++ ++ int mknod(const char *pathname, mode_t mode, dev_t dev) { ++ return WRAP_MKNOD MKNOD_ARG(_STAT_VER, pathname, mode, &dev); ++ } ++ ++ #if defined(HAVE_FSTATAT) && defined(HAVE_MKNODAT) ++ int mknodat(int dir_fd, const char *pathname, mode_t mode, dev_t dev) { ++ return WRAP_MKNODAT MKNODAT_ARG(_STAT_VER, dir_fd, pathname, mode, &dev); ++ } ++ #endif ++#endif /* GLIBC_PREREQ */ ++ ++ + #ifdef FAKEROOT_FAKENET + pid_t fork(void) + { +@@ -2024,11 +2082,7 @@ FTSENT *fts_read(FTS *ftsp) { + || r->fts_info == FTS_NS || r->fts_info == FTS_NSOK)) + r->fts_statp = NULL; /* Otherwise fts_statp may be a random pointer */ + if(r && r->fts_statp) { /* Should we bother checking fts_info here? */ +-# if defined(STAT64_SUPPORT) && !defined(__APPLE__) +- SEND_GET_STAT64(r->fts_statp, _STAT_VER); +-# else + SEND_GET_STAT(r->fts_statp, _STAT_VER); +-# endif + } + + return r; +@@ -2047,11 +2101,7 @@ FTSENT *fts_children(FTS *ftsp, int opti + first=next_fts_children(ftsp, options); + for(r = first; r; r = r->fts_link) { + if(r && r->fts_statp) { /* Should we bother checking fts_info here? */ +-# if defined(STAT64_SUPPORT) && !defined(__APPLE__) +- SEND_GET_STAT64(r->fts_statp, _STAT_VER); +-# else + SEND_GET_STAT(r->fts_statp, _STAT_VER); +-# endif + } + } + +@@ -2483,7 +2533,7 @@ int statx (int dirfd, const char *path, + + #ifdef LIBFAKEROOT_DEBUGGING + if (fakeroot_debug) { +- fprintf(stderr, "statx fd %d\n", fd); ++ fprintf(stderr, "statx fd %d\n", dirfd); + } + #endif /* LIBFAKEROOT_DEBUGGING */ + r=INT_NEXT_FSTATAT(dirfd, path, &st, flags); +--- a/configure.ac ++++ b/configure.ac +@@ -184,13 +184,13 @@ AC_MSG_CHECKING([for type of arg of __xm + ]], [[ + int __xmknod ( int ver, + const char *pathname , +- mode_t mode , dev_t dev); ++ mode_t mode , dev_t *dev); + ]])],[ +- AC_DEFINE(XMKNOD_FRTH_ARG,) +- AC_MSG_RESULT([no extra *]) +- ],[ + AC_DEFINE(XMKNOD_FRTH_ARG,[*]) + AC_MSG_RESULT([needs *]) ++ ],[ ++ AC_DEFINE(XMKNOD_FRTH_ARG,) ++ AC_MSG_RESULT([no extra *]) + + ]) + +@@ -211,13 +211,13 @@ AC_MSG_CHECKING([for type of arg of __xm + int __xmknodat ( int ver, + int dirfd, + const char *pathname , +- mode_t mode , dev_t dev); ++ mode_t mode , dev_t *dev); + ]])],[ +- AC_DEFINE(XMKNODAT_FIFTH_ARG,) +- AC_MSG_RESULT([no extra *]) +- ],[ + AC_DEFINE(XMKNODAT_FIFTH_ARG,[*]) + AC_MSG_RESULT([needs *]) ++ ],[ ++ AC_DEFINE(XMKNODAT_FIFTH_ARG,) ++ AC_MSG_RESULT([no extra *]) + + ]) + From a933c26852b8d79f3c60a44701fb25542156e3e1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 12 Feb 2021 10:10:41 +0100 Subject: [PATCH 03/25] libubox: use PKG_ABI_VERSION Signed-off-by: Felix Fietkau --- package/libs/libubox/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index d9c239a50d..19d9145509 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -8,6 +8,7 @@ PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255 PKG_SOURCE_DATE:=2020-12-12 PKG_SOURCE_VERSION:=357877693ca363b12e6e7e14d345639b2440cd07 +PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 PKG_LICENSE:=ISC @@ -27,7 +28,7 @@ define Package/libubox SECTION:=libs CATEGORY:=Libraries TITLE:=Basic utility library - ABI_VERSION:=20201212 + ABI_VERSION:=$(PKG_ABI_VERSION) DEPENDS:= endef @@ -35,6 +36,7 @@ define Package/libblobmsg-json SECTION:=libs CATEGORY:=Libraries TITLE:=blobmsg <-> json conversion library + ABI_VERSION:=$(PKG_ABI_VERSION) DEPENDS:=+libjson-c +libubox endef @@ -53,6 +55,7 @@ define Package/libjson-script SECTION:=utils CATEGORY:=Utilities DEPENDS:=+libubox + ABI_VERSION:=$(PKG_ABI_VERSION) TITLE:=Minimalistic JSON based scripting engine endef From f378d81da6d1976ba3d304932cda4ff0cdd5f182 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 12 Feb 2021 11:36:47 +0100 Subject: [PATCH 04/25] wolfssl: use dynamic ABI_VERSION depending on the configuration and package version Signed-off-by: Felix Fietkau --- package/libs/wolfssl/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index ff01fca663..51dc4d5a09 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -33,6 +33,8 @@ PKG_CONFIG_DEPENDS:=\ CONFIG_WOLFSSL_HAS_SESSION_TICKET CONFIG_WOLFSSL_HAS_TLSV10 \ CONFIG_WOLFSSL_HAS_TLSV13 CONFIG_WOLFSSL_HAS_WPAS CONFIG_WOLFSSL_HAS_CERTGEN +PKG_ABI_VERSION=$(patsubst %-stable,%,$(PKG_VERSION)).$(call version_abbrev,$(call confvar,$(PKG_CONFIG_DEPENDS))) + include $(INCLUDE_DIR)/package.mk define Package/libwolfssl @@ -44,7 +46,7 @@ define Package/libwolfssl MENU:=1 PROVIDES:=libcyassl DEPENDS:=+WOLFSSL_HAS_DEVCRYPTO:kmod-cryptodev +WOLFSSL_HAS_AFALG:kmod-crypto-user - ABI_VERSION:=24 + ABI_VERSION:=$(PKG_ABI_VERSION) endef define Package/libwolfssl/description From 3da4acaa7bba185489b968a140ecf327169db0bd Mon Sep 17 00:00:00 2001 From: Ilya Lipnitskiy Date: Sun, 7 Feb 2021 20:17:12 -0800 Subject: [PATCH 05/25] kernel: fix busy wait loop in mediatek PPE code The intention is for the loop to timeout if the body does not succeed. The current logic calls time_is_before_jiffies(timeout) which is false until after the timeout, so the loop body never executes. time_is_after_jiffies(timeout) will return true until timeout is less than jiffies, which is the intended behavior here. Signed-off-by: Ilya Lipnitskiy --- ...5-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch b/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch index d679e30bea..2614502f5a 100644 --- a/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch +++ b/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch @@ -183,7 +183,7 @@ Signed-off-by: Felix Fietkau +{ + unsigned long timeout = jiffies + HZ; + -+ while (time_is_before_jiffies(timeout)) { ++ while (time_is_after_jiffies(timeout)) { + if (!(ppe_r32(ppe, MTK_PPE_GLO_CFG) & MTK_PPE_GLO_CFG_BUSY)) + return 0; + From ac7d45b5e783fdd4ca35fe53a0921d8972f3f53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 15 Feb 2021 11:47:17 +0100 Subject: [PATCH 06/25] kernel: backport "ofpart" mtd parser upstream quirks support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds quirks support to the "ofpart" parser. It's required to support fixed partitions that require some extra logic. Right now only BCM4908 binding is supported (BCM4908 requires detecting currently used "firmware" partition). Signed-off-by: Rafał Miłecki --- ...ove-partition-binding-to-its-own-fi.patch} | 8 ++-- ...-add-binding-for-BCM4908-partitions.patch} | 35 ++++++++-------- ...rt-support-BCM4908-fixed-partitions.patch} | 19 +++++---- ...arsers-ofpart-fix-building-as-module.patch | 40 +++++++++++++++++++ ...30-mtd-add-myloader-partition-parser.patch | 2 +- ...mtd-add-routerbootpart-parser-config.patch | 2 +- 6 files changed, 77 insertions(+), 29 deletions(-) rename target/linux/{bcm4908/patches-5.4/140-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch => generic/backport-5.4/402-v5.12-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch} (92%) rename target/linux/{bcm4908/patches-5.4/140-0002-dt-bindings-mtd-add-binding-from-BCM4908-partitions.patch => generic/backport-5.4/402-v5.12-0002-dt-bindings-mtd-add-binding-for-BCM4908-partitions.patch} (73%) rename target/linux/{bcm4908/patches-5.4/140-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch => generic/backport-5.4/402-v5.12-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch} (91%) create mode 100644 target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch diff --git a/target/linux/bcm4908/patches-5.4/140-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch b/target/linux/generic/backport-5.4/402-v5.12-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch similarity index 92% rename from target/linux/bcm4908/patches-5.4/140-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch rename to target/linux/generic/backport-5.4/402-v5.12-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch index 1ad61d89f9..f3b1179ecd 100644 --- a/target/linux/bcm4908/patches-5.4/140-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch +++ b/target/linux/generic/backport-5.4/402-v5.12-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch @@ -1,7 +1,7 @@ -From 4fdbaa5a3dbe761b231c13feaa53242aae3306cc Mon Sep 17 00:00:00 2001 +From 6418522022c706fd867b00b2571edba48b8fa8c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 15 Jan 2021 15:23:02 +0100 -Subject: [PATCH 1/3] dt-bindings: mtd: move partition binding to its own file +Date: Thu, 11 Feb 2021 23:04:25 +0100 +Subject: [PATCH] dt-bindings: mtd: move partition binding to its own file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -13,6 +13,8 @@ Single partition binding is quite common and may be: Move it to separated file to avoid code duplication. Signed-off-by: Rafał Miłecki +Reviewed-by: Rob Herring +Signed-off-by: Richard Weinberger --- .../mtd/partitions/fixed-partitions.yaml | 33 +------------ .../bindings/mtd/partitions/partition.yaml | 47 +++++++++++++++++++ diff --git a/target/linux/bcm4908/patches-5.4/140-0002-dt-bindings-mtd-add-binding-from-BCM4908-partitions.patch b/target/linux/generic/backport-5.4/402-v5.12-0002-dt-bindings-mtd-add-binding-for-BCM4908-partitions.patch similarity index 73% rename from target/linux/bcm4908/patches-5.4/140-0002-dt-bindings-mtd-add-binding-from-BCM4908-partitions.patch rename to target/linux/generic/backport-5.4/402-v5.12-0002-dt-bindings-mtd-add-binding-for-BCM4908-partitions.patch index 4967e6c1e3..8576c7d78d 100644 --- a/target/linux/bcm4908/patches-5.4/140-0002-dt-bindings-mtd-add-binding-from-BCM4908-partitions.patch +++ b/target/linux/generic/backport-5.4/402-v5.12-0002-dt-bindings-mtd-add-binding-for-BCM4908-partitions.patch @@ -1,24 +1,25 @@ -From 4f740351484e88bcea3776578288b6ec400829c8 Mon Sep 17 00:00:00 2001 +From 6e9dff6fe3fbc452f16566e4a7e293b0decefdba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 15 Jan 2021 16:01:04 +0100 -Subject: [PATCH 2/3] dt-bindings: mtd: add binding from BCM4908 partitions +Date: Thu, 11 Feb 2021 23:04:26 +0100 +Subject: [PATCH] dt-bindings: mtd: add binding for BCM4908 partitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BCM4908 uses fixed partitions layout but function of some partitions may -vary. Some devices use multiple firmware partitions and those should be -marked to let system discover their purpose. +vary. Some devices use multiple firmware partitions and those partitions +should be marked to let system discover their purpose. Signed-off-by: Rafał Miłecki +Signed-off-by: Richard Weinberger --- - .../partitions/brcm,bcm4908-partitions.yaml | 68 +++++++++++++++++++ - 1 file changed, 68 insertions(+) + .../partitions/brcm,bcm4908-partitions.yaml | 70 +++++++++++++++++++ + 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml -@@ -0,0 +1,68 @@ +@@ -0,0 +1,70 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- @@ -42,17 +43,19 @@ Signed-off-by: Rafał Miłecki + compatible: + const: brcm,bcm4908-partitions + -+ "#address-cells": true ++ "#address-cells": ++ enum: [ 1, 2 ] + -+ "#size-cells": true ++ "#size-cells": ++ enum: [ 1, 2 ] + +patternProperties: -+ "@[0-9a-f]+$": -+ allOf: -+ - $ref: "partition.yaml#" -+ - properties: -+ compatible: -+ const: brcm,bcm4908-firmware ++ "^partition@[0-9a-f]+$": ++ $ref: "partition.yaml#" ++ properties: ++ compatible: ++ const: brcm,bcm4908-firmware ++ unevaluatedProperties: false + +required: + - "#address-cells" diff --git a/target/linux/bcm4908/patches-5.4/140-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch b/target/linux/generic/backport-5.4/402-v5.12-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch similarity index 91% rename from target/linux/bcm4908/patches-5.4/140-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch rename to target/linux/generic/backport-5.4/402-v5.12-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch index 689807d48e..340091fab9 100644 --- a/target/linux/bcm4908/patches-5.4/140-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch +++ b/target/linux/generic/backport-5.4/402-v5.12-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch @@ -1,7 +1,7 @@ -From db18357719613cc40234300b10e28e4dfa075375 Mon Sep 17 00:00:00 2001 +From 09cf6ee6d21cd9ef2eb857ccb24305cf51166792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 15 Jan 2021 16:23:01 +0100 -Subject: [PATCH 3/3] mtd: parsers: ofpart: support BCM4908 fixed partitions +Date: Thu, 11 Feb 2021 23:04:27 +0100 +Subject: [PATCH] mtd: parsers: ofpart: support BCM4908 fixed partitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -18,20 +18,21 @@ partition from the DT. Bootloader specifies it using the "brcm_blparms" property. Signed-off-by: Rafał Miłecki +Signed-off-by: Richard Weinberger --- drivers/mtd/parsers/Makefile | 1 + - drivers/mtd/parsers/bcm4908-partitions.c | 62 ++++++++++++++++++++++++ + drivers/mtd/parsers/bcm4908-partitions.c | 64 ++++++++++++++++++++++++ drivers/mtd/parsers/bcm4908-partitions.h | 7 +++ drivers/mtd/parsers/ofpart.c | 28 ++++++++++- - 4 files changed, 96 insertions(+), 2 deletions(-) + 4 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 drivers/mtd/parsers/bcm4908-partitions.c create mode 100644 drivers/mtd/parsers/bcm4908-partitions.h --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -5,6 +5,7 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm6 +@@ -4,6 +4,7 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm4 + obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o +obj-$(CONFIG_MTD_OF_PARTS) += bcm4908-partitions.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o @@ -39,7 +40,7 @@ Signed-off-by: Rafał Miłecki obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o --- /dev/null +++ b/drivers/mtd/parsers/bcm4908-partitions.c -@@ -0,0 +1,62 @@ +@@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021 Rafał Miłecki @@ -52,6 +53,8 @@ Signed-off-by: Rafał Miłecki +#include +#include + ++#include "bcm4908-partitions.h" ++ +#define BLPARAMS_FW_OFFSET "NAND_RFS_OFS" + +static long long bcm4908_partitions_fw_offset(void) diff --git a/target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch b/target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch new file mode 100644 index 0000000000..47223098ec --- /dev/null +++ b/target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch @@ -0,0 +1,40 @@ +From bc6dcf44da2bea215ae3edbdac5d350e96de3996 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 15 Feb 2021 08:28:44 +0100 +Subject: [PATCH] mtd: parsers: ofpart: fix building as module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes: +ERROR: modpost: missing MODULE_LICENSE() in drivers/mtd/parsers/bcm4908-partitions.o +ERROR: modpost: "bcm4908_partitions_post_parse" [drivers/mtd/parsers/ofpart.ko] undefined! + +Reported-by: Stephen Rothwell +Fixes: 09cf6ee6d21c ("mtd: parsers: ofpart: support BCM4908 fixed partitions") +Signed-off-by: Rafał Miłecki +Signed-off-by: Richard Weinberger +--- + drivers/mtd/parsers/Makefile | 2 +- + drivers/mtd/parsers/bcm4908-partitions.c | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -4,7 +4,7 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm4 + obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o + obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o + obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o +-obj-$(CONFIG_MTD_OF_PARTS) += bcm4908-partitions.o ++ofpart-objs := bcm4908-partitions.o + obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o + obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o +--- a/drivers/mtd/parsers/bcm4908-partitions.c ++++ b/drivers/mtd/parsers/bcm4908-partitions.c +@@ -62,3 +62,5 @@ int bcm4908_partitions_post_parse(struct + + return 0; + } ++ ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch index 9600dfc67a..fc99996674 100644 --- a/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch +++ b/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch @@ -41,8 +41,8 @@ Signed-off-by: Adrian Schmutzler obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o +obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o + ofpart-objs := bcm4908-partitions.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o - obj-$(CONFIG_MTD_AFS_PARTS) += afs.o --- /dev/null +++ b/drivers/mtd/parsers/myloader.c @@ -0,0 +1,181 @@ diff --git a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch index 1523e757c7..ed7eb6e989 100644 --- a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch +++ b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch @@ -31,7 +31,7 @@ Signed-off-by: Thibaut VARÈNE + formatted DTS. --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -10,3 +10,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o +@@ -11,3 +11,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o From 09fbc79bf6dc6365018944e1e0629b5f1c921790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 15 Feb 2021 15:05:52 +0100 Subject: [PATCH 07/25] kernel: drop ofpart patch dropped from upstream mtd tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It stopped ofpart_parser_init() from being called Signed-off-by: Rafał Miłecki --- target/linux/bcm4908/config-5.4 | 1 + ...art-support-BCM4908-fixed-partitions.patch | 650 ++++++++++++++++++ ...art-support-BCM4908-fixed-partitions.patch | 194 ------ ...arsers-ofpart-fix-building-as-module.patch | 40 -- ...30-mtd-add-myloader-partition-parser.patch | 2 +- ...mtd-add-routerbootpart-parser-config.patch | 2 +- 6 files changed, 653 insertions(+), 236 deletions(-) create mode 100644 target/linux/bcm4908/patches-5.4/400-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch delete mode 100644 target/linux/generic/backport-5.4/402-v5.12-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch delete mode 100644 target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch diff --git a/target/linux/bcm4908/config-5.4 b/target/linux/bcm4908/config-5.4 index a3cca74c76..47529fc958 100644 --- a/target/linux/bcm4908/config-5.4 +++ b/target/linux/bcm4908/config-5.4 @@ -138,6 +138,7 @@ CONFIG_MODULES_USE_ELF_RELA=y CONFIG_MTD_NAND_BRCMNAND=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y +CONFIG_MTD_OF_PARTS_BCM4908=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_SPLIT_CFE_BOOTFS=y # CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set diff --git a/target/linux/bcm4908/patches-5.4/400-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch b/target/linux/bcm4908/patches-5.4/400-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch new file mode 100644 index 0000000000..ace0c77c09 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/400-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch @@ -0,0 +1,650 @@ +From 3924b0384a0cd20245e2ffb55c45c2ace737a061 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 11 Feb 2021 23:04:27 +0100 +Subject: [PATCH] mtd: parsers: ofpart: support BCM4908 fixed partitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some devices use fixed partitioning with some partitions requiring some +extra logic. E.g. BCM4908 may have multiple firmware partitions but +detecting currently used one requires checking bootloader parameters. + +To support such cases without duplicating a lot of code (without copying +most of the ofpart.c code) support for post-parsing callback was added. + +BCM4908 support in ofpart can be enabled using config option and results +in compiling & executing a specific callback. It simply reads offset of +currently used firmware partition from the DT. Bootloader specifies it +using the "brcm_blparms" property. + +Signed-off-by: Rafał Miłecki +--- + drivers/mtd/parsers/Kconfig | 9 +++ + drivers/mtd/parsers/Makefile | 2 + + drivers/mtd/parsers/ofpart_bcm4908.c | 66 +++++++++++++++++++ + drivers/mtd/parsers/ofpart_bcm4908.h | 15 +++++ + .../mtd/parsers/{ofpart.c => ofpart_core.c} | 28 +++++++- + 5 files changed, 118 insertions(+), 2 deletions(-) + create mode 100644 drivers/mtd/parsers/ofpart_bcm4908.c + create mode 100644 drivers/mtd/parsers/ofpart_bcm4908.h + rename drivers/mtd/parsers/{ofpart.c => ofpart_core.c} (88%) + +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -83,6 +83,15 @@ config MTD_OF_PARTS + flash memory node, as described in + Documentation/devicetree/bindings/mtd/partition.txt. + ++config MTD_OF_PARTS_BCM4908 ++ bool "BCM4908 partitioning support" ++ depends on MTD_OF_PARTS && (ARCH_BCM4908 || COMPILE_TEST) ++ default ARCH_BCM4908 ++ help ++ This provides partitions parser for BCM4908 family devices ++ that can have multiple "firmware" partitions. It takes care of ++ finding currently used one and backup ones. ++ + config MTD_PARSER_IMAGETAG + tristate "Parser for BCM963XX Image Tag format partitions" + depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -5,6 +5,8 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm6 + obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o + obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o + obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o ++ofpart-y += ofpart_core.o ++ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o + obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o + obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o +--- /dev/null ++++ b/drivers/mtd/parsers/ofpart_bcm4908.c +@@ -0,0 +1,66 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2021 Rafał Miłecki ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "ofpart_bcm4908.h" ++ ++#define BLPARAMS_FW_OFFSET "NAND_RFS_OFS" ++ ++static long long bcm4908_partitions_fw_offset(void) ++{ ++ struct device_node *root; ++ struct property *prop; ++ const char *s; ++ ++ root = of_find_node_by_path("/"); ++ if (!root) ++ return -ENOENT; ++ ++ of_property_for_each_string(root, "brcm_blparms", prop, s) { ++ size_t len = strlen(BLPARAMS_FW_OFFSET); ++ unsigned long offset; ++ int err; ++ ++ if (strncmp(s, BLPARAMS_FW_OFFSET, len) || s[len] != '=') ++ continue; ++ ++ err = kstrtoul(s + len + 1, 0, &offset); ++ if (err) { ++ pr_err("failed to parse %s\n", s + len + 1); ++ return err; ++ } ++ ++ return offset << 10; ++ } ++ ++ return -ENOENT; ++} ++ ++int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts) ++{ ++ long long fw_offset; ++ int i; ++ ++ fw_offset = bcm4908_partitions_fw_offset(); ++ ++ for (i = 0; i < nr_parts; i++) { ++ if (of_device_is_compatible(parts[i].of_node, "brcm,bcm4908-firmware")) { ++ if (fw_offset < 0 || parts[i].offset == fw_offset) ++ parts[i].name = "firmware"; ++ else ++ parts[i].name = "backup"; ++ } ++ } ++ ++ return 0; ++} ++ ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/drivers/mtd/parsers/ofpart_bcm4908.h +@@ -0,0 +1,15 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef __BCM4908_PARTITIONS_H ++#define __BCM4908_PARTITIONS_H ++ ++#ifdef CONFIG_MTD_OF_PARTS_BCM4908 ++int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); ++#else ++static inline int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, ++ int nr_parts) ++{ ++ return -EOPNOTSUPP; ++} ++#endif ++ ++#endif +--- a/drivers/mtd/parsers/ofpart.c ++++ /dev/null +@@ -1,236 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-or-later +-/* +- * Flash partitions described by the OF (or flattened) device tree +- * +- * Copyright © 2006 MontaVista Software Inc. +- * Author: Vitaly Wool +- * +- * Revised to handle newer style flash binding by: +- * Copyright © 2007 David Gibson, IBM Corporation. +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-static bool node_has_compatible(struct device_node *pp) +-{ +- return of_get_property(pp, "compatible", NULL); +-} +- +-static int parse_fixed_partitions(struct mtd_info *master, +- const struct mtd_partition **pparts, +- struct mtd_part_parser_data *data) +-{ +- struct mtd_partition *parts; +- struct device_node *mtd_node; +- struct device_node *ofpart_node; +- const char *partname; +- struct device_node *pp; +- int nr_parts, i, ret = 0; +- bool dedicated = true; +- +- +- /* Pull of_node from the master device node */ +- mtd_node = mtd_get_of_node(master); +- if (!mtd_node) +- return 0; +- +- ofpart_node = of_get_child_by_name(mtd_node, "partitions"); +- if (!ofpart_node) { +- /* +- * We might get here even when ofpart isn't used at all (e.g., +- * when using another parser), so don't be louder than +- * KERN_DEBUG +- */ +- pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n", +- master->name, mtd_node); +- ofpart_node = mtd_node; +- dedicated = false; +- } else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) { +- /* The 'partitions' subnode might be used by another parser */ +- return 0; +- } +- +- /* First count the subnodes */ +- nr_parts = 0; +- for_each_child_of_node(ofpart_node, pp) { +- if (!dedicated && node_has_compatible(pp)) +- continue; +- +- nr_parts++; +- } +- +- if (nr_parts == 0) +- return 0; +- +- parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); +- if (!parts) +- return -ENOMEM; +- +- i = 0; +- for_each_child_of_node(ofpart_node, pp) { +- const __be32 *reg; +- int len; +- int a_cells, s_cells; +- +- if (!dedicated && node_has_compatible(pp)) +- continue; +- +- reg = of_get_property(pp, "reg", &len); +- if (!reg) { +- if (dedicated) { +- pr_debug("%s: ofpart partition %pOF (%pOF) missing reg property.\n", +- master->name, pp, +- mtd_node); +- goto ofpart_fail; +- } else { +- nr_parts--; +- continue; +- } +- } +- +- a_cells = of_n_addr_cells(pp); +- s_cells = of_n_size_cells(pp); +- if (len / 4 != a_cells + s_cells) { +- pr_debug("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n", +- master->name, pp, +- mtd_node); +- goto ofpart_fail; +- } +- +- parts[i].offset = of_read_number(reg, a_cells); +- parts[i].size = of_read_number(reg + a_cells, s_cells); +- parts[i].of_node = pp; +- +- partname = of_get_property(pp, "label", &len); +- if (!partname) +- partname = of_get_property(pp, "name", &len); +- parts[i].name = partname; +- +- if (of_get_property(pp, "read-only", &len)) +- parts[i].mask_flags |= MTD_WRITEABLE; +- +- if (of_get_property(pp, "lock", &len)) +- parts[i].mask_flags |= MTD_POWERUP_LOCK; +- +- i++; +- } +- +- if (!nr_parts) +- goto ofpart_none; +- +- *pparts = parts; +- return nr_parts; +- +-ofpart_fail: +- pr_err("%s: error parsing ofpart partition %pOF (%pOF)\n", +- master->name, pp, mtd_node); +- ret = -EINVAL; +-ofpart_none: +- of_node_put(pp); +- kfree(parts); +- return ret; +-} +- +-static const struct of_device_id parse_ofpart_match_table[] = { +- { .compatible = "fixed-partitions" }, +- {}, +-}; +-MODULE_DEVICE_TABLE(of, parse_ofpart_match_table); +- +-static struct mtd_part_parser ofpart_parser = { +- .parse_fn = parse_fixed_partitions, +- .name = "fixed-partitions", +- .of_match_table = parse_ofpart_match_table, +-}; +- +-static int parse_ofoldpart_partitions(struct mtd_info *master, +- const struct mtd_partition **pparts, +- struct mtd_part_parser_data *data) +-{ +- struct mtd_partition *parts; +- struct device_node *dp; +- int i, plen, nr_parts; +- const struct { +- __be32 offset, len; +- } *part; +- const char *names; +- +- /* Pull of_node from the master device node */ +- dp = mtd_get_of_node(master); +- if (!dp) +- return 0; +- +- part = of_get_property(dp, "partitions", &plen); +- if (!part) +- return 0; /* No partitions found */ +- +- pr_warn("Device tree uses obsolete partition map binding: %pOF\n", dp); +- +- nr_parts = plen / sizeof(part[0]); +- +- parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); +- if (!parts) +- return -ENOMEM; +- +- names = of_get_property(dp, "partition-names", &plen); +- +- for (i = 0; i < nr_parts; i++) { +- parts[i].offset = be32_to_cpu(part->offset); +- parts[i].size = be32_to_cpu(part->len) & ~1; +- /* bit 0 set signifies read only partition */ +- if (be32_to_cpu(part->len) & 1) +- parts[i].mask_flags = MTD_WRITEABLE; +- +- if (names && (plen > 0)) { +- int len = strlen(names) + 1; +- +- parts[i].name = names; +- plen -= len; +- names += len; +- } else { +- parts[i].name = "unnamed"; +- } +- +- part++; +- } +- +- *pparts = parts; +- return nr_parts; +-} +- +-static struct mtd_part_parser ofoldpart_parser = { +- .parse_fn = parse_ofoldpart_partitions, +- .name = "ofoldpart", +-}; +- +-static int __init ofpart_parser_init(void) +-{ +- register_mtd_parser(&ofpart_parser); +- register_mtd_parser(&ofoldpart_parser); +- return 0; +-} +- +-static void __exit ofpart_parser_exit(void) +-{ +- deregister_mtd_parser(&ofpart_parser); +- deregister_mtd_parser(&ofoldpart_parser); +-} +- +-module_init(ofpart_parser_init); +-module_exit(ofpart_parser_exit); +- +-MODULE_LICENSE("GPL"); +-MODULE_DESCRIPTION("Parser for MTD partitioning information in device tree"); +-MODULE_AUTHOR("Vitaly Wool, David Gibson"); +-/* +- * When MTD core cannot find the requested parser, it tries to load the module +- * with the same name. Since we provide the ofoldpart parser, we should have +- * the corresponding alias. +- */ +-MODULE_ALIAS("fixed-partitions"); +-MODULE_ALIAS("ofoldpart"); +--- /dev/null ++++ b/drivers/mtd/parsers/ofpart_core.c +@@ -0,0 +1,260 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * Flash partitions described by the OF (or flattened) device tree ++ * ++ * Copyright © 2006 MontaVista Software Inc. ++ * Author: Vitaly Wool ++ * ++ * Revised to handle newer style flash binding by: ++ * Copyright © 2007 David Gibson, IBM Corporation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "ofpart_bcm4908.h" ++ ++struct fixed_partitions_quirks { ++ int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); ++}; ++ ++struct fixed_partitions_quirks bcm4908_partitions_quirks = { ++ .post_parse = bcm4908_partitions_post_parse, ++}; ++ ++static const struct of_device_id parse_ofpart_match_table[]; ++ ++static bool node_has_compatible(struct device_node *pp) ++{ ++ return of_get_property(pp, "compatible", NULL); ++} ++ ++static int parse_fixed_partitions(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ const struct fixed_partitions_quirks *quirks; ++ const struct of_device_id *of_id; ++ struct mtd_partition *parts; ++ struct device_node *mtd_node; ++ struct device_node *ofpart_node; ++ const char *partname; ++ struct device_node *pp; ++ int nr_parts, i, ret = 0; ++ bool dedicated = true; ++ ++ /* Pull of_node from the master device node */ ++ mtd_node = mtd_get_of_node(master); ++ if (!mtd_node) ++ return 0; ++ ++ ofpart_node = of_get_child_by_name(mtd_node, "partitions"); ++ if (!ofpart_node) { ++ /* ++ * We might get here even when ofpart isn't used at all (e.g., ++ * when using another parser), so don't be louder than ++ * KERN_DEBUG ++ */ ++ pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n", ++ master->name, mtd_node); ++ ofpart_node = mtd_node; ++ dedicated = false; ++ } ++ ++ of_id = of_match_node(parse_ofpart_match_table, ofpart_node); ++ if (dedicated && !of_id) { ++ /* The 'partitions' subnode might be used by another parser */ ++ return 0; ++ } ++ ++ quirks = of_id ? of_id->data : NULL; ++ ++ /* First count the subnodes */ ++ nr_parts = 0; ++ for_each_child_of_node(ofpart_node, pp) { ++ if (!dedicated && node_has_compatible(pp)) ++ continue; ++ ++ nr_parts++; ++ } ++ ++ if (nr_parts == 0) ++ return 0; ++ ++ parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); ++ if (!parts) ++ return -ENOMEM; ++ ++ i = 0; ++ for_each_child_of_node(ofpart_node, pp) { ++ const __be32 *reg; ++ int len; ++ int a_cells, s_cells; ++ ++ if (!dedicated && node_has_compatible(pp)) ++ continue; ++ ++ reg = of_get_property(pp, "reg", &len); ++ if (!reg) { ++ if (dedicated) { ++ pr_debug("%s: ofpart partition %pOF (%pOF) missing reg property.\n", ++ master->name, pp, ++ mtd_node); ++ goto ofpart_fail; ++ } else { ++ nr_parts--; ++ continue; ++ } ++ } ++ ++ a_cells = of_n_addr_cells(pp); ++ s_cells = of_n_size_cells(pp); ++ if (len / 4 != a_cells + s_cells) { ++ pr_debug("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n", ++ master->name, pp, ++ mtd_node); ++ goto ofpart_fail; ++ } ++ ++ parts[i].offset = of_read_number(reg, a_cells); ++ parts[i].size = of_read_number(reg + a_cells, s_cells); ++ parts[i].of_node = pp; ++ ++ partname = of_get_property(pp, "label", &len); ++ if (!partname) ++ partname = of_get_property(pp, "name", &len); ++ parts[i].name = partname; ++ ++ if (of_get_property(pp, "read-only", &len)) ++ parts[i].mask_flags |= MTD_WRITEABLE; ++ ++ if (of_get_property(pp, "lock", &len)) ++ parts[i].mask_flags |= MTD_POWERUP_LOCK; ++ ++ i++; ++ } ++ ++ if (!nr_parts) ++ goto ofpart_none; ++ ++ if (quirks && quirks->post_parse) ++ quirks->post_parse(master, parts, nr_parts); ++ ++ *pparts = parts; ++ return nr_parts; ++ ++ofpart_fail: ++ pr_err("%s: error parsing ofpart partition %pOF (%pOF)\n", ++ master->name, pp, mtd_node); ++ ret = -EINVAL; ++ofpart_none: ++ of_node_put(pp); ++ kfree(parts); ++ return ret; ++} ++ ++static const struct of_device_id parse_ofpart_match_table[] = { ++ /* Generic */ ++ { .compatible = "fixed-partitions" }, ++ /* Customized */ ++ { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, parse_ofpart_match_table); ++ ++static struct mtd_part_parser ofpart_parser = { ++ .parse_fn = parse_fixed_partitions, ++ .name = "fixed-partitions", ++ .of_match_table = parse_ofpart_match_table, ++}; ++ ++static int parse_ofoldpart_partitions(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ struct mtd_partition *parts; ++ struct device_node *dp; ++ int i, plen, nr_parts; ++ const struct { ++ __be32 offset, len; ++ } *part; ++ const char *names; ++ ++ /* Pull of_node from the master device node */ ++ dp = mtd_get_of_node(master); ++ if (!dp) ++ return 0; ++ ++ part = of_get_property(dp, "partitions", &plen); ++ if (!part) ++ return 0; /* No partitions found */ ++ ++ pr_warn("Device tree uses obsolete partition map binding: %pOF\n", dp); ++ ++ nr_parts = plen / sizeof(part[0]); ++ ++ parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); ++ if (!parts) ++ return -ENOMEM; ++ ++ names = of_get_property(dp, "partition-names", &plen); ++ ++ for (i = 0; i < nr_parts; i++) { ++ parts[i].offset = be32_to_cpu(part->offset); ++ parts[i].size = be32_to_cpu(part->len) & ~1; ++ /* bit 0 set signifies read only partition */ ++ if (be32_to_cpu(part->len) & 1) ++ parts[i].mask_flags = MTD_WRITEABLE; ++ ++ if (names && (plen > 0)) { ++ int len = strlen(names) + 1; ++ ++ parts[i].name = names; ++ plen -= len; ++ names += len; ++ } else { ++ parts[i].name = "unnamed"; ++ } ++ ++ part++; ++ } ++ ++ *pparts = parts; ++ return nr_parts; ++} ++ ++static struct mtd_part_parser ofoldpart_parser = { ++ .parse_fn = parse_ofoldpart_partitions, ++ .name = "ofoldpart", ++}; ++ ++static int __init ofpart_parser_init(void) ++{ ++ register_mtd_parser(&ofpart_parser); ++ register_mtd_parser(&ofoldpart_parser); ++ return 0; ++} ++ ++static void __exit ofpart_parser_exit(void) ++{ ++ deregister_mtd_parser(&ofpart_parser); ++ deregister_mtd_parser(&ofoldpart_parser); ++} ++ ++module_init(ofpart_parser_init); ++module_exit(ofpart_parser_exit); ++ ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("Parser for MTD partitioning information in device tree"); ++MODULE_AUTHOR("Vitaly Wool, David Gibson"); ++/* ++ * When MTD core cannot find the requested parser, it tries to load the module ++ * with the same name. Since we provide the ofoldpart parser, we should have ++ * the corresponding alias. ++ */ ++MODULE_ALIAS("fixed-partitions"); ++MODULE_ALIAS("ofoldpart"); diff --git a/target/linux/generic/backport-5.4/402-v5.12-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch b/target/linux/generic/backport-5.4/402-v5.12-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch deleted file mode 100644 index 340091fab9..0000000000 --- a/target/linux/generic/backport-5.4/402-v5.12-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch +++ /dev/null @@ -1,194 +0,0 @@ -From 09cf6ee6d21cd9ef2eb857ccb24305cf51166792 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 11 Feb 2021 23:04:27 +0100 -Subject: [PATCH] mtd: parsers: ofpart: support BCM4908 fixed partitions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 partitioning is based on fixed layout but allows specifying -multiple firmware partitions. It requires detecting which firmware -partition was used for booting current kernel. - -To support such cases without duplicating a lot of code (without copying -most of the ofpart.c code) support for post-parsing callback was added. - -BCM4908 callback simply reads offset of currently used firmware -partition from the DT. Bootloader specifies it using the "brcm_blparms" -property. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Richard Weinberger ---- - drivers/mtd/parsers/Makefile | 1 + - drivers/mtd/parsers/bcm4908-partitions.c | 64 ++++++++++++++++++++++++ - drivers/mtd/parsers/bcm4908-partitions.h | 7 +++ - drivers/mtd/parsers/ofpart.c | 28 ++++++++++- - 4 files changed, 98 insertions(+), 2 deletions(-) - create mode 100644 drivers/mtd/parsers/bcm4908-partitions.c - create mode 100644 drivers/mtd/parsers/bcm4908-partitions.h - ---- a/drivers/mtd/parsers/Makefile -+++ b/drivers/mtd/parsers/Makefile -@@ -4,6 +4,7 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm4 - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o - obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o -+obj-$(CONFIG_MTD_OF_PARTS) += bcm4908-partitions.o - obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o - obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o ---- /dev/null -+++ b/drivers/mtd/parsers/bcm4908-partitions.c -@@ -0,0 +1,64 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * Copyright (C) 2021 Rafał Miłecki -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "bcm4908-partitions.h" -+ -+#define BLPARAMS_FW_OFFSET "NAND_RFS_OFS" -+ -+static long long bcm4908_partitions_fw_offset(void) -+{ -+ struct device_node *root; -+ struct property *prop; -+ const char *s; -+ -+ root = of_find_node_by_path("/"); -+ if (!root) -+ return -ENOENT; -+ -+ of_property_for_each_string(root, "brcm_blparms", prop, s) { -+ size_t len = strlen(BLPARAMS_FW_OFFSET); -+ unsigned long offset; -+ int err; -+ -+ if (strncmp(s, BLPARAMS_FW_OFFSET, len) || s[len] != '=') -+ continue; -+ -+ err = kstrtoul(s + len + 1, 0, &offset); -+ if (err) { -+ pr_err("failed to parse %s\n", s + len + 1); -+ return err; -+ } -+ -+ return offset << 10; -+ } -+ -+ return -ENOENT; -+} -+ -+int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts) -+{ -+ long long fw_offset; -+ int i; -+ -+ fw_offset = bcm4908_partitions_fw_offset(); -+ -+ for (i = 0; i < nr_parts; i++) { -+ if (of_device_is_compatible(parts[i].of_node, "brcm,bcm4908-firmware")) { -+ if (fw_offset < 0 || parts[i].offset == fw_offset) -+ parts[i].name = "firmware"; -+ else -+ parts[i].name = "backup"; -+ } -+ } -+ -+ return 0; -+} ---- /dev/null -+++ b/drivers/mtd/parsers/bcm4908-partitions.h -@@ -0,0 +1,7 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+#ifndef __BCM4908_PARTITIONS_H -+#define __BCM4908_PARTITIONS_H -+ -+int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); -+ -+#endif ---- a/drivers/mtd/parsers/ofpart.c -+++ b/drivers/mtd/parsers/ofpart.c -@@ -16,6 +16,18 @@ - #include - #include - -+#include "bcm4908-partitions.h" -+ -+struct fixed_partitions_quirks { -+ int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); -+}; -+ -+struct fixed_partitions_quirks bcm4908_partitions_quirks = { -+ .post_parse = bcm4908_partitions_post_parse, -+}; -+ -+static const struct of_device_id parse_ofpart_match_table[]; -+ - static bool node_has_compatible(struct device_node *pp) - { - return of_get_property(pp, "compatible", NULL); -@@ -25,6 +37,8 @@ static int parse_fixed_partitions(struct - const struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { -+ const struct fixed_partitions_quirks *quirks; -+ const struct of_device_id *of_id; - struct mtd_partition *parts; - struct device_node *mtd_node; - struct device_node *ofpart_node; -@@ -33,7 +47,6 @@ static int parse_fixed_partitions(struct - int nr_parts, i, ret = 0; - bool dedicated = true; - -- - /* Pull of_node from the master device node */ - mtd_node = mtd_get_of_node(master); - if (!mtd_node) -@@ -50,11 +63,16 @@ static int parse_fixed_partitions(struct - master->name, mtd_node); - ofpart_node = mtd_node; - dedicated = false; -- } else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) { -+ } -+ -+ of_id = of_match_node(parse_ofpart_match_table, ofpart_node); -+ if (dedicated && !of_id) { - /* The 'partitions' subnode might be used by another parser */ - return 0; - } - -+ quirks = of_id ? of_id->data : NULL; -+ - /* First count the subnodes */ - nr_parts = 0; - for_each_child_of_node(ofpart_node, pp) { -@@ -123,6 +141,9 @@ static int parse_fixed_partitions(struct - if (!nr_parts) - goto ofpart_none; - -+ if (quirks && quirks->post_parse) -+ quirks->post_parse(master, parts, nr_parts); -+ - *pparts = parts; - return nr_parts; - -@@ -137,7 +158,10 @@ ofpart_none: - } - - static const struct of_device_id parse_ofpart_match_table[] = { -+ /* Generic */ - { .compatible = "fixed-partitions" }, -+ /* Customized */ -+ { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, }, - {}, - }; - MODULE_DEVICE_TABLE(of, parse_ofpart_match_table); diff --git a/target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch b/target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch deleted file mode 100644 index 47223098ec..0000000000 --- a/target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch +++ /dev/null @@ -1,40 +0,0 @@ -From bc6dcf44da2bea215ae3edbdac5d350e96de3996 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 15 Feb 2021 08:28:44 +0100 -Subject: [PATCH] mtd: parsers: ofpart: fix building as module -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This fixes: -ERROR: modpost: missing MODULE_LICENSE() in drivers/mtd/parsers/bcm4908-partitions.o -ERROR: modpost: "bcm4908_partitions_post_parse" [drivers/mtd/parsers/ofpart.ko] undefined! - -Reported-by: Stephen Rothwell -Fixes: 09cf6ee6d21c ("mtd: parsers: ofpart: support BCM4908 fixed partitions") -Signed-off-by: Rafał Miłecki -Signed-off-by: Richard Weinberger ---- - drivers/mtd/parsers/Makefile | 2 +- - drivers/mtd/parsers/bcm4908-partitions.c | 2 ++ - 2 files changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/parsers/Makefile -+++ b/drivers/mtd/parsers/Makefile -@@ -4,7 +4,7 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm4 - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o - obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o --obj-$(CONFIG_MTD_OF_PARTS) += bcm4908-partitions.o -+ofpart-objs := bcm4908-partitions.o - obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o - obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o ---- a/drivers/mtd/parsers/bcm4908-partitions.c -+++ b/drivers/mtd/parsers/bcm4908-partitions.c -@@ -62,3 +62,5 @@ int bcm4908_partitions_post_parse(struct - - return 0; - } -+ -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch index fc99996674..9600dfc67a 100644 --- a/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch +++ b/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch @@ -41,8 +41,8 @@ Signed-off-by: Adrian Schmutzler obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o +obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o - ofpart-objs := bcm4908-partitions.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o + obj-$(CONFIG_MTD_AFS_PARTS) += afs.o --- /dev/null +++ b/drivers/mtd/parsers/myloader.c @@ -0,0 +1,181 @@ diff --git a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch index ed7eb6e989..1523e757c7 100644 --- a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch +++ b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch @@ -31,7 +31,7 @@ Signed-off-by: Thibaut VARÈNE + formatted DTS. --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -11,3 +11,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o +@@ -10,3 +10,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o From 26052fb3553c2a55f6166c0188202b5d10c62a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 15 Feb 2021 16:51:38 +0100 Subject: [PATCH 08/25] bcm4908: fix backport of PMB driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missing Makefile change was preventing kernel from actually compiling the driver. Signed-off-by: Rafał Miłecki --- ...12-0002-soc-bcm-add-PM-driver-for-Broadcom-s-PMB.patch | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/bcm4908/patches-5.4/082-v5.12-0002-soc-bcm-add-PM-driver-for-Broadcom-s-PMB.patch b/target/linux/bcm4908/patches-5.4/082-v5.12-0002-soc-bcm-add-PM-driver-for-Broadcom-s-PMB.patch index 29e48c7f6c..5b8781a339 100644 --- a/target/linux/bcm4908/patches-5.4/082-v5.12-0002-soc-bcm-add-PM-driver-for-Broadcom-s-PMB.patch +++ b/target/linux/bcm4908/patches-5.4/082-v5.12-0002-soc-bcm-add-PM-driver-for-Broadcom-s-PMB.patch @@ -404,3 +404,11 @@ Signed-off-by: Florian Fainelli source "drivers/soc/bcm/brcmstb/Kconfig" endmenu +--- a/drivers/soc/bcm/Makefile ++++ b/drivers/soc/bcm/Makefile +@@ -1,4 +1,5 @@ + # SPDX-License-Identifier: GPL-2.0-only + obj-$(CONFIG_BCM2835_POWER) += bcm2835-power.o + obj-$(CONFIG_RASPBERRYPI_POWER) += raspberrypi-power.o ++obj-y += bcm63xx/ + obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/ From 95359dac827d175a61d0986a88feb5e4927fcb60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 15 Feb 2021 16:52:29 +0100 Subject: [PATCH 09/25] bcm4908: add USB packages to the DEFAULT_PACKAGES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All known 41 BCM4908 devices have USB ports so it makes sense to include those packages by default. Signed-off-by: Rafał Miłecki --- target/linux/bcm4908/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/bcm4908/Makefile b/target/linux/bcm4908/Makefile index d5f82a188e..5bee66fe2b 100644 --- a/target/linux/bcm4908/Makefile +++ b/target/linux/bcm4908/Makefile @@ -20,4 +20,6 @@ include $(INCLUDE_DIR)/target.mk KERNELNAME:=Image dtbs +DEFAULT_PACKAGES += kmod-usb-ohci kmod-usb2 kmod-usb3 + $(eval $(call BuildTarget)) From 0a497c4640a05bafa7e8115620438bfd4967a973 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Feb 2021 18:07:51 +0100 Subject: [PATCH 10/25] libubox: use build system variable to specify ABI version This removes the need to patch it afterwards Signed-off-by: Felix Fietkau --- package/libs/libubox/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index 19d9145509..4d582eacfd 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -68,16 +68,17 @@ endef TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include CMAKE_OPTIONS = \ - -DLUAPATH=/usr/lib/lua + -DLUAPATH=/usr/lib/lua \ + -DABIVERSION="$(PKG_ABI_VERSION)" define Package/libubox/install $(INSTALL_DIR) $(1)/lib/ - $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libubox.so $(1)/lib/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libubox.so.* $(1)/lib/ endef define Package/libblobmsg-json/install $(INSTALL_DIR) $(1)/lib/ - $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libblobmsg_json.so $(1)/lib/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libblobmsg_json.so.* $(1)/lib/ endef define Package/jshn/install @@ -88,7 +89,7 @@ endef define Package/libjson-script/install $(INSTALL_DIR) $(1)/lib/ - $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libjson_script.so $(1)/lib/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libjson_script.so.* $(1)/lib/ endef define Package/libubox-lua/install From f696cd3df3669a1a0a247623b549afeed718e207 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Feb 2021 18:46:11 +0100 Subject: [PATCH 11/25] build: add support for patching libtool to include ABI version in soname Use the version from PKG_ABI_VERSION Signed-off-by: Felix Fietkau --- include/autotools.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/autotools.mk b/include/autotools.mk index ec67c844f7..4b48b38992 100644 --- a/include/autotools.mk +++ b/include/autotools.mk @@ -62,6 +62,12 @@ define patch_libtool ); endef +define set_libtool_abiver + sed -i \ + -e 's,^soname_spec=.*,soname_spec="\\$$$${libname}\\$$$${shared_ext}.$(PKG_ABI_VERSION)",' \ + -e 's,^library_names_spec=.*,library_names_spec="\\$$$${libname}\\$$$${shared_ext}.$(PKG_ABI_VERSION) \\$$$${libname}\\$$$${shared_ext}",' \ + $(PKG_BUILD_DIR)/libtool +endef PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH) PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH) @@ -110,6 +116,10 @@ ifneq ($(filter libtool,$(PKG_FIXUP)),) endif endif +ifneq ($(filter libtool-abiver,$(PKG_FIXUP)),) + Hooks/Configure/Post += set_libtool_abiver +endif + ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),) PKG_BUILD_DEPENDS += libtool gettext libiconv ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),) From 26a899e3e84199db9e2807d6584e5fd6e11a702c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Feb 2021 18:46:59 +0100 Subject: [PATCH 12/25] wolfssl: use libtool patch for PKG_ABI_VERSION Makes it unnecessary to patch .so files after build Signed-off-by: Felix Fietkau --- package/libs/wolfssl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 51dc4d5a09..846351f06d 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -15,7 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION) PKG_HASH:=053aefbb02d0b06b27c5e2df6875b4b587318755b7db9d6aa8d72206b310a848 -PKG_FIXUP:=libtool +PKG_FIXUP:=libtool libtool-abiver PKG_INSTALL:=1 PKG_USE_MIPS16:=0 PKG_BUILD_PARALLEL:=1 From 075fa4cd9ae2ee5e9715fad2f70b2092ddc9ac2d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Feb 2021 17:49:46 +0100 Subject: [PATCH 13/25] Mostly revert "build: add support for fixing up library soname" This reverts commit b12288fa69b171f7c9405518c9bed3581a06f7ce. The patchelf approach is too fragile, and the only users of this have been converted to make patching unnecessary Leave the abi_version_str variable in place in rules.mk Signed-off-by: Felix Fietkau --- include/package-ipkg.mk | 5 --- include/package.mk | 2 -- rules.mk | 4 --- scripts/set-abi-version.sh | 73 -------------------------------------- 4 files changed, 84 deletions(-) delete mode 100755 scripts/set-abi-version.sh diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index e89276ed1a..eaa80ebc75 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -152,7 +152,6 @@ ifeq ($(DUMP),) mkdir -p $(PKG_BUILD_DIR)/.pkgdir/$(1) $(call Package/$(1)/install,$(PKG_BUILD_DIR)/.pkgdir/$(1)) $(call Package/$(1)/install_lib,$(PKG_BUILD_DIR)/.pkgdir/$(1)) - $(if $(PKG_ABI_VERSION),$(SET_ABI_VERSION) "$(PKG_ABI_VERSION)" "$(PKG_BUILD_DIR)/.pkgdir/$(1)" "$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)") touch $$@ $(STAGING_DIR_ROOT)/stamp/.$(1)_installed: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed @@ -197,15 +196,11 @@ $(_endef) $$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description) $$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG) $$(IPKG_$(1)) : export PKG_SOURCE_DATE_EPOCH:=$(PKG_SOURCE_DATE_EPOCH) - ifdef Build/InstallDev - $$(IPKG_$(1)): $(STAMP_INSTALLED) - endif $(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk @rm -rf $$(IDIR_$(1)); \ $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1)))) mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR) $(call Package/$(1)/install,$$(IDIR_$(1))) - $(if $(PKG_ABI_VERSION),$(SET_ABI_VERSION) "$(PKG_ABI_VERSION)" "$$(IDIR_$(1))" "$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)") $(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay) $(call Package/$(1)/install-overlay,$$(IDIR_$(1))/rootfs-overlay) -find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| $(XARGS) rm -rf diff --git a/include/package.mk b/include/package.mk index 0f1dd5cc50..d38d52908e 100644 --- a/include/package.mk +++ b/include/package.mk @@ -178,7 +178,6 @@ Build/Exports=$(Build/Exports/Default) define Build/CoreTargets STAMP_PREPARED:=$$(STAMP_PREPARED) STAMP_CONFIGURED:=$$(STAMP_CONFIGURED) - PKG_ABI_VERSION:=$$(PKG_ABI_VERSION) $(if $(QUILT),$(Build/Quilt)) $(call Build/Autoclean) @@ -237,7 +236,6 @@ define Build/CoreTargets "$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)" \ "$(STAGING_DIR)"; \ fi - $(if $(PKG_ABI_VERSION),$(SET_ABI_VERSION) "$(PKG_ABI_VERSION)" $(TMP_DIR)/stage-$(PKG_DIR_NAME)) if [ -d $(TMP_DIR)/stage-$(PKG_DIR_NAME) ]; then \ (cd $(TMP_DIR)/stage-$(PKG_DIR_NAME); find ./ > $(TMP_DIR)/stage-$(PKG_DIR_NAME).files); \ $(call locked, \ diff --git a/rules.mk b/rules.mk index c6bd7327c5..8f41ff5861 100644 --- a/rules.mk +++ b/rules.mk @@ -339,10 +339,6 @@ else $(SCRIPT_DIR)/rstrip.sh endif -SET_ABI_VERSION= \ - PATCHELF="$(STAGING_DIR_HOST)/bin/patchelf" \ - $(SCRIPT_DIR)/set-abi-version.sh - ifeq ($(CONFIG_IPV6),y) DISABLE_IPV6:= else diff --git a/scripts/set-abi-version.sh b/scripts/set-abi-version.sh deleted file mode 100755 index a61c842c6d..0000000000 --- a/scripts/set-abi-version.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (C) 2020 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -SELF=${0##*/} - -[ -n "$PATCHELF" ] || { - echo "$SELF: patchelf command not defined (PATCHELF variable not set)" - exit 1 -} - -ABI_VER="$1" -PATCH_DIR="$2" -REF_LIST="$3" - -[ -n "$ABI_VER" -a -n "$PATCH_DIR" ] || { - echo "$SELF: no ABI version or files/directories specified" - echo "usage: $SELF [...]" - exit 1 -} - -cmd() { - echo "$@" >&2 - "$@" || exit 1 -} - -gen_lib_list() { - while read F; do - F="${F##*/}" - case "$F" in - lib*.so*);; - *) continue;; - esac - echo -n "$F:" - done < "$REF_LIST" -} - -find "$PATCH_DIR" -type f -a -name 'lib*.so*' | \ -( - while read F; do - NEW_F="${F%%.so*}.so.$ABI_VER" - NEW_NAME="${NEW_F##*/}" - [ "$NEW_F" != "$F" ] || continue - cmd mv "$F" "$NEW_F" - [ "$REF_LIST" ] || cmd ln -s "$NEW_NAME" "$F" - cmd $PATCHELF --set-soname "$NEW_NAME" "$NEW_F" - done -) - -[ -n "$REF_LIST" ] || exit 0 - -LIBS="$(gen_lib_list)" -LIBS="${LIBS%%:}" -find "$PATCH_DIR" -type f -a -exec file {} \; | \ - sed -n -e 's/^\(.*\):.*ELF.*\(executable\|relocatable\|shared object\).*,.*/\1:\2/p' | \ -( - IFS=":" - while read F S; do - $PATCHELF --print-needed "$F" | while read L; do - BASE_L="${L%%.so*}" - for lib in $LIBS; do - base_lib="${lib%%.so*}" - [ "$BASE_L" = "$base_lib" ] || continue - [ "$l" = "$lib" ] && continue - cmd $PATCHELF --replace-needed "$L" "$lib" "$F" - done - done - done - true -) From 542eab31a60227bd429cb0207199daf83dd6850f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Feb 2021 18:53:42 +0100 Subject: [PATCH 14/25] build: only overwrite ABI version for provided packages when base version changed Should avoid some spurious rebuilds Signed-off-by: Felix Fietkau --- include/package-ipkg.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index eaa80ebc75..a8210f8e31 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -156,12 +156,12 @@ ifeq ($(DUMP),) $(STAGING_DIR_ROOT)/stamp/.$(1)_installed: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed mkdir -p $(STAGING_DIR_ROOT)/stamp - $(if $(ABI_VERSION),echo '$(ABI_VERSION)' | cmp -s - $(PKG_INFO_DIR)/$(1).version || \ - echo '$(ABI_VERSION)' > $(PKG_INFO_DIR)/$(1).version \ - $(foreach pkg,$(filter-out $(1),$(PROVIDES)),; \ - cp $(PKG_INFO_DIR)/$(1).version $(PKG_INFO_DIR)/$(pkg).version \ + $(if $(ABI_VERSION),echo '$(ABI_VERSION)' | cmp -s - $(PKG_INFO_DIR)/$(1).version || { \ + echo '$(ABI_VERSION)' > $(PKG_INFO_DIR)/$(1).version; \ + $(foreach pkg,$(filter-out $(1),$(PROVIDES)), \ + cp $(PKG_INFO_DIR)/$(1).version $(PKG_INFO_DIR)/$(pkg).version; \ ) \ - ) + } ) $(call locked,$(CP) $(PKG_BUILD_DIR)/.pkgdir/$(1)/. $(STAGING_DIR_ROOT)/,root-copy) touch $$@ From 8edb1797d55d259c6eda18c89784f152328436fc Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Feb 2021 19:18:10 +0100 Subject: [PATCH 15/25] libubox: update to the latest version, set ABI_VERSION dynamically 2537be018587 cmake: add a possibility to set library version Signed-off-by: Felix Fietkau --- package/system/ubus/Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 1eb7da007e..54839e5514 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -5,9 +5,10 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git -PKG_SOURCE_DATE:=2020-12-04 -PKG_SOURCE_VERSION:=d1d9ddf98d39b0bdc055060fb962335439445690 -PKG_MIRROR_HASH:=6fbdda5144cfef14d314d421ce801e9c89a2266428346f531a57c28e731a059c +PKG_SOURCE_DATE:=2021-02-15 +PKG_SOURCE_VERSION:=2537be01858710e714c329153760c64fe3f8a73e +PKG_MIRROR_HASH:=da1f4959fbe3d51cbc6b7c08b24307f43a80911b395cac834b9f4161c195152f +PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 PKG_LICENSE:=LGPL-2.1 @@ -38,7 +39,7 @@ define Package/libubus SECTION:=libs CATEGORY:=Libraries DEPENDS:=+libubox - ABI_VERSION:=20191227 + ABI_VERSION:=$(PKG_ABI_VERSION) TITLE:=OpenWrt RPC client library endef @@ -53,7 +54,8 @@ TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -flto TARGET_LDFLAGS += -flto CMAKE_OPTIONS = \ - -DLUAPATH=/usr/lib/lua + -DLUAPATH=/usr/lib/lua \ + -DABIVERSION="$(PKG_ABI_VERSION)" define Package/ubus/install $(INSTALL_DIR) $(1)/bin @@ -67,7 +69,7 @@ endef define Package/libubus/install $(INSTALL_DIR) $(1)/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so $(1)/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libubus.so.* $(1)/lib/ endef define Package/libubus-lua/install From 1da945b7602322142fc9a2d70edaf5592743bd6d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Feb 2021 19:58:54 +0100 Subject: [PATCH 16/25] tools/fakeroot: fix build regression on macOS Signed-off-by: Felix Fietkau --- .../patches/301-glibc-2.33-compat-fixes.patch | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tools/fakeroot/patches/301-glibc-2.33-compat-fixes.patch diff --git a/tools/fakeroot/patches/301-glibc-2.33-compat-fixes.patch b/tools/fakeroot/patches/301-glibc-2.33-compat-fixes.patch new file mode 100644 index 0000000000..0b91d65edb --- /dev/null +++ b/tools/fakeroot/patches/301-glibc-2.33-compat-fixes.patch @@ -0,0 +1,42 @@ +--- a/libfakeroot.c ++++ b/libfakeroot.c +@@ -1368,7 +1368,8 @@ int renameat(int olddir_fd, const char * + #endif /* HAVE_FSTATAT */ + + +-#if defined(__GLIBC__) && __GLIBC_PREREQ(2,33) ++#if defined(__GLIBC__) ++#if __GLIBC_PREREQ(2,33) + /* Glibc 2.33 exports symbols for these functions in the shared lib */ + int lstat(const char *file_name, struct stat *statbuf) { + return WRAP_LSTAT LSTAT_ARG(_STAT_VER, file_name, statbuf); +@@ -1413,6 +1414,7 @@ int renameat(int olddir_fd, const char * + return WRAP_MKNODAT MKNODAT_ARG(_STAT_VER, dir_fd, pathname, mode, &dev); + } + #endif ++#endif /* __GLIBC__ */ + #endif /* GLIBC_PREREQ */ + + +--- a/configure.ac ++++ b/configure.ac +@@ -182,6 +182,9 @@ AC_MSG_CHECKING([for type of arg of __xm + #include + #include + ]], [[ ++#ifndef __GLIBC__ ++#error no extra * ++#endif + int __xmknod ( int ver, + const char *pathname , + mode_t mode , dev_t *dev); +@@ -208,6 +211,9 @@ AC_MSG_CHECKING([for type of arg of __xm + #include + #include + ]], [[ ++#ifndef __GLIBC__ ++#error no extra * ++#endif + int __xmknodat ( int ver, + int dirfd, + const char *pathname , From c68d52799110262698734882bc50d960e3108eca Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Feb 2021 21:09:49 +0100 Subject: [PATCH 17/25] build: filter out own packages on package version check This was accidentally dropped in 27a4a71c2408 ("metadata: handle ABI version rebuild tracking for transient dependencies") Signed-off-by: Felix Fietkau --- include/package.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/package.mk b/include/package.mk index d38d52908e..db0a869dab 100644 --- a/include/package.mk +++ b/include/package.mk @@ -58,7 +58,7 @@ include $(INCLUDE_DIR)/quilt.mk find_library_dependencies = \ $(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \ - $(sort $(foreach dep4, \ + $(filter-out $(BUILD_PACKAGES), $(sort $(foreach dep4, \ $(sort $(foreach dep3, \ $(sort $(foreach dep2, \ $(sort $(foreach dep1, \ @@ -73,7 +73,7 @@ find_library_dependencies = \ $(Package/$(dep3)/depends) $(dep3) \ )), \ $(Package/$(dep4)/depends) $(dep4) \ - )) \ + ))) \ )) From da92e9825ab043c299428b8aea7891d964787a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 15 Feb 2021 21:51:37 +0100 Subject: [PATCH 18/25] bcm4908: use DTS patches sent upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are 2 new patches: 1. Netgear R8000P switch ports 2. Netgear R8000P LEDs Signed-off-by: Rafał Miłecki --- ...s-broadcom-bcm4908-describe-USB-PHY.patch} | 10 +-- ...m-bcm4908-describe-Ethernet-control.patch} | 6 +- ...om-bcm4908-describe-Netgear-R8000P-s.patch | 48 ++++++++++++ ...om-bcm4908-add-remaining-Netgear-R80.patch | 78 +++++++++++++++++++ ...m-bcm4908-describe-firmware-partiti.patch} | 36 +++------ 5 files changed, 145 insertions(+), 33 deletions(-) rename target/linux/bcm4908/patches-5.4/{300-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch => 130-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch} (92%) rename target/linux/bcm4908/patches-5.4/{302-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch => 130-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch} (88%) create mode 100644 target/linux/bcm4908/patches-5.4/130-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch create mode 100644 target/linux/bcm4908/patches-5.4/130-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch rename target/linux/bcm4908/patches-5.4/{301-arm64-dts-broadcom-bcm4908-improve-partitions-descri.patch => 130-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch} (59%) diff --git a/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch b/target/linux/bcm4908/patches-5.4/130-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch similarity index 92% rename from target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch rename to target/linux/bcm4908/patches-5.4/130-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch index b0b8cc5748..8a10212d92 100644 --- a/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch +++ b/target/linux/bcm4908/patches-5.4/130-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch @@ -1,6 +1,5 @@ -From 28d11220a92e9fc4d7d1b8e52dc1c48980e336a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 20 Jan 2021 20:34:00 +0100 +Date: Mon, 15 Feb 2021 19:46:54 +0100 Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe USB PHY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -12,9 +11,9 @@ and XHCI. It requires powering up using the PMB. Signed-off-by: Rafał Miłecki --- .../bcm4908/bcm4906-netgear-r8000p.dts | 17 +++++++++++++ - .../bcm4908/bcm4908-asus-gt-ac5300.dts | 16 ++++++++++++ + .../bcm4908/bcm4908-asus-gt-ac5300.dts | 17 +++++++++++++ .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 25 ++++++++++++++++--- - 3 files changed, 54 insertions(+), 4 deletions(-) + 3 files changed, 55 insertions(+), 4 deletions(-) --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts @@ -44,11 +43,12 @@ Signed-off-by: Rafał Miłecki nand-ecc-step-size = <512>; --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -@@ -44,6 +44,22 @@ +@@ -44,6 +44,23 @@ }; }; +&usb_phy { ++ brcm,ioc = <1>; + status = "okay"; +}; + diff --git a/target/linux/bcm4908/patches-5.4/302-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch b/target/linux/bcm4908/patches-5.4/130-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch similarity index 88% rename from target/linux/bcm4908/patches-5.4/302-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch rename to target/linux/bcm4908/patches-5.4/130-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch index ed8fac387f..30487851c1 100644 --- a/target/linux/bcm4908/patches-5.4/302-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch +++ b/target/linux/bcm4908/patches-5.4/130-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch @@ -1,5 +1,5 @@ From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 8 Feb 2021 09:11:36 +0100 +Date: Mon, 15 Feb 2021 19:51:26 +0100 Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe Ethernet controller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -9,6 +9,8 @@ BCM4908 SoCs have an integrated Ethernet controller. Signed-off-by: Rafał Miłecki --- + .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 20 +++++++++++++++++++ + 1 file changed, 20 insertions(+) --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi @@ -35,8 +37,8 @@ Signed-off-by: Rafał Miłecki + port@8 { + reg = <8>; + phy-mode = "internal"; -+ brcm,use-bcm-hdr; + ethernet = <&enet>; ++ brcm,use-bcm-hdr; + + fixed-link { + speed = <1000>; diff --git a/target/linux/bcm4908/patches-5.4/130-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch b/target/linux/bcm4908/patches-5.4/130-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch new file mode 100644 index 0000000000..1ee59d7e2d --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/130-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch @@ -0,0 +1,48 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 15 Feb 2021 19:52:58 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe Netgear R8000P switch +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +R8000P model has 4 LAN ports and 1 WAN port. + +Signed-off-by: Rafał Miłecki +--- + .../bcm4908/bcm4906-netgear-r8000p.dts | 25 +++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts +@@ -43,6 +43,31 @@ + status = "okay"; + }; + ++&ports { ++ port@0 { ++ label = "lan4"; ++ }; ++ ++ port@1 { ++ label = "lan3"; ++ }; ++ ++ port@2 { ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ label = "lan1"; ++ }; ++ ++ port@7 { ++ reg = <7>; ++ phy-mode = "internal"; ++ phy-handle = <&phy12>; ++ label = "wan"; ++ }; ++}; ++ + &nandcs { + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; diff --git a/target/linux/bcm4908/patches-5.4/130-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch b/target/linux/bcm4908/patches-5.4/130-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch new file mode 100644 index 0000000000..c192c35df0 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/130-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch @@ -0,0 +1,78 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 15 Feb 2021 20:05:41 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: add remaining Netgear R8000P + LEDs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There are a few more GPIO connected LEDs there didn't get described +initially. + +Signed-off-by: Rafał Miłecki +--- + .../bcm4908/bcm4906-netgear-r8000p.dts | 48 +++++++++++++++++++ + 1 file changed, 48 insertions(+) + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts +@@ -18,11 +18,59 @@ + leds { + compatible = "gpio-leds"; + ++ power-white { ++ function = LED_FUNCTION_POWER; ++ color = ; ++ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; ++ }; ++ ++ power-amber { ++ function = LED_FUNCTION_POWER; ++ color = ; ++ gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; ++ }; ++ + wps { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + }; ++ ++ 2ghz { ++ function = "2ghz"; ++ color = ; ++ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; ++ }; ++ ++ 5ghz-1 { ++ function = "5ghz-1"; ++ color = ; ++ gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; ++ }; ++ ++ 5ghz-2 { ++ function = "5ghz-2"; ++ color = ; ++ gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; ++ }; ++ ++ usb2 { ++ function = "usb2"; ++ color = ; ++ gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; ++ }; ++ ++ usb3 { ++ function = "usb3"; ++ color = ; ++ gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wifi { ++ function = "wifi"; ++ color = ; ++ gpios = <&gpio0 56 GPIO_ACTIVE_LOW>; ++ }; + }; + }; + diff --git a/target/linux/bcm4908/patches-5.4/301-arm64-dts-broadcom-bcm4908-improve-partitions-descri.patch b/target/linux/bcm4908/patches-5.4/130-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch similarity index 59% rename from target/linux/bcm4908/patches-5.4/301-arm64-dts-broadcom-bcm4908-improve-partitions-descri.patch rename to target/linux/bcm4908/patches-5.4/130-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch index 524a433335..10f33f5140 100644 --- a/target/linux/bcm4908/patches-5.4/301-arm64-dts-broadcom-bcm4908-improve-partitions-descri.patch +++ b/target/linux/bcm4908/patches-5.4/130-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch @@ -1,23 +1,22 @@ -From e401e6fe9195eabfc6c81d8aed920a75b5d7987b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 20 Jan 2021 20:53:35 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: improve partitions description +Date: Mon, 15 Feb 2021 20:30:09 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe firmware partitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -1. Use proper bindings -2. Add missing partitions +BCM4908 bootloader supports multiple firmware partitions and has its own +bindings defined for them. Signed-off-by: Rafał Miłecki --- - .../bcm4908/bcm4906-netgear-r8000p.dts | 1 + - .../bcm4908/bcm4908-asus-gt-ac5300.dts | 27 ++++++++++++++++++- - 2 files changed, 27 insertions(+), 1 deletion(-) + .../dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts | 1 + + .../dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts | 12 +++++++++++- + 2 files changed, 12 insertions(+), 1 deletion(-) --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -@@ -62,6 +62,7 @@ +@@ -135,6 +135,7 @@ }; partition@100000 { @@ -27,7 +26,7 @@ Signed-off-by: Rafał Miłecki }; --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -@@ -121,7 +121,7 @@ +@@ -122,7 +122,7 @@ #size-cells = <0>; partitions { @@ -36,7 +35,7 @@ Signed-off-by: Rafał Miłecki #address-cells = <1>; #size-cells = <1>; -@@ -129,5 +129,30 @@ +@@ -130,5 +130,15 @@ label = "cferom"; reg = <0x0 0x100000>; }; @@ -49,21 +48,6 @@ Signed-off-by: Rafał Miłecki + partition@5800000 { + compatible = "brcm,bcm4908-firmware"; + reg = <0x5800000 0x5700000>; -+ }; -+ -+ partition@af00000 { -+ label = "misc1"; -+ reg = <0xaf00000 0x800000>; -+ }; -+ -+ partition@b700000 { -+ label = "misc2"; -+ reg = <0xb700000 0x4000000>; -+ }; -+ -+ partition@f700000 { -+ label = "data"; -+ reg = <0xf700000 0x800000>; + }; }; }; From f0933303d685f2f1b4146f6d23ae18c66cbf6c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 15 Feb 2021 22:18:01 +0100 Subject: [PATCH 19/25] bcm4908: fix GPIOs support by limiting them to 64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...oadcom-bcm4908-limit-amount-of-GPIOs.patch | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch diff --git a/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch b/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch new file mode 100644 index 0000000000..c28c69c6f8 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch @@ -0,0 +1,23 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 15 Feb 2021 22:01:03 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: limit amount of GPIOs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Linux driver can't handle more than 64 GPIOs + +Signed-off-by: Rafał Miłecki +--- + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +@@ -281,7 +281,7 @@ + gpio0: gpio-controller@500 { + compatible = "brcm,bcm6345-gpio"; + reg-names = "dirout", "dat"; +- reg = <0x500 0x28>, <0x528 0x28>; ++ reg = <0x500 0x8>, <0x528 0x8>; + + #gpio-cells = <2>; + gpio-controller; From 0cde9a0a6527b7ad97a72cb0641566c307c861a4 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 15 Feb 2021 22:23:17 +0100 Subject: [PATCH 20/25] mac80211: Refresh patches again A wrong quilt configuration was used last time. Fixes: ed1e234d87fc ("mac80211: refresh patches") Signed-off-by: Hauke Mehrtens --- .../ath/080-ath10k_thermal_config.patch | 2 +- ..._hw-issue-external-reset-for-QCA955x.patch | 51 +++++++------ .../patches/ath/402-ath_regd_optional.patch | 2 +- .../patches/ath/530-ath9k_extra_leds.patch | 12 +-- .../ath/551-ath9k_ubnt_uap_plus_hsr.patch | 2 +- ...rolling-support-for-various-chipsets.patch | 2 +- .../602-rt2x00-introduce-rt2x00eeprom.patch | 2 +- ...-differentiate-based-on-SoC-CHIP_VER.patch | 75 ++++++++++--------- ...ave-survey-for-every-channel-visited.patch | 14 ++-- .../100-remove-cryptoapi-dependencies.patch | 10 +-- ...ot-maintain-a-backlog-sorted-list-of.patch | 31 ++++---- ...ryption-key-selection-for-802.3-xmit.patch | 9 ++- ...l_ht-improve-ampdu-length-estimation.patch | 6 +- ...l_ht-significantly-redesign-the-rate.patch | 16 ++-- 14 files changed, 124 insertions(+), 110 deletions(-) diff --git a/package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch b/package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch index 55d48daa79..de6f9d9bb0 100644 --- a/package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch +++ b/package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch @@ -37,7 +37,7 @@ void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); --- a/local-symbols +++ b/local-symbols -@@ -143,6 +143,7 @@ ATH10K_SNOC= +@@ -142,6 +142,7 @@ ATH10K_SNOC= ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= diff --git a/package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch b/package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch index d3248f958b..5f265b84c2 100644 --- a/package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch +++ b/package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch @@ -29,6 +29,21 @@ Signed-off-by: Felix Fietkau - npend = ath9k_hw_numtxpending(ah, i); - if (npend) - break; +- } +- +- if (ah->external_reset && +- (npend || type == ATH9K_RESET_COLD)) { +- int reset_err = 0; +- +- ath_dbg(ath9k_hw_common(ah), RESET, +- "reset MAC via external reset\n"); +- +- reset_err = ah->external_reset(); +- if (reset_err) { +- ath_err(ath9k_hw_common(ah), +- "External reset failed, err=%d\n", +- reset_err); +- return false; + if (type == ATH9K_RESET_COLD) + return true; + @@ -44,47 +59,35 @@ Signed-off-by: Felix Fietkau + for (i = 0; i < AR_NUM_QCU; i++) { + if (ath9k_hw_numtxpending(ah, i)) + return true; -+ } - } - -- if (ah->external_reset && -- (npend || type == ATH9K_RESET_COLD)) { -- int reset_err = 0; + } ++ } ++ + return false; +} - -- ath_dbg(ath9k_hw_common(ah), RESET, -- "reset MAC via external reset\n"); ++ +static bool ath9k_hw_external_reset(struct ath_hw *ah, int type) +{ + int err; - -- reset_err = ah->external_reset(); -- if (reset_err) { -- ath_err(ath9k_hw_common(ah), -- "External reset failed, err=%d\n", -- reset_err); -- return false; -- } ++ + if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type)) + return true; - -- REG_WRITE(ah, AR_RTC_RESET, 1); ++ + ath_dbg(ath9k_hw_common(ah), RESET, + "reset MAC via external reset\n"); -+ + +- REG_WRITE(ah, AR_RTC_RESET, 1); + err = ah->external_reset(); + if (err) { + ath_err(ath9k_hw_common(ah), + "External reset failed, err=%d\n", err); + return false; -+ } -+ + } + + if (AR_SREV_9550(ah)) { + REG_WRITE(ah, AR_RTC_RESET, 0); + udelay(10); - } - ++ } ++ + REG_WRITE(ah, AR_RTC_RESET, 1); + udelay(10); + diff --git a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch index 3c9180b113..bf87d3551a 100644 --- a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch +++ b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch @@ -82,7 +82,7 @@ help --- a/local-symbols +++ b/local-symbols -@@ -86,6 +86,7 @@ ADM8211= +@@ -85,6 +85,7 @@ ADM8211= ATH_COMMON= WLAN_VENDOR_ATH= ATH_DEBUG= diff --git a/package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch index 30b6bdc78e..1f19483064 100644 --- a/package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch @@ -103,8 +103,7 @@ + GFP_KERNEL); + if (!led) + return -ENOMEM; - -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val); ++ + led->gpio = gpio = (struct gpio_led *) (led + 1); + _name = (char *) (led->gpio + 1); + @@ -117,7 +116,8 @@ + ret = ath_add_led(sc, led); + if (unlikely(ret < 0)) + kfree(led); -+ + +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val); + return ret; } @@ -125,11 +125,11 @@ { - if (!sc->led_registered) - return; -- -- ath_led_brightness(&sc->led_cdev, LED_OFF); -- led_classdev_unregister(&sc->led_cdev); + struct ath_led *led; +- ath_led_brightness(&sc->led_cdev, LED_OFF); +- led_classdev_unregister(&sc->led_cdev); +- - ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin); + while (!list_empty(&sc->leds)) { + led = list_first_entry(&sc->leds, struct ath_led, list); diff --git a/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch index 96187be3d5..7e3e1236f7 100644 --- a/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch +++ b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch @@ -371,7 +371,7 @@ --- a/local-symbols +++ b/local-symbols -@@ -113,6 +113,7 @@ ATH9K_WOW= +@@ -112,6 +112,7 @@ ATH9K_WOW= ATH9K_RFKILL= ATH9K_CHANNEL_CONTEXT= ATH9K_PCOEM= diff --git a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index 511cf59222..403d1e5035 100644 --- a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -114,7 +114,7 @@ v13: ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o --- a/local-symbols +++ b/local-symbols -@@ -146,6 +146,7 @@ ATH10K_DEBUG= +@@ -145,6 +145,7 @@ ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= ATH10K_THERMAL= diff --git a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch index 1c52132da6..e74d9a9aa0 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -333,6 +333,7 @@ RT2X00_LIB_FIRMWARE= +@@ -332,6 +332,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= diff --git a/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch b/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch index c82258c2b6..3de00b2267 100644 --- a/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch +++ b/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch @@ -22,15 +22,16 @@ - rfcsr = rt2800_rfcsr_read(rt2x00dev, 16); - rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80); - rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); +- +- rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); +- rt2x00_set_field8(&rfcsr, RFCSR21_BIT8, 1); +- rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); + if (rt2800_hw_get_chipver(rt2x00dev) > 1) { + /* Default: XO=20MHz , SDM mode */ + rfcsr = rt2800_rfcsr_read(rt2x00dev, 16); + rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80); + rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); - -- rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); -- rt2x00_set_field8(&rfcsr, RFCSR21_BIT8, 1); -- rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); ++ + rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); + rt2x00_set_field8(&rfcsr, RFCSR21_BIT8, 1); + rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); @@ -216,6 +217,10 @@ - rt2800_rfcsr_write(rt2x00dev, 28, 0x61); - rt2800_rfcsr_write(rt2x00dev, 29, 0xB5); - rt2800_rfcsr_write(rt2x00dev, 43, 0x02); +- +- rt2800_rfcsr_write(rt2x00dev, 28, 0x62); +- rt2800_rfcsr_write(rt2x00dev, 29, 0xAD); +- rt2800_rfcsr_write(rt2x00dev, 39, 0x80); + if (rt2800_hw_get_chipver(rt2x00dev) > 1) { + rt2800_rfcsr_write(rt2x00dev, 11, 0x21); + if (rt2800_clk_is_20mhz(rt2x00dev)) @@ -239,10 +244,7 @@ + rt2800_rfcsr_write(rt2x00dev, 29, 0xB5); + rt2800_rfcsr_write(rt2x00dev, 43, 0x02); + } - -- rt2800_rfcsr_write(rt2x00dev, 28, 0x62); -- rt2800_rfcsr_write(rt2x00dev, 29, 0xAD); -- rt2800_rfcsr_write(rt2x00dev, 39, 0x80); ++ + if (rt2800_hw_get_chipver(rt2x00dev) > 1 && + rt2800_hw_get_chipeco(rt2x00dev) >= 2) { + rt2800_rfcsr_write(rt2x00dev, 28, 0x62); @@ -286,6 +288,33 @@ - rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); - rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7); - rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); +- +- rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x2C); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x64); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x51); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); +- +- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); +- +- /* Initialize RF channel register for DRQFN */ +- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xE3); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xE5); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x28); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x68); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xF7); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x02); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xC7); + if (rt2800_hw_get_chipver(rt2x00dev) > 1) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x47); + rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x71); @@ -318,16 +347,7 @@ + rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7); + rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); + } - -- rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x2C); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x64); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x51); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); ++ + if (rt2800_hw_get_chipver(rt2x00dev) > 1 && + rt2800_hw_get_chipeco(rt2x00dev) >= 2) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51); @@ -339,13 +359,7 @@ + rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36); + rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53); + rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); - -- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); ++ + rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C); + rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC); + rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F); @@ -353,16 +367,7 @@ + rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); + rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); + } - -- /* Initialize RF channel register for DRQFN */ -- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xE3); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xE5); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x28); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x68); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xF7); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x02); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xC7); ++ + if (rt2800_hw_get_chippkg(rt2x00dev) == 0 && + rt2800_hw_get_chipver(rt2x00dev) == 1) { + /* Initialize RF channel register for DRQFN */ diff --git a/package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch b/package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch index 205c10b641..31a7baeee7 100644 --- a/package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch +++ b/package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch @@ -53,20 +53,22 @@ - idle = rt2800_register_read(rt2x00dev, CH_IDLE_STA); - busy = rt2800_register_read(rt2x00dev, CH_BUSY_STA); - busy_ext = rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC); -+ survey->channel = &rt2x00dev->bands[band].channels[idx]; - +- - if (idle || busy) { - survey->filled = SURVEY_INFO_TIME | - SURVEY_INFO_TIME_BUSY | - SURVEY_INFO_TIME_EXT_BUSY; -+ survey->filled = SURVEY_INFO_TIME | -+ SURVEY_INFO_TIME_BUSY | -+ SURVEY_INFO_TIME_EXT_BUSY; - +- - survey->time = (idle + busy) / 1000; - survey->time_busy = busy / 1000; - survey->time_ext_busy = busy_ext / 1000; - } ++ survey->channel = &rt2x00dev->bands[band].channels[idx]; ++ ++ survey->filled = SURVEY_INFO_TIME | ++ SURVEY_INFO_TIME_BUSY | ++ SURVEY_INFO_TIME_EXT_BUSY; ++ + survey->time = div_u64(chan_survey->time_idle + chan_survey->time_busy, 1000); + survey->time_busy = div_u64(chan_survey->time_busy, 1000); + survey->time_ext_busy = div_u64(chan_survey->time_ext_busy, 1000); diff --git a/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch index ac78e62ccc..7b036e4e4c 100644 --- a/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch +++ b/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch @@ -166,7 +166,8 @@ #define AES_CCM_H -#include "aead_api.h" -- ++#include + -#define CCM_AAD_LEN 32 - -static inline struct crypto_aead * @@ -194,8 +195,7 @@ - be16_to_cpup((__be16 *)aad), - data, data_len, mic); -} -+#include - +- -static inline void ieee80211_aes_key_free(struct crypto_aead *tfm) -{ - return aead_key_free(tfm); @@ -331,10 +331,10 @@ #define AES_GCM_H -#include "aead_api.h" -- --#define GCM_AAD_LEN 32 +#include +-#define GCM_AAD_LEN 32 +- -static inline int ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, - u8 *j_0, u8 *aad, u8 *data, - size_t data_len, u8 *mic) diff --git a/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch b/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch index 0e923991db..08e5cbb5b9 100644 --- a/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch +++ b/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch @@ -133,34 +133,37 @@ Signed-off-by: Felix Fietkau -static void fq_recalc_backlog(struct fq *fq, - struct fq_tin *tin, - struct fq_flow *flow) -+static struct fq_flow *fq_find_fattest_flow(struct fq *fq) - { +-{ - struct fq_flow *i; -+ struct fq_tin *tin; -+ struct fq_flow *flow = NULL; -+ u32 len = 0; -+ int i; - +- - if (list_empty(&flow->backlogchain)) - list_add_tail(&flow->backlogchain, &fq->backlogs); -+ for_each_set_bit(i, fq->flows_bitmap, fq->flows_cnt) { -+ struct fq_flow *cur = &fq->flows[i]; -+ unsigned int cur_len; - +- - i = flow; - list_for_each_entry_continue_reverse(i, &fq->backlogs, - backlogchain) - if (i->backlog > flow->backlog) - break; ++static struct fq_flow *fq_find_fattest_flow(struct fq *fq) ++{ ++ struct fq_tin *tin; ++ struct fq_flow *flow = NULL; ++ u32 len = 0; ++ int i; ++ ++ for_each_set_bit(i, fq->flows_bitmap, fq->flows_cnt) { ++ struct fq_flow *cur = &fq->flows[i]; ++ unsigned int cur_len; ++ + cur_len = cur->backlog; + if (cur_len <= len) + continue; - -- list_move(&flow->backlogchain, &i->backlogchain); ++ + flow = cur; + len = cur_len; + } -+ + +- list_move(&flow->backlogchain, &i->backlogchain); + list_for_each_entry(tin, &fq->tin_backlog, tin_list) { + unsigned int cur_len = tin->default_flow.backlog; + diff --git a/package/kernel/mac80211/patches/subsys/313-mac80211-fix-encryption-key-selection-for-802.3-xmit.patch b/package/kernel/mac80211/patches/subsys/313-mac80211-fix-encryption-key-selection-for-802.3-xmit.patch index 5ae9ca8b93..9c9be2927a 100644 --- a/package/kernel/mac80211/patches/subsys/313-mac80211-fix-encryption-key-selection-for-802.3-xmit.patch +++ b/package/kernel/mac80211/patches/subsys/313-mac80211-fix-encryption-key-selection-for-802.3-xmit.patch @@ -28,13 +28,14 @@ Signed-off-by: Felix Fietkau - (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || - key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)) - offload = false; -+ sdata->control_port_protocol == ehdr->h_proto)) -+ goto skip_offload; - +- - if (offload) - ieee80211_8023_xmit(sdata, dev, sta, key, skb); - else - ieee80211_subif_start_xmit(skb, dev); ++ sdata->control_port_protocol == ehdr->h_proto)) ++ goto skip_offload; + + key = rcu_dereference(sta->ptk[sta->ptk_idx]); + if (!key) + key = rcu_dereference(sdata->default_unicast_key); @@ -45,7 +46,7 @@ Signed-off-by: Felix Fietkau + + ieee80211_8023_xmit(sdata, dev, sta, key, skb); + goto out; - ++ +skip_offload: + ieee80211_subif_start_xmit(skb, dev); out: diff --git a/package/kernel/mac80211/patches/subsys/341-mac80211-minstrel_ht-improve-ampdu-length-estimation.patch b/package/kernel/mac80211/patches/subsys/341-mac80211-minstrel_ht-improve-ampdu-length-estimation.patch index f450ca9ca9..a8e6e89954 100644 --- a/package/kernel/mac80211/patches/subsys/341-mac80211-minstrel_ht-improve-ampdu-length-estimation.patch +++ b/package/kernel/mac80211/patches/subsys/341-mac80211-minstrel_ht-improve-ampdu-length-estimation.patch @@ -27,8 +27,7 @@ Signed-off-by: Felix Fietkau - if (!mi->avg_ampdu_len) - return AVG_AMPDU_SIZE; + int duration; - -- return MINSTREL_TRUNC(mi->avg_ampdu_len); ++ + if (mi->avg_ampdu_len) + return MINSTREL_TRUNC(mi->avg_ampdu_len); + @@ -36,7 +35,8 @@ Signed-off-by: Felix Fietkau + return 1; + + duration = minstrel_get_duration(mi->max_tp_rate[0]); -+ + +- return MINSTREL_TRUNC(mi->avg_ampdu_len); + if (duration > 400 * 1000) + return 2; + diff --git a/package/kernel/mac80211/patches/subsys/349-mac80211-minstrel_ht-significantly-redesign-the-rate.patch b/package/kernel/mac80211/patches/subsys/349-mac80211-minstrel_ht-significantly-redesign-the-rate.patch index 7af13661a8..09f6fd2214 100644 --- a/package/kernel/mac80211/patches/subsys/349-mac80211-minstrel_ht-significantly-redesign-the-rate.patch +++ b/package/kernel/mac80211/patches/subsys/349-mac80211-minstrel_ht-significantly-redesign-the-rate.patch @@ -179,14 +179,14 @@ Signed-off-by: Felix Fietkau + if (!rate) return; - } - +- - i = 0; - if (n_rates > 1) { - random = prandom_u32(); - i = random % n_rates; - } - probe_rate = rates[i]; -- + -out: - mi->sample_rate = probe_rate; + mi->sample_rate = rate; @@ -584,13 +584,13 @@ Signed-off-by: Felix Fietkau - - if (!(mi->supported[sample_group] & BIT(sample_idx))) - return -1; -- ++ u8 seq; + - mrs = &mg->rates[sample_idx]; - sample_idx += MI_RATE(sample_group, 0); - - tp_rate1 = mi->max_tp_rate[0]; -+ u8 seq; - +- - /* Set tp_rate2 to the second highest max_tp_rate */ - if (minstrel_get_duration(mi->max_tp_rate[0]) > - minstrel_get_duration(mi->max_tp_rate[1])) { @@ -673,8 +673,7 @@ Signed-off-by: Felix Fietkau - else - sample_idx = minstrel_get_sample_rate(mp, mi); + return; - -- if (sample_idx < 0) ++ + if (mp->hw->max_rates == 1 && mp->sample_switch && + (mi->total_packets_cur >= SAMPLE_SWITCH_THR || + mp->sample_switch == 1)) @@ -682,7 +681,8 @@ Signed-off-by: Felix Fietkau + + if (time_is_before_jiffies(mi->sample_time)) + return; -+ + +- if (sample_idx < 0) + mi->sample_time = jiffies + MINSTREL_SAMPLE_INTERVAL; + sample_idx = minstrel_ht_get_sample_rate(mp, mi); + if (!sample_idx) From 1132340a22dad217e08918c0e403a4c9b63bf590 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 14 Feb 2021 19:06:45 +0100 Subject: [PATCH 21/25] mac80211: Update to version 5.10.16-1 The removed patches were applied upstream. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 6 +-- ...rolling-support-for-various-chipsets.patch | 14 ++--- ...62-brcmfmac-Disable-power-management.patch | 2 +- .../mac80211/patches/brcm/998-survey.patch | 8 +-- .../patches/build/050-lib80211_option.patch | 4 +- ...ryption-key-selection-for-802.3-xmit.patch | 54 ------------------- ...ac80211-fix-fast-rx-encryption-check.patch | 21 -------- ...add-rx-decapsulation-offload-support.patch | 2 +- ...-a-mistake-check-for-rx_stats-update.patch | 28 ---------- ...drop-tx-nulldata-packets-on-encrypte.patch | 25 --------- ...-station-rate-table-updates-on-assoc.patch | 38 ------------- .../500-mac80211_configure_antenna_gain.patch | 2 +- 12 files changed, 19 insertions(+), 185 deletions(-) delete mode 100644 package/kernel/mac80211/patches/subsys/313-mac80211-fix-encryption-key-selection-for-802.3-xmit.patch delete mode 100644 package/kernel/mac80211/patches/subsys/314-mac80211-fix-fast-rx-encryption-check.patch delete mode 100644 package/kernel/mac80211/patches/subsys/316-mac80211-fix-a-mistake-check-for-rx_stats-update.patch delete mode 100644 package/kernel/mac80211/patches/subsys/336-mac80211-do-not-drop-tx-nulldata-packets-on-encrypte.patch delete mode 100644 package/kernel/mac80211/patches/subsys/353-mac80211-fix-station-rate-table-updates-on-assoc.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 06fe948fa2..f6ad06452f 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.10-rc6-1 +PKG_VERSION:=5.10.16-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10-rc6/ -PKG_HASH:=24c1e84dc1e7bb52d4f67ce481c242f29212a4ceb7833af30e3c279a3f710832 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10.16/ +PKG_HASH:=12856db780c5023edc47e2d18486eb3346bb7c82f1f2fc48deb3b163142f7d2d PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index 403d1e5035..ab7cb669bb 100644 --- a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -456,7 +456,7 @@ v13: { --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c -@@ -4583,6 +4583,8 @@ static const struct wmi_ops wmi_tlv_ops +@@ -4585,6 +4585,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, @@ -467,7 +467,7 @@ v13: static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -7463,6 +7463,49 @@ ath10k_wmi_op_gen_peer_set_param(struct +@@ -7468,6 +7468,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -517,7 +517,7 @@ v13: static struct sk_buff * ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, enum wmi_sta_ps_mode psmode) -@@ -9151,6 +9194,9 @@ static const struct wmi_ops wmi_ops = { +@@ -9156,6 +9199,9 @@ static const struct wmi_ops wmi_ops = { .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -527,7 +527,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9221,6 +9267,8 @@ static const struct wmi_ops wmi_10_1_ops +@@ -9226,6 +9272,8 @@ static const struct wmi_ops wmi_10_1_ops .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -536,7 +536,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9293,6 +9341,8 @@ static const struct wmi_ops wmi_10_2_ops +@@ -9298,6 +9346,8 @@ static const struct wmi_ops wmi_10_2_ops .gen_delba_send = ath10k_wmi_op_gen_delba_send, .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, @@ -545,7 +545,7 @@ v13: /* .gen_pdev_enable_adaptive_cca not implemented */ }; -@@ -9364,6 +9414,8 @@ static const struct wmi_ops wmi_10_2_4_o +@@ -9369,6 +9419,8 @@ static const struct wmi_ops wmi_10_2_4_o ath10k_wmi_op_gen_pdev_enable_adaptive_cca, .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, .gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, @@ -554,7 +554,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9445,6 +9497,8 @@ static const struct wmi_ops wmi_10_4_ops +@@ -9450,6 +9502,8 @@ static const struct wmi_ops wmi_10_4_ops .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, .gen_echo = ath10k_wmi_op_gen_echo, .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, diff --git a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch index b5112bd682..e640849e6a 100644 --- a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch +++ b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2957,6 +2957,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2958,6 +2958,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ diff --git a/package/kernel/mac80211/patches/brcm/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch index cf70644e1d..9e9f4bbf8f 100644 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ b/package/kernel/mac80211/patches/brcm/998-survey.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2909,6 +2909,63 @@ done: +@@ -2910,6 +2910,63 @@ done: } static int @@ -64,7 +64,7 @@ brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev, int idx, u8 *mac, struct station_info *sinfo) { -@@ -3004,6 +3061,7 @@ static s32 brcmf_inform_single_bss(struc +@@ -3005,6 +3062,7 @@ static s32 brcmf_inform_single_bss(struc struct brcmu_chan ch; u16 channel; u32 freq; @@ -72,7 +72,7 @@ u16 notify_capability; u16 notify_interval; u8 *notify_ie; -@@ -3028,6 +3086,17 @@ static s32 brcmf_inform_single_bss(struc +@@ -3029,6 +3087,17 @@ static s32 brcmf_inform_single_bss(struc band = NL80211_BAND_5GHZ; freq = ieee80211_channel_to_frequency(channel, band); @@ -90,7 +90,7 @@ bss_data.chan = ieee80211_get_channel(wiphy, freq); bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); -@@ -5514,6 +5583,7 @@ static struct cfg80211_ops brcmf_cfg8021 +@@ -5515,6 +5584,7 @@ static struct cfg80211_ops brcmf_cfg8021 .leave_ibss = brcmf_cfg80211_leave_ibss, .get_station = brcmf_cfg80211_get_station, .dump_station = brcmf_cfg80211_dump_station, diff --git a/package/kernel/mac80211/patches/build/050-lib80211_option.patch b/package/kernel/mac80211/patches/build/050-lib80211_option.patch index b2465b0d7e..c1b1bc757f 100644 --- a/package/kernel/mac80211/patches/build/050-lib80211_option.patch +++ b/package/kernel/mac80211/patches/build/050-lib80211_option.patch @@ -1,6 +1,6 @@ --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig -@@ -187,7 +187,7 @@ config CFG80211_WEXT_EXPORT +@@ -188,7 +188,7 @@ config CFG80211_WEXT_EXPORT endif # CFG80211 config LIB80211 @@ -9,7 +9,7 @@ depends on m default n help -@@ -197,19 +197,19 @@ config LIB80211 +@@ -198,19 +198,19 @@ config LIB80211 Drivers should select this themselves if needed. config LIB80211_CRYPT_WEP diff --git a/package/kernel/mac80211/patches/subsys/313-mac80211-fix-encryption-key-selection-for-802.3-xmit.patch b/package/kernel/mac80211/patches/subsys/313-mac80211-fix-encryption-key-selection-for-802.3-xmit.patch deleted file mode 100644 index 9c9be2927a..0000000000 --- a/package/kernel/mac80211/patches/subsys/313-mac80211-fix-encryption-key-selection-for-802.3-xmit.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Felix Fietkau -Date: Wed, 16 Dec 2020 21:23:24 +0100 -Subject: [PATCH] mac80211: fix encryption key selection for 802.3 xmit - -When using WEP, the default unicast key needs to be selected, instead of -the STA PTK. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -4262,7 +4262,6 @@ netdev_tx_t ieee80211_subif_start_xmit_8 - struct ethhdr *ehdr = (struct ethhdr *)skb->data; - struct ieee80211_key *key; - struct sta_info *sta; -- bool offload = true; - - if (unlikely(skb->len < ETH_HLEN)) { - kfree_skb(skb); -@@ -4278,18 +4277,22 @@ netdev_tx_t ieee80211_subif_start_xmit_8 - - if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded || - !test_sta_flag(sta, WLAN_STA_AUTHORIZED) || -- sdata->control_port_protocol == ehdr->h_proto)) -- offload = false; -- else if ((key = rcu_dereference(sta->ptk[sta->ptk_idx])) && -- (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || -- key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)) -- offload = false; -- -- if (offload) -- ieee80211_8023_xmit(sdata, dev, sta, key, skb); -- else -- ieee80211_subif_start_xmit(skb, dev); -+ sdata->control_port_protocol == ehdr->h_proto)) -+ goto skip_offload; - -+ key = rcu_dereference(sta->ptk[sta->ptk_idx]); -+ if (!key) -+ key = rcu_dereference(sdata->default_unicast_key); -+ -+ if (key && (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || -+ key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)) -+ goto skip_offload; -+ -+ ieee80211_8023_xmit(sdata, dev, sta, key, skb); -+ goto out; -+ -+skip_offload: -+ ieee80211_subif_start_xmit(skb, dev); - out: - rcu_read_unlock(); - diff --git a/package/kernel/mac80211/patches/subsys/314-mac80211-fix-fast-rx-encryption-check.patch b/package/kernel/mac80211/patches/subsys/314-mac80211-fix-fast-rx-encryption-check.patch deleted file mode 100644 index 679960b83c..0000000000 --- a/package/kernel/mac80211/patches/subsys/314-mac80211-fix-fast-rx-encryption-check.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Felix Fietkau -Date: Wed, 16 Dec 2020 21:24:19 +0100 -Subject: [PATCH] mac80211: fix fast-rx encryption check - -When using WEP, the default unicast key needs to be selected, instead of -the STA PTK. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -4195,6 +4195,8 @@ void ieee80211_check_fast_rx(struct sta_ - - rcu_read_lock(); - key = rcu_dereference(sta->ptk[sta->ptk_idx]); -+ if (!key) -+ key = rcu_dereference(sdata->default_unicast_key); - if (key) { - switch (key->conf.cipher) { - case WLAN_CIPHER_SUITE_TKIP: diff --git a/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch b/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch index 6f7c7bd74a..02486372e9 100644 --- a/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch +++ b/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch @@ -89,7 +89,7 @@ Signed-off-by: Felix Fietkau /** --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c -@@ -409,6 +409,7 @@ static const char *hw_flag_names[] = { +@@ -405,6 +405,7 @@ static const char *hw_flag_names[] = { FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID), FLAG(AMPDU_KEYBORDER_SUPPORT), FLAG(SUPPORTS_TX_ENCAP_OFFLOAD), diff --git a/package/kernel/mac80211/patches/subsys/316-mac80211-fix-a-mistake-check-for-rx_stats-update.patch b/package/kernel/mac80211/patches/subsys/316-mac80211-fix-a-mistake-check-for-rx_stats-update.patch deleted file mode 100644 index 91a602bd27..0000000000 --- a/package/kernel/mac80211/patches/subsys/316-mac80211-fix-a-mistake-check-for-rx_stats-update.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Wen Gong -Date: Wed, 9 Dec 2020 11:06:29 +0800 -Subject: [PATCH] mac80211: fix a mistake check for rx_stats update - -It should be !is_multicast_ether_addr() in ieee80211_rx_h_sta_process() -for the rx_stats update, below commit remove the !, this patch is to -change it back. - -It lead the rx rate "iw wlan0 station dump" become invalid for some -scenario when IEEE80211_HW_USES_RSS is set. - -Fixes: 09a740ce352e ("mac80211: receive and process S1G beacons") -Signed-off-by: Wen Gong -Link: https://lore.kernel.org/r/1607483189-3891-1-git-send-email-wgong@codeaurora.org -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1758,7 +1758,7 @@ ieee80211_rx_h_sta_process(struct ieee80 - } else if (rx->sdata->vif.type == NL80211_IFTYPE_OCB) { - sta->rx_stats.last_rx = jiffies; - } else if (!ieee80211_is_s1g_beacon(hdr->frame_control) && -- is_multicast_ether_addr(hdr->addr1)) { -+ !is_multicast_ether_addr(hdr->addr1)) { - /* - * Mesh beacons will update last_rx when if they are found to - * match the current local configuration when processed. diff --git a/package/kernel/mac80211/patches/subsys/336-mac80211-do-not-drop-tx-nulldata-packets-on-encrypte.patch b/package/kernel/mac80211/patches/subsys/336-mac80211-do-not-drop-tx-nulldata-packets-on-encrypte.patch deleted file mode 100644 index d05217d1f8..0000000000 --- a/package/kernel/mac80211/patches/subsys/336-mac80211-do-not-drop-tx-nulldata-packets-on-encrypte.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Fri, 18 Dec 2020 20:08:06 +0100 -Subject: [PATCH] mac80211: do not drop tx nulldata packets on encrypted links - -ieee80211_tx_h_select_key drops any non-mgmt packets without a key when -encryption is used. This is wrong for nulldata packets that can't be -encrypted and are sent out for probing clients and indicating 4-address -mode. - -Reported-by: Sebastian Gottschall -Fixes: a0761a301746 ("mac80211: drop data frames without key on encrypted links") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -662,7 +662,7 @@ ieee80211_tx_h_select_key(struct ieee802 - if (!skip_hw && tx->key && - tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) - info->control.hw_key = &tx->key->conf; -- } else if (!ieee80211_is_mgmt(hdr->frame_control) && tx->sta && -+ } else if (ieee80211_is_data_present(hdr->frame_control) && tx->sta && - test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) { - return TX_DROP; - } diff --git a/package/kernel/mac80211/patches/subsys/353-mac80211-fix-station-rate-table-updates-on-assoc.patch b/package/kernel/mac80211/patches/subsys/353-mac80211-fix-station-rate-table-updates-on-assoc.patch deleted file mode 100644 index 7df24fa4bd..0000000000 --- a/package/kernel/mac80211/patches/subsys/353-mac80211-fix-station-rate-table-updates-on-assoc.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: Felix Fietkau -Date: Mon, 1 Feb 2021 00:59:14 +0100 -Subject: [PATCH] mac80211: fix station rate table updates on assoc - -If the driver uses .sta_add, station entries are only uploaded after the sta -is in assoc state. Fix early station rate table updates by deferring them -until the sta has been uploaded - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/driver-ops.c -+++ b/net/mac80211/driver-ops.c -@@ -125,8 +125,11 @@ int drv_sta_state(struct ieee80211_local - } else if (old_state == IEEE80211_STA_AUTH && - new_state == IEEE80211_STA_ASSOC) { - ret = drv_sta_add(local, sdata, &sta->sta); -- if (ret == 0) -+ if (ret == 0) { - sta->uploaded = true; -+ if (rcu_dereference(sta->sta.rates)) -+ drv_sta_rate_tbl_update(local, sdata, &sta->sta); -+ } - } else if (old_state == IEEE80211_STA_ASSOC && - new_state == IEEE80211_STA_AUTH) { - drv_sta_remove(local, sdata, &sta->sta); ---- a/net/mac80211/rate.c -+++ b/net/mac80211/rate.c -@@ -960,7 +960,8 @@ int rate_control_set_rates(struct ieee80 - if (old) - kfree_rcu(old, rcu_head); - -- drv_sta_rate_tbl_update(hw_to_local(hw), sta->sdata, pubsta); -+ if (sta->uploaded) -+ drv_sta_rate_tbl_update(hw_to_local(hw), sta->sdata, pubsta); - - ieee80211_sta_set_expected_throughput(pubsta, sta_get_expected_throughput(sta)); - diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 48c70f8db2..7cd0417363 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -87,7 +87,7 @@ CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1400,6 +1400,7 @@ struct ieee80211_local { +@@ -1401,6 +1401,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ From 7d6a636918bccf68b49324729759e7c569105f71 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Feb 2021 23:09:53 +0100 Subject: [PATCH 22/25] build: fix getting ABI version for binary packages from the same source package We can't rely on the .version file being created yet, so use package variables to get it Signed-off-by: Felix Fietkau --- include/feeds.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/feeds.mk b/include/feeds.mk index 5676cc4a8f..98e315bceb 100644 --- a/include/feeds.mk +++ b/include/feeds.mk @@ -43,5 +43,5 @@ endef # 1: package name define GetABISuffix -$(if $(filter-out kmod-%,$(1)),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v)))) +$(if $(filter-out kmod-%,$(1)),$(if $(ABIV_$(1)),$(ABIV_$(1)),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v))))) endef From 46b6ee7ffc457af8aad1a0f7e5936f50041141d8 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Feb 2021 23:59:18 +0100 Subject: [PATCH 23/25] util-linux: move libuuid BuildPackage line further up to fix ABI versioning After the ABI version rework, packages need to be declared in the order of their dependencies, so that dependent packages will use the right ABI version Signed-off-by: Felix Fietkau --- package/utils/util-linux/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index f4b870cc47..b385030e39 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -791,11 +791,13 @@ define Package/wipefs/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/wipefs $(1)/usr/sbin/ endef +# these lines need to be ordered by dependency because of ABI versioning +$(eval $(call BuildPackage,libuuid)) $(eval $(call BuildPackage,libblkid)) $(eval $(call BuildPackage,libfdisk)) + $(eval $(call BuildPackage,libmount)) $(eval $(call BuildPackage,libsmartcols)) -$(eval $(call BuildPackage,libuuid)) $(eval $(call BuildPackage,agetty)) $(eval $(call BuildPackage,blkdiscard)) $(eval $(call BuildPackage,blkid)) From 6dba010157f2ac6485bb3dee6a5ed4450fb09463 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sat, 12 Dec 2020 20:57:21 -1000 Subject: [PATCH 24/25] build/prereq: require make 4.1 or later FS#2086 "IS_TTY in the makefile is broken" reports flawed detection of stdout piping to a file. The issue describes how e.g. terminal color codes and up in log files if running make like `make > log.txt`. The proposed solution uses the make variable "MAKE_TERMOUT", which was introduced in make 4.1. All major distributions seem to updated to 4.1 or later, so this ideally dosen't break anything. Signed-off-by: Paul Spooren --- README.md | 2 +- include/prereq-build.mk | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 21acbf4b80..b30819205b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ the [Build System Setup](https://openwrt.org/docs/guide-developer/build-system/i documentation. ``` -gcc binutils bzip2 flex python3 perl make find grep diff unzip gawk getopt +gcc binutils bzip2 flex python3 perl make4.1+ find grep diff unzip gawk getopt subversion libz-dev libc-dev rsync ``` diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 6dce11cba2..f88e853b52 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -11,8 +11,8 @@ PKG_NAME:=Build dependency # Required for the toolchain $(eval $(call TestHostCommand,working-make, \ - Please install GNU make v3.82 or later. (This version has bugs), \ - $(MAKE) -v | grep -E 'Make (3\.8[2-9]|3\.9[0-9]|[4-9]\.)')) + Please install GNU make v4.1 or later., \ + $(MAKE) -v | grep -E 'Make (4\.[1-9]|[5-9]\.)')) $(eval $(call TestHostCommand,case-sensitive-fs, \ OpenWrt can only be built on a case-sensitive filesystem, \ From a015d9170851509a58e063dd82a054e98fb48700 Mon Sep 17 00:00:00 2001 From: "R. Diez" Date: Wed, 10 Jun 2020 11:33:26 +0200 Subject: [PATCH 25/25] build: IS_TTY is now set according to GNU Make's MAKE_TERMOUT The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. Fixes: FS#2086 The logic for IS_TTY was broken, because it was testing stdin instead of stdout. MAKE_TERMOUT was introduced in GNU Make version 4.1 (05 Oct 2014), so it should be available everywhere nowadays. Signed-off-by: R. Diez --- include/toplevel.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/toplevel.mk b/include/toplevel.mk index 744695b19c..48ea44aa24 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -4,7 +4,7 @@ PREP_MK= OPENWRT_BUILD= QUIET=0 -export IS_TTY=$(shell tty -s && echo 1 || echo 0) +export IS_TTY=$(if $(MAKE_TERMOUT),1,0) include $(TOPDIR)/include/verbose.mk