From c0c4a9bce42bea74fa9fa984cde149eac5e479bf Mon Sep 17 00:00:00 2001 From: Christian Buschau Date: Tue, 17 Oct 2023 14:51:53 +0200 Subject: [PATCH 1/6] armsr: preserve configuration during sysupgrade Copy configuration to boot partition (partition 1) instead of root partition (partition 2) because the root partition is not writable if it's a suqashfs image. Move configuration back to root during preinit. Fixes: https://github.com/openwrt/openwrt/issues/13695 Signed-off-by: Christian Buschau (cherry picked from commit 67ce60c5f961c4248fa108cd0f949e2bade4536e) --- .../base-files/lib/preinit/79_move_config | 19 +++++++++++++++++++ .../armsr/base-files/lib/upgrade/platform.sh | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 target/linux/armsr/base-files/lib/preinit/79_move_config diff --git a/target/linux/armsr/base-files/lib/preinit/79_move_config b/target/linux/armsr/base-files/lib/preinit/79_move_config new file mode 100644 index 0000000000..864d4dfa64 --- /dev/null +++ b/target/linux/armsr/base-files/lib/preinit/79_move_config @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-only + +move_config() { + local partdev parttype=ext4 + + . /lib/upgrade/common.sh + + if export_bootdevice && export_partdevice partdev 1; then + part_magic_fat "/dev/$partdev" && parttype=vfat + if mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt; then + if [ -f "/mnt/$BACKUP_FILE" ]; then + mv -f "/mnt/$BACKUP_FILE" / + fi + umount /mnt + fi + fi +} + +boot_hook_add preinit_mount_root move_config diff --git a/target/linux/armsr/base-files/lib/upgrade/platform.sh b/target/linux/armsr/base-files/lib/upgrade/platform.sh index 8263b9c7e3..e72c6955e5 100644 --- a/target/linux/armsr/base-files/lib/upgrade/platform.sh +++ b/target/linux/armsr/base-files/lib/upgrade/platform.sh @@ -36,7 +36,8 @@ platform_check_image() { platform_copy_config() { local partdev parttype=ext4 - if export_partdevice partdev 2; then + if export_partdevice partdev 1; then + part_magic_fat "/dev/$partdev" && parttype=vfat mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" umount /mnt From 0da199f60c47a4b861562ffec3842535eb56a67b Mon Sep 17 00:00:00 2001 From: Michael 'ASAP' Weinrich Date: Thu, 5 Oct 2023 19:39:58 -0700 Subject: [PATCH 2/6] base-files: fix wrong ucidef_set_network_device_mac network-device entry The ucidef_set_network_device_* functions in uci-defaults.sh disagree on whether to use "network-device" or "network_device" in board.json. With the additional caveat that jshn will translate hyphens (-) into underscores (_). This casues problems in netifd which expected "network_device" causing boards which depend on assigning MACs in board.json via uci-defaults.sh (or jshn in general) to fail. This commit addresses the issue by using network_device in uci-defaults.sh. The bug was uncovered in the forums here: https://forum.openwrt.org/t/support-for-rtl838x-based-managed-switches/57875/2596 This was exposed by commit 4ebba8a05d09 ("realtek: add support for HPE 1920-8g-poe+") where the board_config_load call from 03_gpio introduced the key normalization by jshn. Fixes: 9290539ca9c7 ("base-files: allow setting device and bridge macs") Tested-by: Stijn Segers Signed-off-by: Michael 'ASAP' Weinrich [ improve commit title, description and fix wrong Tested-by tag ] Signed-off-by: Christian Marangi (cherry picked from commit 12bc79d6d521581e37a8b067ce8a562429aeefbd) --- package/base-files/files/lib/functions/uci-defaults.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index a37e8cf824..6f395ec24b 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -107,7 +107,7 @@ ucidef_set_bridge_mac() { } ucidef_set_network_device_mac() { - json_select_object "network-device" + json_select_object "network_device" json_select_object "${1}" json_add_string macaddr "${2}" json_select .. From 1304234dd7e8e85266760b9694403f0160bd82ae Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 20 Oct 2023 13:00:00 +0200 Subject: [PATCH 3/6] netifd: update to latest git HEAD 5590a80e2566 config: fix incompatible with jshn network-device entry Signed-off-by: Christian Marangi (cherry picked from commit 53039bf7f5aa16d2f69394a86d04b8442c743e77) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index e60e592098..44d3a98d8f 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-09-19 -PKG_SOURCE_VERSION:=7a58b995fdbecd9beed57e4d66d42cb3cf66aee2 -PKG_MIRROR_HASH:=a460a3b912047f8802eb24bb737084a08dad65b2dd520e5f5e7459379d1fcf8c +PKG_SOURCE_DATE:=2023-10-20 +PKG_SOURCE_VERSION:=5590a80e2566d378be955f61c287a63fb3bdf329 +PKG_MIRROR_HASH:=eef792b4e9fa7a5227cf8c2ec4ed5e6558dd04c119cd9f97561923821fd1aa92 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 4afff7b8b54c3b246fba30ed83dfac527e78e57d Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Tue, 12 Sep 2023 15:38:27 +0200 Subject: [PATCH 4/6] ipq40xx: switch to performance governor by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Doing a simple ping to my device shows this: 64 bytes from 10.0.253.101: icmp_seq=1 ttl=64 time=2.00 ms 64 bytes from 10.0.253.101: icmp_seq=2 ttl=64 time=2.02 ms 64 bytes from 10.0.253.101: icmp_seq=3 ttl=64 time=1.68 ms 64 bytes from 10.0.253.101: icmp_seq=4 ttl=64 time=1.91 ms 64 bytes from 10.0.253.101: icmp_seq=5 ttl=64 time=1.92 ms 64 bytes from 10.0.253.101: icmp_seq=6 ttl=64 time=2.04 ms Some users even report higher values on older kernels: 64 bytes from 192.168.1.10: seq=0 ttl=64 time=0.612 ms 64 bytes from 192.168.1.10: seq=1 ttl=64 time=2.852 ms 64 bytes from 192.168.1.10: seq=2 ttl=64 time=2.719 ms 64 bytes from 192.168.1.10: seq=3 ttl=64 time=2.741 ms 64 bytes from 192.168.1.10: seq=4 ttl=64 time=2.808 ms The problem is that the governor is set to Ondemand, which causes the CPU to clock all the way down to 48MHz in some cases. Switching to performance governor: 64 bytes from 10.0.253.101: icmp_seq=1 ttl=64 time=0.528 ms 64 bytes from 10.0.253.101: icmp_seq=2 ttl=64 time=0.561 ms 64 bytes from 10.0.253.101: icmp_seq=3 ttl=64 time=0.633 ms 64 bytes from 10.0.253.101: icmp_seq=4 ttl=64 time=0.526 ms In theory, using the Performance governor should increase power draw, but it looks like it really does not matter for this soc. Using a calibrated precision DC power supply (cpu idle): Ondemand 24.00V * 0.134A = 3.216 Watts 48.00V * 0.096A = 4.608 Watts Performance 24.00V * 0.135A = 3.240 Watts 48.00V * 0.096A = 4.608 Watts Let's simply switch to the Performance governor by default to fix the general jittery behaviour on devices using this soc. Tested on: MikroTik wAP ac Fixes: #13649 Reviewed-by: Robert Marko Reviewed-by: Thibaut VARĂˆNE Signed-off-by: Koen Vandeputte (cherry picked from commit b8e52852bd62236a2a84663b4592d221ebc64cb4) --- target/linux/ipq40xx/config-5.15 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq40xx/config-5.15 b/target/linux/ipq40xx/config-5.15 index 0acc013a81..d08f4e0a24 100644 --- a/target/linux/ipq40xx/config-5.15 +++ b/target/linux/ipq40xx/config-5.15 @@ -67,8 +67,8 @@ CONFIG_CPU_COPY_V6=y CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_ATTR_SET=y CONFIG_CPU_FREQ_GOV_COMMON=y # CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set From 58d57f767374c18ff2ffe5a8d2a7ff80bc0e7649 Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Mon, 16 Oct 2023 19:41:21 +0200 Subject: [PATCH 5/6] ipq40xx: wpj428: switch to zimage to fit kernel partition Like with some other ipq40xx devices, the kernel image size for the WPJ428 is limited in stock u-boot. For that reason, the current release doesn't include an image for the board. By switching to the zImage format, the kernel image size is reduced which re-enables the build process. The image boots and behaved normally through a few days of testing. Before the switch to kernel version 6.1, it was possible to reduce the image size by enough when disabling UBIFS and its otherwise unneeded dependencies. Signed-off-by: Leon M. Busch-George (cherry picked from commit 2657e8cab7f3d621b66cfdd4e228da3b912af32a) --- target/linux/ipq40xx/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 99a9b78b78..ff5d5f26aa 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -354,7 +354,7 @@ endef #TARGET_DEVICES += compex_wpj419 define Device/compex_wpj428 - $(call Device/FitImage) + $(call Device/FitzImage) DEVICE_VENDOR := Compex DEVICE_MODEL := WPJ428 SOC := qcom-ipq4028 From 03cb2d63f487a5d716711c2693f126c913e599cf Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 20 Oct 2023 16:20:27 +0200 Subject: [PATCH 6/6] apm821xx: WNDR4700: fix broken sysupgrade, factory images prepend-dtb got extended to handle the Meraki devices too, the problem here was that the Netgear WNDR4700 expects an u-boot header in front of the DTB, whereas Meraki devices don't. Since the header was dropped, the WNDR4700's uboot started to complain: Bad Magic Number,it is forbidden to be written to flash!! when flashing the factory.img since it expects an u-boot header there. Fixes: 5dece2d9355a ("apm821xx: switch over from DTB_SIZE to DEVICE_DTC_FLAGS") Fixes: #13716 Reported-by: @kisgezenguz Reported-by: Tamas Szabo Signed-off-by: Christian Lamparter (cherry picked from commit d6a11833ad67c33ad10dadf396f6c30bb44ef30f) --- target/linux/apm821xx/image/nand.mk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/linux/apm821xx/image/nand.mk b/target/linux/apm821xx/image/nand.mk index bbc429c45d..4681a7428d 100644 --- a/target/linux/apm821xx/image/nand.mk +++ b/target/linux/apm821xx/image/nand.mk @@ -3,7 +3,12 @@ define Build/create-uImage-dtb -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) \ -O linux -T kernel -C none \ -n '$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION)' \ - -d "$@.dtb" "$@.dtb.uimage" + -d "$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb" "$@.dtb.uimage" +endef + +define Build/prepend-dtb-uImage + cat "$@.dtb.uimage" "$@" > "$@.new" + mv "$@.new" "$@" endef define Build/meraki-header @@ -104,7 +109,7 @@ define Device/netgear_wndr4700 # append a fake/empty rootfs to fool netgear's uboot # CHECK_DNI_FIRMWARE_ROOTFS_INTEGRITY in do_chk_dniimg() KERNEL := kernel-bin | lzma -d16 | uImage lzma | pad-offset $$(BLOCKSIZE) 64 | \ - append-uImage-fakehdr filesystem | create-uImage-dtb | prepend-dtb + append-uImage-fakehdr filesystem | create-uImage-dtb | prepend-dtb-uImage KERNEL_INITRAMFS := kernel-bin | libdeflate-gzip | MuImage-initramfs gzip IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ netgear-dni | check-size