From 1ec6fc4dcba16045a6bfcc493bdbe892de1265a9 Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez Date: Fri, 14 May 2021 23:40:40 +0200 Subject: [PATCH 01/23] uclient: update to Git version 2021-05-14 6a6011d uclient-http: set eof mark when content-length is 0 19571e4 tests: fix help usage test for uclient built with sanitizer c5fc04b tests: fix help usage test Signed-off-by: Baptiste Jonglez --- package/libs/uclient/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/uclient/Makefile b/package/libs/uclient/Makefile index 419aff15e1..398a27bb98 100644 --- a/package/libs/uclient/Makefile +++ b/package/libs/uclient/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uclient.git -PKG_MIRROR_HASH:=b0f6ee3bc8e63e8408338c6ff4f214f2f83997a57802062401bdc82931ba9b73 -PKG_SOURCE_DATE:=2021-04-03 -PKG_SOURCE_VERSION:=64e00d6db4c3fc98ec3e8526072abadb7ed9ec0e +PKG_MIRROR_HASH:=7c443cac02a734dd312c65618f4de17248d188317f30a9fac192c1503b3d5c05 +PKG_SOURCE_DATE:=2021-05-14 +PKG_SOURCE_VERSION:=6a6011df3429ffa5958d12b1327eeda4fd9daa47 CMAKE_INSTALL:=1 PKG_BUILD_DEPENDS:=ustream-ssl From f62aa9e7816fd0601a7997d87c89767939a6afcf Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 15 May 2021 09:13:19 +0200 Subject: [PATCH 02/23] mt76: update to the latest version 28b162366d09 mt76: fix calling mt76_get_of_eeprom with an offset for pre-cal data 9d736545bb5a mt76: mt7915: disable pre-calibration support for now Signed-off-by: Felix Fietkau --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 9f36a83aca..5104c3ec53 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2021-05-13 -PKG_SOURCE_VERSION:=e969ab10a03403e6c869e91d4d41a71c6340657b -PKG_MIRROR_HASH:=eb57d82267d5765c270fc394ad81baacd8d02cde859f813236ad76a89c5ea944 +PKG_SOURCE_DATE:=2021-05-15 +PKG_SOURCE_VERSION:=9d736545bb5ac9707e60b7900b7d6b290492e24d +PKG_MIRROR_HASH:=8fd98f488579c18cfd8c442cff1796dcd70e2ecbc59c5d5b92ee8c0f06efafcf PKG_MAINTAINER:=Felix Fietkau PKG_BUILD_PARALLEL:=1 From f8c98ee6c25e83fbf8afe27f1cda3bb70a70bd8d Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 16 May 2021 00:33:26 +0100 Subject: [PATCH 03/23] fstools: update to git HEAD c44b40b overlay: fix syncronizing typo b5397a1 fstools: block: fix segfault on mount with no target bd7cc8d block: use dynamically allocated target string 6d8450e blockd: use allocated strings instead of fixed buffers d47909e libblkid-tiny: fix buffer overflow 67d2297 block: match device path instead of assuming /dev/%s 2aeba88 block: allow autofs and umount commands also on MTD/UBI Signed-off-by: Daniel Golle --- package/system/fstools/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index 5331f0ba28..0ef20eea54 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git -PKG_MIRROR_HASH:=c9a5647f69dd17ce9d7cd535c9e58055171f7f4af73d2985567ccfc18a2be97f -PKG_SOURCE_DATE:=2021-03-19 -PKG_SOURCE_VERSION:=964d1e3af0e111bad6d393f8a3be702e334c2398 +PKG_MIRROR_HASH:=98a82c9387f248f57f30c88e6b8cc3cae1d6a83bf39d1ef92ca853c638082b9d +PKG_SOURCE_DATE:=2021-05-16 +PKG_SOURCE_VERSION:=2aeba8876ae75f4492093bd06b3a7c2b65805541 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From 844598dcbbd1dd042c1e8ed0b968ec6ce079b7f0 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Thu, 13 May 2021 16:08:14 +0300 Subject: [PATCH 04/23] umdns: bump to git HEAD 777a0b service: fix compilation with GCC 10 Signed-off-by: Stijn Tintel --- package/network/services/umdns/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/umdns/Makefile b/package/network/services/umdns/Makefile index 9a5f46a705..a25233ad5a 100644 --- a/package/network/services/umdns/Makefile +++ b/package/network/services/umdns/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2021-01-26 -PKG_SOURCE_VERSION:=78aa36b0e9808e801c527c6dc47320e593309522 -PKG_MIRROR_HASH:=241833f2bf2f3366f356703159be386862ef747d9b253af6c13555f252cc970d +PKG_SOURCE_DATE:=2021-05-13 +PKG_SOURCE_VERSION:=b777a0b53f7d89ab2a60e3eed7d98036806da9a4 +PKG_MIRROR_HASH:=54992acf7edd32610de7bcb0ea7c58b20f69bf1ac20be69e76abcff41f25e775 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=LGPL-2.1 From e74d81ece2e2932a4f370d8e6d180061a6a2c229 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Fri, 14 May 2021 17:11:42 +0300 Subject: [PATCH 05/23] grub2: bump to 2.06-rc1 When building GRUB with binutils 2.35.2 or later, an error occurs due to a section .note.gnu.property that is placed at an offset such that objcopy needs to pad the img file with zeros. This in turn causes the following error: "error: Decompressor is too big.". The fix accepted by upstream patches a python script that isn't executed at all when building GRUB with OpenWrt buildroot. There's another patch that patches the files generated by that python script directly, but by including it we would deviate further from upstream. Instead of doing that, simply bump to the latest release candidate. As one of the fixes for the CVEs causes grub to crash on some x86 hardware using legacy BIOS when compiled with -O2, filter -O2 and -O3 out of TARGET_CFLAGS. Fixes the following CVEs: - CVE-2020-14372 - CVE-2020-25632 - CVE-2020-25647 - CVE-2020-27749 - CVE-2020-27779 - CVE-2021-3418 - CVE-2021-20225 - CVE-2021-20233 Runtime-tested on x86/64. Fixes: FS#3790 Suggested-by: Dirk Neukirchen Signed-off-by: Stijn Tintel Acked-by: Kevin Darbyshire-Bryant --- package/boot/grub2/Makefile | 10 +-- ...-verifiers-Blocklist-fallout-cleanup.patch | 31 ------- .../grub2/patches/100-grub_setup_root.patch | 87 ++++++++++--------- 3 files changed, 49 insertions(+), 79 deletions(-) delete mode 100644 package/boot/grub2/patches/001-verifiers-Blocklist-fallout-cleanup.patch diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile index 46e3597cc2..b3cb5e076f 100644 --- a/package/boot/grub2/Makefile +++ b/package/boot/grub2/Makefile @@ -10,12 +10,12 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=grub PKG_CPE_ID:=cpe:/a:gnu:grub2 -PKG_VERSION:=2.04 -PKG_RELEASE:=3 +PKG_VERSION:=2.06~rc1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=@GNU/grub -PKG_HASH:=e5292496995ad42dabe843a0192cf2a2c502e7ffcc7479398232b10a472df77d +PKG_SOURCE_URL:=https://alpha.gnu.org/gnu/grub +PKG_HASH:=2c87f1f21e2ab50043e6cd9163c08f1b6c3a6171556bf23ff9ed65b074145484 HOST_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=grub2/host @@ -84,7 +84,7 @@ HOST_MAKE_FLAGS += \ TARGET_RANLIB=$(TARGET_RANLIB) \ LIBLZMA=$(STAGING_DIR_HOST)/lib/liblzma.a -TARGET_CFLAGS := $(filter-out -fno-plt,$(TARGET_CFLAGS)) +TARGET_CFLAGS := $(filter-out -O2 -O3 -fno-plt,$(TARGET_CFLAGS)) define Host/Configure $(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in diff --git a/package/boot/grub2/patches/001-verifiers-Blocklist-fallout-cleanup.patch b/package/boot/grub2/patches/001-verifiers-Blocklist-fallout-cleanup.patch deleted file mode 100644 index 74d68a6cda..0000000000 --- a/package/boot/grub2/patches/001-verifiers-Blocklist-fallout-cleanup.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: David Michael -Date: Fri, 5 Jul 2019 07:45:59 -0400 -Subject: [PATCH] verifiers: Blocklist fallout cleanup - -Blocklist fallout cleanup after commit 5c6f9bc15 (generic/blocklist: Fix -implicit declaration of function grub_file_filter_disable_compression()). - -Signed-off-by: David Michael -Reviewed-by: Daniel Kiper ---- - ---- a/grub-core/osdep/generic/blocklist.c -+++ b/grub-core/osdep/generic/blocklist.c -@@ -59,7 +59,7 @@ grub_install_get_blocklist (grub_device_ - - grub_disk_cache_invalidate_all (); - -- file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | FILE_TYPE_NO_DECOMPRESS); -+ file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | GRUB_FILE_TYPE_NO_DECOMPRESS); - if (file) - { - if (grub_file_size (file) != core_size) -@@ -116,7 +116,7 @@ grub_install_get_blocklist (grub_device_ - - grub_file_t file; - /* Now read the core image to determine where the sectors are. */ -- file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | FILE_TYPE_NO_DECOMPRESS); -+ file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | GRUB_FILE_TYPE_NO_DECOMPRESS); - if (! file) - grub_util_error ("%s", grub_errmsg); - diff --git a/package/boot/grub2/patches/100-grub_setup_root.patch b/package/boot/grub2/patches/100-grub_setup_root.patch index df671bc9d2..e075d052cb 100644 --- a/package/boot/grub2/patches/100-grub_setup_root.patch +++ b/package/boot/grub2/patches/100-grub_setup_root.patch @@ -1,3 +1,41 @@ +--- a/include/grub/util/install.h ++++ b/include/grub/util/install.h +@@ -198,13 +198,13 @@ grub_install_get_image_target (const cha + void + grub_util_bios_setup (const char *dir, + const char *boot_file, const char *core_file, +- const char *dest, int force, ++ const char *root, const char *dest, int force, + int fs_probe, int allow_floppy, + int add_rs_codes, int warn_short_mbr_gap); + void + grub_util_sparc_setup (const char *dir, + const char *boot_file, const char *core_file, +- const char *dest, int force, ++ const char *root, const char *dest, int force, + int fs_probe, int allow_floppy, + int add_rs_codes, int warn_short_mbr_gap); + +--- a/util/grub-install.c ++++ b/util/grub-install.c +@@ -1720,7 +1720,7 @@ main (int argc, char *argv[]) + /* Now perform the installation. */ + if (install_bootsector) + grub_util_bios_setup (platdir, "boot.img", "core.img", +- install_drive, force, ++ NULL, install_drive, force, + fs_probe, allow_floppy, add_rs_codes, + !grub_install_is_short_mbrgap_supported ()); + break; +@@ -1747,7 +1747,7 @@ main (int argc, char *argv[]) + /* Now perform the installation. */ + if (install_bootsector) + grub_util_sparc_setup (platdir, "boot.img", "core.img", +- install_drive, force, ++ NULL, install_drive, force, + fs_probe, allow_floppy, + 0 /* unused */, 0 /* unused */ ); + break; --- a/util/grub-setup.c +++ b/util/grub-setup.c @@ -87,6 +87,8 @@ static struct argp_option options[] = { @@ -38,18 +76,19 @@ - dest_dev, arguments.force, + arguments.root_dev, dest_dev, arguments.force, arguments.fs_probe, arguments.allow_floppy, - arguments.add_rs_codes); + arguments.add_rs_codes, 0); --- a/util/setup.c +++ b/util/setup.c -@@ -252,13 +252,12 @@ identify_partmap (grub_disk_t disk __att +@@ -252,14 +252,13 @@ identify_partmap (grub_disk_t disk __att void SETUP (const char *dir, const char *boot_file, const char *core_file, - const char *dest, int force, + const char *root, const char *dest, int force, int fs_probe, int allow_floppy, - int add_rs_codes __attribute__ ((unused))) /* unused on sparc64 */ + int add_rs_codes __attribute__ ((unused)), /* unused on sparc64 */ + int warn_small) { char *core_path; char *boot_img, *core_img, *boot_path; @@ -57,7 +96,7 @@ size_t boot_size, core_size; grub_uint16_t core_sectors; grub_device_t root_dev = 0, dest_dev, core_dev; -@@ -307,7 +306,10 @@ SETUP (const char *dir, +@@ -311,7 +310,10 @@ SETUP (const char *dir, core_dev = dest_dev; @@ -69,7 +108,7 @@ char **root_devices = grub_guess_root_devices (dir); char **cur; int found = 0; -@@ -320,6 +322,8 @@ SETUP (const char *dir, +@@ -324,6 +326,8 @@ SETUP (const char *dir, char *drive; grub_device_t try_dev; @@ -78,41 +117,3 @@ drive = grub_util_get_grub_dev (*cur); if (!drive) continue; ---- a/include/grub/util/install.h -+++ b/include/grub/util/install.h -@@ -191,13 +191,13 @@ grub_install_get_image_target (const cha - void - grub_util_bios_setup (const char *dir, - const char *boot_file, const char *core_file, -- const char *dest, int force, -+ const char *root, const char *dest, int force, - int fs_probe, int allow_floppy, - int add_rs_codes); - void - grub_util_sparc_setup (const char *dir, - const char *boot_file, const char *core_file, -- const char *dest, int force, -+ const char *root, const char *dest, int force, - int fs_probe, int allow_floppy, - int add_rs_codes); - ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -1712,7 +1712,7 @@ main (int argc, char *argv[]) - /* Now perform the installation. */ - if (install_bootsector) - grub_util_bios_setup (platdir, "boot.img", "core.img", -- install_drive, force, -+ NULL, install_drive, force, - fs_probe, allow_floppy, add_rs_codes); - break; - } -@@ -1738,7 +1738,7 @@ main (int argc, char *argv[]) - /* Now perform the installation. */ - if (install_bootsector) - grub_util_sparc_setup (platdir, "boot.img", "core.img", -- install_drive, force, -+ NULL, install_drive, force, - fs_probe, allow_floppy, - 0 /* unused */ ); - break; From 23f98b3eb7ab34b66896c5eae7695c22cc24cd39 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 16 May 2021 09:54:50 +0100 Subject: [PATCH 06/23] fstools: add missing #define _GNU_SOURCE asprintf requires _GNU_SOURCE to be defined. Set it. Signed-off-by: Daniel Golle --- package/system/fstools/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index 0ef20eea54..d9009c4365 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git -PKG_MIRROR_HASH:=98a82c9387f248f57f30c88e6b8cc3cae1d6a83bf39d1ef92ca853c638082b9d +PKG_MIRROR_HASH:=41c9c51d193f5150db67fcd898b6ea904b88476c94cdfd021d81e2711441b430 PKG_SOURCE_DATE:=2021-05-16 -PKG_SOURCE_VERSION:=2aeba8876ae75f4492093bd06b3a7c2b65805541 +PKG_SOURCE_VERSION:=3d40a1b591cd569f95891116cd033b496de0f92b CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From bf8c16dfa2cddd529f889510ca5fa5160606c325 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Sat, 8 May 2021 17:34:30 -0400 Subject: [PATCH 07/23] ath79: set lzma-loader variables to null by default This fixes a small regression where the lzma-loader variable values are being shared between boards that require different configurations. If not set to "" globally, a device without these settings will just take the last values another device has set before in the queue. Fixes: 1b8bd17c2d07 ("ath79: lzma-loader: allow setting custom kernel magic") Signed-off-by: Michael Pratt [add detailed explanation to the commit message] Signed-off-by: Adrian Schmutzler --- target/linux/ath79/image/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile index d8b8800d91..3c126f479e 100644 --- a/target/linux/ath79/image/Makefile +++ b/target/linux/ath79/image/Makefile @@ -70,6 +70,10 @@ define Device/Default BLOCKSIZE := 64k KERNEL := kernel-bin | append-dtb | lzma | uImage lzma KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma + LOADER_KERNEL_MAGIC := + LOADER_FLASH_MAX := + LOADER_FLASH_OFFS := + LOADER_TYPE := COMPILE := IMAGES := sysupgrade.bin IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \ From cf3f1f82eaa95c72b3b2620c6da15a81f8d57ba7 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Sun, 16 May 2021 23:48:04 +0200 Subject: [PATCH 08/23] ramips: fix SUPPORTED_DEVICES for ALFA Network devices Vendor firmware expects model name without manufacturer name inside 'supported_devices' part of metadata. This allows direct upgrade to OpenWrt from vendor's GUI. Signed-off-by: Piotr Dymacz --- target/linux/ramips/image/mt7620.mk | 3 +++ target/linux/ramips/image/mt7621.mk | 1 + target/linux/ramips/image/mt76x8.mk | 1 + 3 files changed, 5 insertions(+) diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 3caeecebee..ddb09baa08 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -33,6 +33,7 @@ define Device/alfa-network_ac1200rm DEVICE_VENDOR := ALFA Network DEVICE_MODEL := AC1200RM DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci uboot-envtools + SUPPORTED_DEVICES += ac1200rm endef TARGET_DEVICES += alfa-network_ac1200rm @@ -43,6 +44,7 @@ define Device/alfa-network_r36m-e4g DEVICE_MODEL := R36M-E4G DEVICE_PACKAGES := kmod-i2c-ralink kmod-usb2 kmod-usb-ohci uboot-envtools \ uqmi + SUPPORTED_DEVICES += r36m-e4g endef TARGET_DEVICES += alfa-network_r36m-e4g @@ -53,6 +55,7 @@ define Device/alfa-network_tube-e4g DEVICE_MODEL := Tube-E4G DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci uboot-envtools uqmi -iwinfo \ -kmod-rt2800-soc -wpad-basic-wolfssl + SUPPORTED_DEVICES += tube-e4g endef TARGET_DEVICES += alfa-network_tube-e4g diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 48448c2ab1..b1c224ca16 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -118,6 +118,7 @@ define Device/alfa-network_quad-e4g DEVICE_MODEL := Quad-E4G DEVICE_PACKAGES := kmod-ata-ahci kmod-sdhci-mt7620 kmod-usb3 uboot-envtools \ -wpad-basic-wolfssl + SUPPORTED_DEVICES += quad-e4g endef TARGET_DEVICES += alfa-network_quad-e4g diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index d5a9684dba..c5a0baa1cb 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -34,6 +34,7 @@ define Device/alfa-network_awusfree1 DEVICE_VENDOR := ALFA Network DEVICE_MODEL := AWUSFREE1 DEVICE_PACKAGES := uboot-envtools + SUPPORTED_DEVICES += awusfree1 endef TARGET_DEVICES += alfa-network_awusfree1 From e0c6506158fa4bba3f2b8ed3b56264099513eee2 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 3 Feb 2021 10:24:02 +0100 Subject: [PATCH 09/23] base-files: change logging for upgrade on fwtool Remove vn call in favour of v call. This commit serves as preparation for removing the v function call. Signed-off-by: Florian Eckert [alter slightly to prevent double space after colon] Signed-off-by: Adrian Schmutzler --- package/base-files/files/lib/upgrade/fwtool.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/base-files/files/lib/upgrade/fwtool.sh b/package/base-files/files/lib/upgrade/fwtool.sh index 3826bf5c30..a45f3bbc73 100644 --- a/package/base-files/files/lib/upgrade/fwtool.sh +++ b/package/base-files/files/lib/upgrade/fwtool.sh @@ -81,12 +81,12 @@ fwtool_check_image() { done v "Device $device not supported by this image" - vn "Supported devices:" + local devices="Supported devices:" for k in $dev_keys; do json_get_var dev "$k" - _vn " $dev" + devices="$devices $dev" done - _v + v "$devices" return 1 } From 8e7c9f5393e6c96a9c13da0f5b407a6912523e77 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 15 May 2021 23:40:50 +0200 Subject: [PATCH 10/23] octeon: create shared DTSI for Ubiquiti E300 platform EdgeRouter 4 and upcoming EdgeRouter 6P and 12 have similar setup, so create a shared DTSI to prevent duplicate code. Signed-off-by: Dan Brown [reorder/squash commits, add description, move ethernet@0 to DTS] Signed-off-by: Adrian Schmutzler --- .../cn7130_ubnt_edgerouter-4.dts | 195 +---------------- .../cn7130_ubnt_edgerouter-e300.dtsi | 205 ++++++++++++++++++ 2 files changed, 206 insertions(+), 194 deletions(-) create mode 100644 target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts index a89455c613..d8dabfc370 100644 --- a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts @@ -1,180 +1,14 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "cn71xx.dtsi" - -#include -#include +#include "cn7130_ubnt_edgerouter-e300.dtsi" / { compatible = "ubnt,edgerouter-4", "cavium,cn7130"; model = "Ubiquiti EdgeRouter 4"; - - aliases { - /* White + Blinking Blue */ - led-boot = &led_power_white; - /* Blue + Blinking White */ - led-failsafe = &led_power_blue; - /* Constant Blue */ - led-running = &led_power_blue; - /* Blue + Blinking White */ - led-upgrade = &led_power_blue; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x00000000>, - <0x0 0x10000000>, - <0x0 0x20000000>, - <0x0 0x30000000>; - }; - - leds { - compatible = "gpio-leds"; - - led_power_blue: power_blue { - label = "blue:power"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - led_power_white: power_white { - label = "white:power"; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <20>; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - sfp: sfp { - compatible = "sff,sfp"; - i2c-bus = <&twsi0>; - /* Pins 12, 13 and 14 gets pulled low when SFP is plugged in */ - mod-def0-gpio = <&gpio 12 GPIO_ACTIVE_LOW>; - }; -}; - -&uart0 { - status = "okay"; -}; - -&usb0 { - status = "okay"; -}; - -&xhci0 { - status = "okay"; - dr_mode = "host"; -}; - -&twsi0 { - status = "okay"; - - sfp_eeprom@50 { - compatible = "at,24c04"; - reg = <0x50>; - }; - - sfp_eeprom@51 { - compatible = "at,24c04"; - reg = <0x51>; - }; -}; - -&spi { - status = "okay"; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "Macronix,mx25l6405d", "spi-flash"; - reg = <0>; - spi-max-frequency = <25000000>; - - partition@0 { - label = "boot0"; - read-only; - reg = <0x000000 0x300000>; - }; - - partition@300000 { - label = "dummy"; - read-only; - reg = <0x300000 0x100000>; - }; - - eeprom: partition@400000 { - label = "eeprom"; - read-only; - reg = <0x400000 0x10000>; - }; - }; -}; - -&mmc { - status = "okay"; - - mmc-slot@0 { - compatible = "mmc-slot"; - reg = <0>; - non-removable; - max-frequency = <26000000>; - voltage-ranges = <3300 3300>; - bus-width = <8>; - }; -}; - -&smi0 { - status = "okay"; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - interrupts = <17 8>; - interrupt-parent = <&gpio>; - compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; - reg = <4>; - sfp = <&sfp>; - }; - - phy5: ethernet-phy@5 { - device_type = "ethernet-phy"; - interrupts = <17 8>; - interrupt-parent = <&gpio>; - compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; - reg = <5>; - }; - - phy6: ethernet-phy@6 { - device_type = "ethernet-phy"; - interrupts = <17 8>; - interrupt-parent = <&gpio>; - compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; - reg = <6>; - }; - - phy7: ethernet-phy@7 { - device_type = "ethernet-phy"; - interrupts = <17 8>; - interrupt-parent = <&gpio>; - compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; - reg = <7>; - }; }; &pip { - status = "okay"; - interface@0 { - status = "okay"; - ethernet@0 { label = "lan3"; status = "okay"; @@ -182,32 +16,5 @@ phy-handle = <&phy4>; mtd-mac-address = <&eeprom 0>; }; - - ethernet@1 { - label = "lan0"; - status = "okay"; - phy-mode = "sgmii"; - phy-handle = <&phy5>; - mtd-mac-address = <&eeprom 0>; - mtd-mac-address-increment = <(1)>; - }; - - ethernet@2 { - label = "lan1"; - status = "okay"; - phy-mode = "sgmii"; - phy-handle = <&phy6>; - mtd-mac-address = <&eeprom 0>; - mtd-mac-address-increment = <(2)>; - }; - - ethernet@3 { - label = "lan2"; - status = "okay"; - phy-mode = "sgmii"; - phy-handle = <&phy7>; - mtd-mac-address = <&eeprom 0>; - mtd-mac-address-increment = <(3)>; - }; }; }; diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi new file mode 100644 index 0000000000..7d4c7f0de9 --- /dev/null +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi @@ -0,0 +1,205 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "cn71xx.dtsi" + +#include +#include + +/ { + compatible = "ubnt,edgerouter-e300", "cavium,cn7130"; + model = "Ubiquiti EdgeRouter E300 series"; + + aliases { + /* White + Blinking Blue */ + led-boot = &led_power_white; + /* Blue + Blinking White */ + led-failsafe = &led_power_blue; + /* Constant Blue */ + led-running = &led_power_blue; + /* Blue + Blinking White */ + led-upgrade = &led_power_blue; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x00000000>, + <0x0 0x10000000>, + <0x0 0x20000000>, + <0x0 0x30000000>; + }; + + leds { + compatible = "gpio-leds"; + + led_power_blue: power_blue { + label = "blue:power"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led_power_white: power_white { + label = "white:power"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + sfp: sfp { + compatible = "sff,sfp"; + i2c-bus = <&twsi0>; + /* Pins 12, 13 and 14 gets pulled low when SFP is plugged in */ + mod-def0-gpio = <&gpio 12 GPIO_ACTIVE_LOW>; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usb0 { + status = "okay"; +}; + +&xhci0 { + status = "okay"; + dr_mode = "host"; +}; + +&twsi0 { + status = "okay"; + + sfp_eeprom@50 { + compatible = "at,24c04"; + reg = <0x50>; + }; + + sfp_eeprom@51 { + compatible = "at,24c04"; + reg = <0x51>; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "Macronix,mx25l6405d", "spi-flash"; + reg = <0>; + spi-max-frequency = <25000000>; + + partition@0 { + label = "boot0"; + read-only; + reg = <0x000000 0x300000>; + }; + + partition@300000 { + label = "dummy"; + read-only; + reg = <0x300000 0x100000>; + }; + + eeprom: partition@400000 { + label = "eeprom"; + read-only; + reg = <0x400000 0x10000>; + }; + }; +}; + +&mmc { + status = "okay"; + + mmc-slot@0 { + compatible = "mmc-slot"; + reg = <0>; + non-removable; + max-frequency = <26000000>; + voltage-ranges = <3300 3300>; + bus-width = <8>; + }; +}; + +&smi0 { + status = "okay"; + + phy4: ethernet-phy@4 { + device_type = "ethernet-phy"; + interrupts = <17 8>; + interrupt-parent = <&gpio>; + compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; + reg = <4>; + sfp = <&sfp>; + }; + + phy5: ethernet-phy@5 { + device_type = "ethernet-phy"; + interrupts = <17 8>; + interrupt-parent = <&gpio>; + compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; + reg = <5>; + }; + + phy6: ethernet-phy@6 { + device_type = "ethernet-phy"; + interrupts = <17 8>; + interrupt-parent = <&gpio>; + compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; + reg = <6>; + }; + + phy7: ethernet-phy@7 { + device_type = "ethernet-phy"; + interrupts = <17 8>; + interrupt-parent = <&gpio>; + compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; + reg = <7>; + }; +}; + +&pip { + status = "okay"; + + interface@0 { + status = "okay"; + + ethernet@1 { + label = "lan0"; + status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&phy5>; + mtd-mac-address = <&eeprom 0>; + mtd-mac-address-increment = <(1)>; + }; + + ethernet@2 { + label = "lan1"; + status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&phy6>; + mtd-mac-address = <&eeprom 0>; + mtd-mac-address-increment = <(2)>; + }; + + ethernet@3 { + label = "lan2"; + status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&phy7>; + mtd-mac-address = <&eeprom 0>; + mtd-mac-address-increment = <(3)>; + }; + }; +}; From 6ee3680614047f7732731ebbaac946a93ab4f693 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 12 May 2021 14:48:01 +0200 Subject: [PATCH 11/23] octeon: add new target and support for Ubiquiti EdgeRouter 6P Ubiquiti EdgeRouter 6P is 6 port router with similar specifications as the EdgeRouter 4, support for which was added in commit dd651e54cc5eadba480a56a7d2c18471e560f491 There are five 10/100/1000 Mbps RJ/Copper ports and one 1000 Mbps SFP port. SoC: Octeon Cavium 7130 (Cavium 3) at 1000MHz Memory: 1GiB DDR3 Flash: 2x2M chips with uboots (chainloaded) + 512K eeprom LEDs: 1x for power status (white/blue, controllable) and 6x for ethernet and SFP ports (no control over them) Buttons: 1x Reset Serial: 1x RJ45 port on front panel. 115200 baud, 8N1 USB: 1x USB3.0 on front panel MII: 1x QSGMII from SoC PHY: 1x Vitesse VSC8504 of which 4 ports are used (phys 4-7) 1x Vitesse VSC8514 of which 2 ports are used (phys 8-9) Network port mapping - eth0 on device maps to lan0 and phy5 - eth1 on device maps to lan1 and phy6 - eth2 on device maps to lan2 and phy7 - eth3 on device maps to lan3 and phy8 - eth4 on device maps to lan4 and phy9 - eth5 (SFP) on device maps to lan5 and phy4 What is not working: - There is no port status available before it goes up - SFP have no additional status and presented as no different from eth - Power-over-ethernet (passive) support has not been tested How to flash the firmware: - copy openwrt-octeon-ubnt_edgerouter-6p-initramfs-kernel.bin and openwrt-octeon-ubnt_edgerouter-6p-squashfs-sysupgrade.tar to USB flash drive that is formatted to vfat/fat32 - connect USB flash drive to EdgeRouter 6P front USB port - connect serial cable using front RJ45 port (115200 baud, 8N1) - connect power to cable to EdgeRouter 6P - connect terminal to the console to see uboot boot process - interrupt boot by pressing button(s) on your keyboard to log in to the uboot - detect usb connected flash drives by typing to the console: usb start - after drive is detected load initramfs+kernel to the memory by typing: fatload usb 0:1 0x20000000 openwrt-octeon-ubnt_edgerouter-6p-initramfs-kernel.bin - after initramfs+kernel is loaded to the memory load it by typing: bootoctlinux 0 numcores=4 endbootargs mem=0 - boot process should finish and you will be greeted with console after pressing enter - create directory to mount usb flash drive to by typing: mkdir /tmp/sda - mount flash drive to that directory by typing: mount /dev/sda1 /tmp/sda - flash firmware to router internal storage by typing: sysupgrade /tmp/sda/openwrt-octeon-ubnt_edgerouter-6p-squashfs-sysupgrade.tar - device will reboot and after it gets up you will have edgerouter 6p running openwrt Signed-off-by: Dan Brown [reorder/squash patches, move ethernet@0 to DTS, share image setup] Signed-off-by: Adrian Schmutzler --- .../octeon/base-files/etc/board.d/01_network | 3 + .../base-files/lib/preinit/79_move_config | 3 +- .../octeon/base-files/lib/upgrade/platform.sh | 9 ++- .../cn7130_ubnt_edgerouter-6p.dts | 60 +++++++++++++++++++ target/linux/octeon/image/Makefile | 17 +++++- 5 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-6p.dts diff --git a/target/linux/octeon/base-files/etc/board.d/01_network b/target/linux/octeon/base-files/etc/board.d/01_network index e62d3c28bf..194faeaad9 100644 --- a/target/linux/octeon/base-files/etc/board.d/01_network +++ b/target/linux/octeon/base-files/etc/board.d/01_network @@ -13,6 +13,9 @@ itus,shield-router) ubnt,edgerouter-4) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "lan0" ;; +ubnt,edgerouter-6p) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" "lan0" + ;; *) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; diff --git a/target/linux/octeon/base-files/lib/preinit/79_move_config b/target/linux/octeon/base-files/lib/preinit/79_move_config index 5a84e6f18a..ae155a3c5c 100644 --- a/target/linux/octeon/base-files/lib/preinit/79_move_config +++ b/target/linux/octeon/base-files/lib/preinit/79_move_config @@ -21,7 +21,8 @@ octeon_move_config() { itus,shield-router) move_config "/dev/mmcblk1p1" ;; - ubnt,edgerouter-4) + ubnt,edgerouter-4 | \ + ubnt,edgerouter-6p) move_config "/dev/mmcblk0p1" ;; esac diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh b/target/linux/octeon/base-files/lib/upgrade/platform.sh index ad5baef4a1..255699bb31 100755 --- a/target/linux/octeon/base-files/lib/upgrade/platform.sh +++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh @@ -29,7 +29,8 @@ platform_copy_config() { cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" umount /mnt ;; - ubnt,edgerouter-4) + ubnt,edgerouter-4 | \ + ubnt,edgerouter-6p) mount -t vfat /dev/mmcblk0p1 /mnt cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" umount /mnt @@ -84,7 +85,8 @@ platform_do_upgrade() { [ -b "${rootfs}" ] || return 1 case "$board" in er | \ - ubnt,edgerouter-4) + ubnt,edgerouter-4 | \ + ubnt,edgerouter-6p) kernel=mmcblk0p1 ;; erlite) @@ -114,7 +116,8 @@ platform_check_image() { er | \ erlite | \ itus,shield-router | \ - ubnt,edgerouter-4) + ubnt,edgerouter-4 | \ + ubnt,edgerouter-6p) local kernel_length=$(tar xf $tar_file $board_dir/kernel -O | wc -c 2> /dev/null) local rootfs_length=$(tar xf $tar_file $board_dir/root -O | wc -c 2> /dev/null) [ "$kernel_length" = 0 -o "$rootfs_length" = 0 ] && { diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-6p.dts b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-6p.dts new file mode 100644 index 0000000000..7d31885928 --- /dev/null +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-6p.dts @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "cn7130_ubnt_edgerouter-e300.dtsi" + +/ { + compatible = "ubnt,edgerouter-6p", "cavium,cn7130"; + model = "Ubiquiti EdgeRouter 6P"; +}; + +&smi0 { + phy8: ethernet-phy@8 { + device_type = "ethernet-phy"; + interrupts = <17 8>; + interrupt-parent = <&gpio>; + compatible = "vitesse,vsc8514", "ethernet-phy-ieee802.3-c22"; + reg = <8>; + }; + + phy9: ethernet-phy@9 { + device_type = "ethernet-phy"; + interrupts = <17 8>; + interrupt-parent = <&gpio>; + compatible = "vitesse,vsc8514", "ethernet-phy-ieee802.3-c22"; + reg = <9>; + }; +}; + +&pip { + interface@0 { + ethernet@0 { + label = "lan5"; + status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&phy4>; + mtd-mac-address = <&eeprom 0>; + }; + }; + + interface@1 { + status = "okay"; + + ethernet@0 { + label = "lan3"; + status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&phy8>; + mtd-mac-address = <&eeprom 0>; + mtd-mac-address-increment = <(4)>; + }; + + ethernet@1 { + label = "lan4"; + status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&phy9>; + mtd-mac-address = <&eeprom 0>; + mtd-mac-address-increment = <(5)>; + }; + }; +}; diff --git a/target/linux/octeon/image/Makefile b/target/linux/octeon/image/Makefile index 11da22df3b..f77159e1f9 100644 --- a/target/linux/octeon/image/Makefile +++ b/target/linux/octeon/image/Makefile @@ -51,17 +51,28 @@ define Device/ubnt_edgerouter endef TARGET_DEVICES += ubnt_edgerouter -define Device/ubnt_edgerouter-4 +define Device/ubnt_edgerouter-e300 DEVICE_VENDOR := Ubiquiti - DEVICE_MODEL := EdgeRouter 4 - DEVICE_DTS := cn7130_ubnt_edgerouter-4 DEVICE_PACKAGES += kmod-gpio-button-hotplug kmod-leds-gpio kmod-of-mdio kmod-sfp kmod-usb3 kmod-usb-dwc3 kmod-usb-storage-uas KERNEL := kernel-bin | patch-cmdline | append-dtb-to-elf KERNEL_DEPENDS := $$(wildcard $(DTS_DIR)/$(DEVICE_DTS).dts) CMDLINE := root=/dev/mmcblk0p2 rootfstype=squashfs,ext4 rootwait endef + +define Device/ubnt_edgerouter-4 + $(Device/ubnt_edgerouter-e300) + DEVICE_MODEL := EdgeRouter 4 + DEVICE_DTS := cn7130_ubnt_edgerouter-4 +endef TARGET_DEVICES += ubnt_edgerouter-4 +define Device/ubnt_edgerouter-6p + $(Device/ubnt_edgerouter-e300) + DEVICE_MODEL := EdgeRouter 6P + DEVICE_DTS := cn7130_ubnt_edgerouter-6p +endef +TARGET_DEVICES += ubnt_edgerouter-6p + ERLITE_CMDLINE:=-mtdparts=phys_mapped_flash:512k(boot0)ro,512k(boot1)ro,64k(eeprom)ro root=/dev/sda2 rootfstype=squashfs,ext4 rootwait define Device/ubnt_edgerouter-lite DEVICE_VENDOR := Ubiquiti From 4f07966696134b270e821246c8fd4624c238f1f6 Mon Sep 17 00:00:00 2001 From: Joao Henrique Albuquerque Date: Fri, 14 Aug 2020 12:04:02 -0300 Subject: [PATCH 12/23] ath79: add support for COMFAST CF-E375AC COMFAST CF-E375AC is a ceiling mount AP with PoE support, based on Qualcomm/Atheros QCA9563 + QCA9886 + QCA8337. Short specification: 2x 10/100/1000 Mbps Ethernet, with PoE support 128MB of RAM (DDR2) 16 MB of FLASH 3T3R 2.4 GHz, 802.11b/g/n 2T2R 5 GHz, 802.11ac/n/a, wave 2 built-in 5x 3 dBi antennas output power (max): 500 mW (27 dBm) 1x RGB LED, 1x button built-in watchdog chipset Flash instruction: 1) Original firmware is based on OpenWrt. Use sysupgrade image directly in vendor GUI. 2) TFTP 2.1) Set a tftp server on your machine with a fixed IP address of 192.168.1.10. A place the sysupgrade as firmware_auto.bin. 2.2) boot the device with an ethernet connection on fixed ip route 2.3) wait a few seconds and try to login via ssh 3) TFTP trough Bootloader 3.1) open the device case and get a uart connection working 3.2) stop the autoboot process and test connection with serverip 3.3) name the sysupgrade image firmware.bin and run firmware_upg MAC addresses: Though the OEM firmware has four adresses in the usual locations, it appears that the assigned addresses are just incremented in a different way: interface address location LAN: *:DC 0x0 WAN *:DD 0x1002 WLAN 2.4g *:E6 n/a (0x0 + 10) WLAN 5g *:DE 0x6 unused *:DF 0x5006 The MAC address pointed at the label is the one assign to the LAN interface. Signed-off-by: Joao Henrique Albuquerque [add label-mac-device, remove redundant uart status, fix whitespace issues, fix commit message wrapping, remove x bit on DTS file] Signed-off-by: Adrian Schmutzler --- .../ath79/dts/qca9563_comfast_cf-e375ac.dts | 137 ++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 4 + .../generic/base-files/etc/board.d/02_network | 7 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + target/linux/ath79/image/generic.mk | 10 ++ 5 files changed, 159 insertions(+) create mode 100644 target/linux/ath79/dts/qca9563_comfast_cf-e375ac.dts diff --git a/target/linux/ath79/dts/qca9563_comfast_cf-e375ac.dts b/target/linux/ath79/dts/qca9563_comfast_cf-e375ac.dts new file mode 100644 index 0000000000..1eeb02f7f9 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_comfast_cf-e375ac.dts @@ -0,0 +1,137 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca956x.dtsi" + +#include +#include + +/ { + model = "COMFAST CF-E375AC"; + compatible = "comfast,cf-e375ac", "qca,qca9563"; + + aliases { + label-mac-device = ð0; + led-boot = &led_lan; + led-failsafe = &led_lan; + led-running = &led_lan; + led-upgrade = &led_lan; + }; + + leds { + compatible = "gpio-leds"; + + led_lan: lan { + label = "green:lan"; + gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; + }; + + wan { + label = "red:wan"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + + wlan2g { + label = "blue:wlan2g"; + gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + linux,code = ; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + hw_algo = "toggle"; + hw_margin_ms = <500>; + always-running; + }; +}; + +&pcie { + status = "okay"; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + art: partition@40000 { + label = "art"; + reg = <0x040000 0x010000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x050000 0xfa0000>; + }; + + partition@ff0000 { + label = "art-backup"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "sgmii"; + qca,mib-poll-interval = <500>; + + qca,ar8327-initvals = < + 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x03000101 0x00000101 0x00001919>; + + phy-mode = "sgmii"; + mtd-mac-address = <&art 0x0>; + phy-handle = <&phy0>; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&art 0x0>; + mtd-mac-address-increment = <10>; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 783b55ec32..827055bc1f 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -132,6 +132,10 @@ comfast,cf-e314n-v2) ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "green:rssimediumhigh" "wlan0" "51" "100" ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:rssihigh" "wlan0" "76" "100" ;; +comfast,cf-e375ac) + ucidef_set_led_switch "lan" "LAN" "green:lan" "switch0" "0x04" + ucidef_set_led_switch "wan" "WAN" "red:wan" "switch0" "0x02" + ;; comfast,cf-e5) ucidef_set_led_switch "lan" "LAN" "blue:lan" "switch0" "0x02" ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 52e773fea3..4133b9d7d3 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -186,6 +186,10 @@ ath79_setup_interfaces() ubnt,routerstation) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; + comfast,cf-e375ac) + ucidef_add_switch "switch0" \ + "0@eth0" "1:wan" "2:lan" + ;; comfast,cf-e560ac) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ @@ -487,6 +491,9 @@ ath79_setup_macs() lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) wan_mac=$(fritz_tffs -n macb -i $(find_mtd_part "tffs (1)")) ;; + comfast,cf-e375ac) + wan_mac=$(macaddr_add $(mtd_get_mac_binary art 0x0) 1) + ;; compex,wpj344-16m|\ compex,wpj563) wan_mac=$(mtd_get_mac_binary u-boot 0x2e018) diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 5a44dd94e5..9e4b4496e5 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -173,6 +173,7 @@ case "$FIRMWARE" in /lib/firmware/ath10k/QCA9888/hw2.0/board.bin rm /lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin ;; + comfast,cf-e375ac|\ comfast,cf-e560ac|\ comfast,cf-ew72|\ comfast,cf-wr752ac-v1) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 222a1511a7..8c21fdc7f0 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -553,6 +553,16 @@ define Device/comfast_cf-e314n-v2 endef TARGET_DEVICES += comfast_cf-e314n-v2 +define Device/comfast_cf-e375ac + SOC := qca9563 + DEVICE_VENDOR := COMFAST + DEVICE_MODEL := CF-E375AC + DEVICE_PACKAGES := kmod-ath10k-ct \ + ath10k-firmware-qca9888-ct -uboot-envtools + IMAGE_SIZE := 16000k +endef +TARGET_DEVICES += comfast_cf-e375ac + define Device/comfast_cf-e5 SOC := qca9531 DEVICE_VENDOR := COMFAST From 3dd9f82fecd3a13ff4fa9d109bbe5b137df3f787 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 16 May 2021 21:37:43 +0200 Subject: [PATCH 13/23] ath79: fix leading whitespaces in generic 01_leds Use tabs consistently. Signed-off-by: Adrian Schmutzler --- target/linux/ath79/generic/base-files/etc/board.d/01_leds | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 827055bc1f..1990353394 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -85,8 +85,8 @@ avm,fritzdvbc) ;; buffalo,wzr-hp-g300nh-rb|\ buffalo,wzr-hp-g300nh-s) - ucidef_set_led_netdev "router" "Router" "green:router" "eth1" - ;; + ucidef_set_led_netdev "router" "Router" "green:router" "eth1" + ;; comfast,cf-e110n-v2) ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth1" ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x02" From b108ed0ab09492d8d5a1775714da1ee34ce475ee Mon Sep 17 00:00:00 2001 From: Giulio Lorenzo Date: Tue, 6 Oct 2020 14:14:31 +0200 Subject: [PATCH 14/23] ath79: add support for ZiKing CPE46B ZiKing CPE46B is a POE outdoor 2.4ghz device with an integrated directional antenna. It is low cost and mostly available via Aliexpress, references can be found at: - https://forum.openwrt.org/t/anddear-ziking-cpe46b-ar9331-ap121/60383 - https://git.lsd.cat/g/openwrt-cpe46b Specifications: - Atheros AR9330 - 32MB of RAM - 8MB of flash (SPI NOR) - 1 * 2.4ghz integrated antenna - 2 * 10/100/1000 ethernet ports (1 POE) - 3 * Green LEDs controlled by the SoC - 3 * Green LEDs controlled via GPIO - 1 * Reset Button controlled via GPIO - 1 * 4 pin serial header on the PCB - Outdoor packaging Flashing instruction: You can use sysupgrade image directly in vendor firmware which is based on OpenWrt/LEDE. In case of issues with the vendor GUI, the vendor Telnet console is vulnerable to command injection and can be used to gain a shell directly on the OEM OpenWrt distribution. Signed-off-by: Giulio Lorenzo [fix whitespaces, drop redundant uart status and serial0, drop num-chipselects, drop 0x1002 MAC address for wmac] Signed-off-by: Adrian Schmutzler --- package/boot/uboot-envtools/files/ath79 | 1 + .../linux/ath79/dts/ar9330_ziking_cpe46b.dts | 103 ++++++++++++++++++ target/linux/ath79/image/generic.mk | 9 ++ 3 files changed, 113 insertions(+) create mode 100644 target/linux/ath79/dts/ar9330_ziking_cpe46b.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index d0353c9023..7b0692e59f 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -61,6 +61,7 @@ ubnt,nanostation-m|\ yuncore,a770|\ yuncore,a782|\ yuncore,xd4200|\ +ziking,cpe46b|\ zyxel,nbg6616) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; diff --git a/target/linux/ath79/dts/ar9330_ziking_cpe46b.dts b/target/linux/ath79/dts/ar9330_ziking_cpe46b.dts new file mode 100644 index 0000000000..19a7390977 --- /dev/null +++ b/target/linux/ath79/dts/ar9330_ziking_cpe46b.dts @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9330.dtsi" + +#include +#include + +/ { + model = "ZiKing CPE46B"; + compatible = "ziking,cpe46b", "qca,ar9330"; + + aliases { + label-mac-device = ð0; + }; + + leds { + compatible = "gpio-leds"; + + wlan { + label = "green:wlan"; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + rssi1 { + label = "green:rssi1"; + gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; + }; + + rssi2 { + label = "green:rssi2"; + gpios = <&gpio 23 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <50000000>; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x010000>; + read-only; + }; + + partition@10000 { + label = "u-boot-env"; + reg = <0x010000 0x010000>; + }; + + partition@20000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x020000 0x7d0000>; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x010000>; + read-only; + }; + }; + }; +}; + +ð0 { + status = "okay"; + + mtd-mac-address = <&art 0x0>; +}; + +ð1 { + status = "okay"; + + mtd-mac-address = <&art 0x0>; + mtd-mac-address-increment = <2>; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; +}; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 8c21fdc7f0..2e23e4e72c 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2232,6 +2232,15 @@ define Device/yuncore_xd4200 endef TARGET_DEVICES += yuncore_xd4200 +define Device/ziking_cpe46b + SOC := ar9330 + DEVICE_VENDOR := ZiKing + DEVICE_MODEL := CPE46B + IMAGE_SIZE := 8000k + DEVICE_PACKAGES := kmod-i2c-gpio +endef +TARGET_DEVICES += ziking_cpe46b + define Device/zbtlink_zbt-wd323 SOC := ar9344 DEVICE_VENDOR := ZBT From 4508b12b088a1d54baeabea117fcd7bb3dd5ed1f Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 16 May 2021 23:58:59 +0200 Subject: [PATCH 15/23] octeon: use shared function for platform_copy_config() This reduces redundant instructions. The solution is inspired by a different implemention of Roman Kuzmitskii. Signed-off-by: Adrian Schmutzler --- .../octeon/base-files/lib/upgrade/platform.sh | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh b/target/linux/octeon/base-files/lib/upgrade/platform.sh index 255699bb31..84533d642a 100755 --- a/target/linux/octeon/base-files/lib/upgrade/platform.sh +++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh @@ -1,5 +1,5 @@ # -# Copyright (C) 2014 OpenWrt.org +# Copyright (C) 2021 OpenWrt.org # platform_get_rootfs() { @@ -17,23 +17,25 @@ platform_get_rootfs() { fi } +platform_copy_config_helper() { + local device=$1 + + mount -t vfat "$device" /mnt + cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" + umount /mnt +} + platform_copy_config() { case "$(board_name)" in erlite) - mount -t vfat /dev/sda1 /mnt - cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" - umount /mnt + platform_copy_config_helper /dev/sda1 ;; itus,shield-router) - mount -t vfat /dev/mmcblk1p1 /mnt - cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" - umount /mnt + platform_copy_config_helper /dev/mmcblk1p1 ;; - ubnt,edgerouter-4 | \ + ubnt,edgerouter-4|\ ubnt,edgerouter-6p) - mount -t vfat /dev/mmcblk0p1 /mnt - cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" - umount /mnt + platform_copy_config_helper /dev/mmcblk0p1 ;; esac } From f2844a63387db342c9173423c58b6e34e0e027b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 17 May 2021 12:25:34 +0200 Subject: [PATCH 16/23] bmips: remove duplicated brcmnand patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit brcmnand patch was applied upstream on 5.10.37 update. Fixes: d337731f85c8 ("kernel: bump 5.10 to 5.10.37") Signed-off-by: Álvaro Fernández Rojas --- ...rcmnand-fix-OOB-R-W-with-Hamming-ECC.patch | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 target/linux/bmips/patches-5.10/041-v5.13-mtd-rawnand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch diff --git a/target/linux/bmips/patches-5.10/041-v5.13-mtd-rawnand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch b/target/linux/bmips/patches-5.10/041-v5.13-mtd-rawnand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch deleted file mode 100644 index 00669843d8..0000000000 --- a/target/linux/bmips/patches-5.10/041-v5.13-mtd-rawnand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 095b4dabff2a929cefd330110c5c578956213188 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Wed, 24 Feb 2021 09:02:10 +0100 -Subject: [PATCH] mtd: rawnand: brcmnand: fix OOB R/W with Hamming ECC -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Hamming ECC doesn't cover the OOB data, so reading or writing OOB shall -always be done without ECC enabled. -This is a problem when adding JFFS2 cleanmarkers to erased blocks. If JFFS2 -clenmarkers are added to the OOB with ECC enabled, OOB bytes will be changed -from ff ff ff to 00 00 00, reporting incorrect ECC errors. - -Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller") -Signed-off-by: Álvaro Fernández Rojas -Acked-by: Brian Norris -Signed-off-by: Miquel Raynal -Link: https://lore.kernel.org/linux-mtd/20210224080210.23686-1-noltari@gmail.com ---- - drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c -+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -2694,6 +2694,12 @@ static int brcmnand_attach_chip(struct n - chip->ecc.read_oob = brcmnand_read_oob_raw; - } - -+ /* If OOB is written with ECC enabled it will cause ECC errors */ -+ if (is_hamming_ecc(host->ctrl, &host->hwcfg)) { -+ chip->ecc.write_oob = brcmnand_write_oob_raw; -+ chip->ecc.read_oob = brcmnand_read_oob_raw; -+ } -+ - return ret; - } - From 097dc943f1f9b02835c6b249b2a035679da5619f Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 13 May 2021 01:25:55 +0200 Subject: [PATCH 17/23] openwrt-keyring: Only copy sign key for snapshots Instead of adding all public signature keys from the openwrt-keyring repository only add the key which is used to sign the master feeds. If one of the other keys would be compromised this would not affect users of master snapshot builds. Signed-off-by: Hauke Mehrtens --- package/system/openwrt-keyring/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/system/openwrt-keyring/Makefile b/package/system/openwrt-keyring/Makefile index 6f3aa65622..318d42cf92 100644 --- a/package/system/openwrt-keyring/Makefile +++ b/package/system/openwrt-keyring/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openwrt-keyring -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/keyring.git @@ -32,7 +32,8 @@ Build/Compile= define Package/openwrt-keyring/install $(INSTALL_DIR) $(1)/etc/opkg/keys/ - $(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/* $(1)/etc/opkg/keys/ + # Public usign key for unattended snapshot builds + $(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/b5043e70f9a75cde $(1)/etc/opkg/keys/ endef $(eval $(call BuildPackage,openwrt-keyring)) From d42640e389a8b22a31fb0061c12cd9dfbddb87b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 14 May 2021 11:09:57 +0200 Subject: [PATCH 18/23] base-files: use "ports" array in board.json network for bridges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bridge aggregates multiple ports so use a more accurate name ("ports") and format (array) for storing them in board.json. Example: "network": { "lan": { "ports": [ "lan1", "lan2", "lan3", "lan4" ], "protocol": "static" }, "wan": { "ifname": "wan", "protocol": "dhcp" } } Signed-off-by: Rafał Miłecki --- package/base-files/files/bin/config_generate | 19 +++++++++++++------ .../files/lib/functions/uci-defaults.sh | 8 +++++++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index ee3958e733..56f6c4423b 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -91,21 +91,28 @@ generate_static_network() { addr_offset=2 generate_network() { - local ifname macaddr protocol type ipaddr netmask vlan + local ports ifname macaddr protocol type ipaddr netmask vlan local bridge=$2 json_select network json_select "$1" + json_get_values ports ports json_get_vars ifname macaddr protocol ipaddr netmask vlan json_select .. json_select .. - [ -n "$ifname" ] || return + [ -n "$ifname" -o -n "$ports" ] || return - # force bridge for multi-interface devices (and lan) - case "$1:$ifname" in - *\ * | lan:*) type="bridge" ;; - esac + # Force bridge for "lan" as it may have other devices (e.g. wireless) + # bridged + [ "$1" = "lan" -a -z "$ports" ] && { + ports="$ifname" + } + + [ -n "$ports" ] && { + type="bridge" + ifname="$ports" + } [ -n "$bridge" ] && { if [ -z "$vlan" ]; then diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 134c527d8d..407a9c710f 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -39,7 +39,13 @@ ucidef_set_interface() { [ -n "$opt" -a -n "$val" ] || break - json_add_string "$opt" "$val" + [ "$opt" = "ifname" -a "$val" != "${val/ //}" ] && { + json_select_array "ports" + for e in $val; do json_add_string "" "$e"; done + json_close_array + } || { + json_add_string "$opt" "$val" + } done if ! json_is_a protocol string; then From 3f4b382c3cbcb9ae3e2ecce781a766af927d2791 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 17 May 2021 17:16:56 +0200 Subject: [PATCH 19/23] toolchain/gdb: fix broken configure test for ELF support A missing #include was causing gdb on macOS to be compiled without ELF support Signed-off-by: Felix Fietkau --- .../patches/100-fix-elf-support-check.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 toolchain/gdb/patches/100-fix-elf-support-check.patch diff --git a/toolchain/gdb/patches/100-fix-elf-support-check.patch b/toolchain/gdb/patches/100-fix-elf-support-check.patch new file mode 100644 index 0000000000..fe612c38db --- /dev/null +++ b/toolchain/gdb/patches/100-fix-elf-support-check.patch @@ -0,0 +1,20 @@ +--- a/gdb/configure ++++ b/gdb/configure +@@ -16818,6 +16818,7 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include ++#include + #include "bfd.h" + #include "elf-bfd.h" + +--- a/gdb/acinclude.m4 ++++ b/gdb/acinclude.m4 +@@ -362,6 +362,7 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [ + AC_CACHE_CHECK([$1], [$2], + [AC_TRY_LINK( + [#include ++ #include + #include "bfd.h" + #include "$4" + ], From 04d21604fd72f337c8a0410d13b3d878914b7e7e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 17 May 2021 17:58:52 +0200 Subject: [PATCH 20/23] libubox: update to the latest version 870acee325fe tests: cram: test_base64: fix failing tests 4d8995e91d56 tests: cram: test_base64: really fix failing tests 551d75b5662c libubox: tests: add more blobmsg/json test cases a0dbcf8b8f96 tests: add blob-buffer overflow test b36a3a90098d blob: fix exceeding maximum buffer length b8abed749423 utils.h: add fallthrough macro b14c4688612c json_script: fix unannotated fall-through warning Signed-off-by: Felix Fietkau --- package/libs/libubox/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index 90e953aa46..ac4effb6f8 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git -PKG_MIRROR_HASH:=042398d1295ac892e09c6d2e8f68861c6f859fc6752e809a114f451834e7a05e -PKG_SOURCE_DATE:=2021-03-02 -PKG_SOURCE_VERSION:=2e52c7e9a90ab7ba1cf9d2986d1505ca5d184698 +PKG_MIRROR_HASH:=7dd1db1e0074a9c7c722db654cce3111b3bd3cff0bfd791c4497cb0f6c22d3ca +PKG_SOURCE_DATE:=2021-05-16 +PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 From 2d89d7c7482333ecf2697dbca705f627b8bf9b52 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 18 May 2021 12:16:11 +0200 Subject: [PATCH 21/23] hostapd: add ubus notifications for adding/removing vlan interfaces This can be used to handle network configuration of dynamically created vlan interfaces in a more flexible way Signed-off-by: Felix Fietkau --- .../hostapd/patches/600-ubus_support.patch | 38 +++++++++++++++++++ .../hostapd/patches/700-wifi-reload.patch | 2 +- .../services/hostapd/src/src/ap/ubus.c | 37 ++++++++++++++++++ .../services/hostapd/src/src/ap/ubus.h | 2 + 4 files changed, 78 insertions(+), 1 deletion(-) diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index 938840755a..0d1cb2c3e4 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -424,3 +424,41 @@ } +--- a/src/ap/vlan_init.c ++++ b/src/ap/vlan_init.c +@@ -22,6 +22,7 @@ + static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan, + int existsok) + { ++ bool vlan_exists = iface_exists(vlan->ifname); + int ret; + #ifdef CONFIG_WEP + int i; +@@ -36,7 +37,7 @@ static int vlan_if_add(struct hostapd_da + } + #endif /* CONFIG_WEP */ + +- if (!iface_exists(vlan->ifname)) ++ if (!vlan_exists) + ret = hostapd_vlan_if_add(hapd, vlan->ifname); + else if (!existsok) + return -1; +@@ -51,6 +52,9 @@ static int vlan_if_add(struct hostapd_da + if (hapd->wpa_auth) + ret = wpa_auth_ensure_group(hapd->wpa_auth, vlan->vlan_id); + ++ if (!ret && !vlan_exists) ++ hostapd_ubus_add_vlan(hapd, vlan); ++ + if (ret == 0) + return ret; + +@@ -77,6 +81,8 @@ int vlan_if_remove(struct hostapd_data * + "WPA deinitialization for VLAN %d failed (%d)", + vlan->vlan_id, ret); + ++ hostapd_ubus_remove_vlan(hapd, vlan); ++ + return hostapd_vlan_if_remove(hapd, vlan->ifname); + } + diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch index d5520d0b77..b68c1aaa9d 100644 --- a/package/network/services/hostapd/patches/700-wifi-reload.patch +++ b/package/network/services/hostapd/patches/700-wifi-reload.patch @@ -174,7 +174,7 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4493,6 +4493,9 @@ static int wpa_driver_nl80211_set_ap(voi +@@ -4511,6 +4511,9 @@ static int wpa_driver_nl80211_set_ap(voi if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", ret, strerror(-ret)); diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index d03b848f94..a34695f36a 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -1364,6 +1364,43 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd) free(name); } +static void +hostapd_ubus_vlan_action(struct hostapd_data *hapd, struct hostapd_vlan *vlan, + const char *action) +{ + struct vlan_description *desc = &vlan->vlan_desc; + void *c; + int i; + + if (!hapd->ubus.obj.has_subscribers) + return; + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "ifname", vlan->ifname); + blobmsg_add_string(&b, "bridge", vlan->bridge); + blobmsg_add_u32(&b, "vlan_id", vlan->vlan_id); + + if (desc->notempty) { + blobmsg_add_u32(&b, "untagged", desc->untagged); + c = blobmsg_open_array(&b, "tagged"); + for (i = 0; i < ARRAY_SIZE(desc->tagged) && desc->tagged[i]; i++) + blobmsg_add_u32(&b, "", desc->tagged[i]); + blobmsg_close_array(&b, c); + } + + ubus_notify(ctx, &hapd->ubus.obj, action, b.head, -1); +} + +void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan) +{ + hostapd_ubus_vlan_action(hapd, vlan, "vlan_add"); +} + +void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan) +{ + hostapd_ubus_vlan_action(hapd, vlan, "vlan_remove"); +} + static const struct ubus_method daemon_methods[] = { UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), diff --git a/package/network/services/hostapd/src/src/ap/ubus.h b/package/network/services/hostapd/src/src/ap/ubus.h index e16017394f..de0d1182fd 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.h +++ b/package/network/services/hostapd/src/src/ap/ubus.h @@ -43,6 +43,8 @@ void hostapd_ubus_add_iface(struct hostapd_iface *iface); void hostapd_ubus_free_iface(struct hostapd_iface *iface); void hostapd_ubus_add_bss(struct hostapd_data *hapd); void hostapd_ubus_free_bss(struct hostapd_data *hapd); +void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan); +void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan); int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac); From cf45caeff16256f9db777e0e652ec3a38cd476a4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 18 May 2021 12:50:17 +0200 Subject: [PATCH 22/23] hostapd: add patch for disabling automatic bridging of vlan interfaces netifd is responsible for handling that, except if the vlan bridge was provided by the config Signed-off-by: Felix Fietkau --- .../network/services/hostapd/files/hostapd.sh | 10 ++++-- .../hostapd/patches/710-vlan_no_bridge.patch | 33 +++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 package/network/services/hostapd/patches/710-vlan_no_bridge.patch diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 45a49b8faa..9e790f1e9d 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -266,7 +266,7 @@ hostapd_common_add_bss_config() { config_add_array domain_match domain_match2 domain_suffix_match domain_suffix_match2 config_add_string ieee80211w_mgmt_cipher - config_add_int dynamic_vlan vlan_naming + config_add_int dynamic_vlan vlan_naming vlan_no_bridge config_add_string vlan_tagged_interface vlan_bridge config_add_string vlan_file @@ -856,13 +856,17 @@ hostapd_set_bss_options() { } [ -n "$vlan_possible" -a -n "$dynamic_vlan" ] && { - json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file + json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file vlan_no_bridge set_default vlan_naming 1 [ -z "$vlan_file" ] && set_default vlan_file /var/run/hostapd-$ifname.vlan append bss_conf "dynamic_vlan=$dynamic_vlan" "$N" append bss_conf "vlan_naming=$vlan_naming" "$N" - [ -n "$vlan_bridge" ] && \ + if [ -n "$vlan_bridge" ]; then append bss_conf "vlan_bridge=$vlan_bridge" "$N" + else + set_default vlan_no_bridge 1 + fi + append bss_conf "vlan_no_bridge=$vlan_no_bridge" "$N" [ -n "$vlan_tagged_interface" ] && \ append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N" [ -n "$vlan_file" ] && { diff --git a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch new file mode 100644 index 0000000000..7de4e2c1d4 --- /dev/null +++ b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch @@ -0,0 +1,33 @@ +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -115,6 +115,7 @@ struct hostapd_ssid { + #define DYNAMIC_VLAN_OPTIONAL 1 + #define DYNAMIC_VLAN_REQUIRED 2 + int dynamic_vlan; ++ int vlan_no_bridge; + #define DYNAMIC_VLAN_NAMING_WITHOUT_DEVICE 0 + #define DYNAMIC_VLAN_NAMING_WITH_DEVICE 1 + #define DYNAMIC_VLAN_NAMING_END 2 +--- a/src/ap/vlan_full.c ++++ b/src/ap/vlan_full.c +@@ -466,6 +466,9 @@ void vlan_newlink(const char *ifname, st + + wpa_printf(MSG_DEBUG, "VLAN: vlan_newlink(%s)", ifname); + ++ if (hapd->conf->ssid.vlan_no_bridge) ++ return; ++ + for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) { + if (vlan->configured || + os_strcmp(ifname, vlan->ifname) != 0) +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -3400,6 +3400,8 @@ static int hostapd_config_fill(struct ho + #ifndef CONFIG_NO_VLAN + } else if (os_strcmp(buf, "dynamic_vlan") == 0) { + bss->ssid.dynamic_vlan = atoi(pos); ++ } else if (os_strcmp(buf, "vlan_no_bridge") == 0) { ++ bss->ssid.vlan_no_bridge = atoi(pos); + } else if (os_strcmp(buf, "per_sta_vif") == 0) { + bss->ssid.per_sta_vif = atoi(pos); + } else if (os_strcmp(buf, "vlan_file") == 0) { From 829b5c2ba32f5ec821eab6762deecdf3522470a9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 18 May 2021 12:52:31 +0200 Subject: [PATCH 23/23] netifd: update to the latest version 02dd2f2df7cb fix unannotated fall-through warnings 3052f2f67686 extdev: remove unused function 2a97fd006c3b device: add support for configuring devices with external auth handler 87e469be0c08 wireless: fix memory corruption bug when using vlans/station entries in the config 7277764bf817 bridge: rename "ifname" attribute to "ports" Signed-off-by: Felix Fietkau --- package/network/config/netifd/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 7d916b6939..7a05abb651 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=netifd -PKG_RELEASE:=3 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2021-04-03 -PKG_SOURCE_VERSION:=327da9895327bc56b23413ee91a6e6b6e0e4329d -PKG_MIRROR_HASH:=b6b005686aeb45948299113c71f6b806ece794db361594b23e03953c9c830af6 +PKG_SOURCE_DATE:=2021-05-18 +PKG_SOURCE_VERSION:=7277764bf8173d6961acbacfe31757c9195329e1 +PKG_MIRROR_HASH:=bf3549594dccda31bb9da831823b931ba7cb85e1a60ec6432ed6c09f3ea54510 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0