From patchwork Mon Jul 4 12:23:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 1651983 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=hM+52thw; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=Vmjn5sVh; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=terefe.re header.i=@terefe.re header.a=rsa-sha256 header.s=default header.b=lGWBfeBw; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lc4pZ4L6qz9sFr for ; Mon, 4 Jul 2022 22:28:22 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9Is9Rt0tzf//4csGldfJPUzogsVtVx5G5yEWUM4j/NE=; b=hM+52thw/fPFJz 7dCdlOwrOjL8b3XRv0fTznVA6JVyItJ94qblB2WxDCe8XuHyEni2lEM9R1+0ctqldz/GotFTPAHnu 3JR6fR6rgAr36YAIqZkKPuDTEDvVHwDV4QaamT3FLJ3h/sDNvb7X+9NR+Rm2Aiv4Eaq0I7a2CCt0E mi5Ap1Gp1OPjfS6n1HCeXIc1tR5BDFlV53BDJOcc9IelH8AGZmzjmU35i+7U8uSBdAfFMYyvM5B/Y az4+ZZySln2w/qw1JfdQ+NNqwZFN4w9AefPryobjcdbjrLQQfxmY32kzuwyt4rZNfXxhbXb23vRC8 yldEqSZB0jgtrEV5gd+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8L9L-008kbK-Rb; Mon, 04 Jul 2022 12:26:00 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8L7F-008jna-3Y for openwrt-devel@bombadil.infradead.org; Mon, 04 Jul 2022 12:23:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=vP38P+qvd0SoI2ZrfB6b4sQYidkAni3l9g0CZKHJj2Y=; b=Vmjn5sVhBFW0QmwgKJ0MPMuCf/ m+y1eDWhOZJ289e0thoye+tIwZUVYz7y2WCtuWyvO1M5DZqgmqk9AmJZAO9zuOlda+A4DOy42r93U zX+CSWW+PRe4zsb2nKWNEYmC4SDXgtzTOwVGgoK5xXZU36NWPb5EwHmy6UjWBBoze4fHCCKCYSuTt lr6bb7tkxj4PB1Z9ZI/lU7vq+LzzUFVAOAKybmvv5IyioeKcHXfMBzot6kov7+vGJIid7nCtO0CtM 17+pqppVqiOwEhXN8p+LADfomV2WkxdQD/bNMOjZjdVnshoVfWkKrWJJShagezvrTMHpGL2Bv1HPS LFM3Y3pg==; Received: from mail.terefe.re ([5.255.96.200]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8L74-00H7h6-Mf for openwrt-devel@lists.openwrt.org; Mon, 04 Jul 2022 12:23:47 +0000 Received: from localhost.localdomain (unknown [212.106.161.60]) by mail.terefe.re (Postfix) with ESMTPSA id C250220144; Mon, 4 Jul 2022 14:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=terefe.re; s=default; t=1656937407; bh=xUIJ29OQdxPilY0MYxYhzrx7sYM80OCO2VkG0Ly6RH0=; h=From:To:Cc:Subject:Date:From; b=lGWBfeBwoAhA/DtBpxMGvuCf2A9P+QuuQ51RKgUJVqkUJJf4IRFcPVR1IDW5f6H72 ltTCi6OZhHjalTswNyetwjysQ1j48VpV0WQEFUx4b+ria94Gn5gIJsYoqX8dJlqEpR u6qj1c1f1OCvIIMCyiypUJRaG74Y2B+Ji3koJYRqDXamyVPjFkB+5KGh4GTV+1leuY SzO6GCYsP6ySSIfSHo3C4MztPZHIihaXc8YHrXfulrRttds3VEiS5x4Potw/oiBEFE 48DsnJi1zbbOJaL15qfugQTUmwWgpb98IiNFlq7uMjzzeXQL3pvnzfPaNiFduAtmY1 Iw+RM1lhSTzUw== From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Cc: Tomasz Maciej Nowak , Christian Lamparter Subject: [PATCH 22.03 1/4] ath79: switch some RedBoot based devices to OKLI loader Date: Mon, 4 Jul 2022 14:23:03 +0200 Message-Id: <20220704122306.6263-1-tmn505@terefe.re> X-Mailer: git-send-email 2.37.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220704_132344_994626_EC123D07 X-CRM114-Status: GOOD ( 14.78 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Tomasz Maciej Nowak After the kernel has switched version to 5.10, JA76PF2 and RouterStations lost the capability to sysupgrade the OpenWrt version. The cause is the lack of porting the patches responsible for partial fl [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Tomasz Maciej Nowak After the kernel has switched version to 5.10, JA76PF2 and RouterStations lost the capability to sysupgrade the OpenWrt version. The cause is the lack of porting the patches responsible for partial flash erase block writing and these boards FIS directory and RedBoot config partitions share the same erase block. Because of that the FIS directory can't be updated to accommodate kernel/rootfs partition size changes. This could be remedied by bootloader update, but it is very intrusive and could potentially lead to non-trivial recovery procedure, if something went wrong. The less difficult option is to use OpenWrt kernel loader, which will let us use static partition sizes and employ mtd splitter to dynamically adjust kernel and rootfs partition sizes. On sysupgrade from ath79 19.07 or 21.02 image, which still let to modify FIS directory, the loader will be written to kernel partition, while the kernel+rootfs to rootfs partition. The caveats are: * image format changes, no possible upgrade from ar71xx target images * downgrade to any older OpenWrt version will require TFTP recovery or usage of bootloader command line interface To downgrade to 19.07 or 21.02, or to upgrade if one is already on OpenWrt with kernel 5.10, for RouterStations use TFTP recovery procedure. For JA76PF2 use instructions from this commit message: commit 0cc87b3bacee ("ath79: image: disable sysupgrade images for routerstations and ja76pf2"), replacing kernel image with loader (loader.bin suffix) and rootfs image with firmware (firmware.bin suffix). Fixes: b10d6044599d ("kernel: add linux 5.10 support") Fixes: 15aa53d7ee65 ("ath79: switch to Kernel 5.10") Signed-off-by: Tomasz Maciej Nowak (mkubntimage was moved to generic-ubnt.mk) Signed-off-by: Christian Lamparter (cherry picked from commit 5c142aad7bc018fe000789740a486c49973035b8) --- .../linux/ath79/dts/ar7161_jjplus_ja76pf2.dts | 39 ++++++++++++++++++- .../ath79/dts/ar7161_ubnt_routerstation.dtsi | 35 ++++++++++++++++- .../etc/uci-defaults/05_fix-compat-version | 5 ++- .../base-files/lib/upgrade/platform.sh | 20 +++++----- target/linux/ath79/image/Makefile | 8 ---- target/linux/ath79/image/generic-ubnt.mk | 24 ++++++++---- target/linux/ath79/image/generic.mk | 25 ++++++++---- 7 files changed, 119 insertions(+), 37 deletions(-) diff --git a/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts b/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts index 826b45ff513e..7a8e2faa538f 100644 --- a/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts +++ b/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts @@ -4,6 +4,7 @@ #include #include +#include / { model = "jjPlus JA76PF2"; @@ -111,9 +112,45 @@ spi-max-frequency = <25000000>; partitions { + compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; - compatible = "ecoscentric,redboot-fis-partitions"; + + partition@0 { + label = "RedBoot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "loader"; + reg = <0x040000 0x020000>; + }; + + partition@60000 { + label = "firmware"; + reg = <0x060000 0xf80000>; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + }; + + partition@fe0000 { + label = "FIS directory"; + reg = <0xfe0000 0x00f000>; + read-only; + }; + + partition@fef000 { + label = "RedBoot config"; + reg = <0xfef000 0x001000>; + read-only; + }; + + partition@ff0000 { + label = "Atheros Board Data"; + reg = <0xff0000 0x10000>; + read-only; + }; }; }; }; diff --git a/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi b/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi index 116bc9cfc2ff..172b0af1eb3b 100644 --- a/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi +++ b/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi @@ -4,6 +4,7 @@ #include #include +#include / { aliases { @@ -62,7 +63,39 @@ spi-max-frequency = <25000000>; partitions { - compatible = "ecoscentric,redboot-fis-partitions"; + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "RedBoot"; + reg = <0x000000 0x030000>; + read-only; + }; + + partition@30000 { + label = "loader"; + reg = <0x030000 0x020000>; + }; + + partition@50000 { + label = "firmware"; + reg = <0x050000 0xfa0000>; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + }; + + partition@ff0000 { + label = "FIS directory"; + reg = <0xff0000 0x00f000>; + read-only; + }; + + partition@fff000 { + label = "RedBoot config"; + reg = <0xfff000 0x001000>; + read-only; + }; }; }; }; diff --git a/target/linux/ath79/generic/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ath79/generic/base-files/etc/uci-defaults/05_fix-compat-version index a6b7fa31621b..6646b7e5e7b1 100644 --- a/target/linux/ath79/generic/base-files/etc/uci-defaults/05_fix-compat-version +++ b/target/linux/ath79/generic/base-files/etc/uci-defaults/05_fix-compat-version @@ -1,8 +1,11 @@ . /lib/functions.sh case "$(board_name)" in + jjplus,ja76pf2|\ meraki,mr12|\ - meraki,mr16) + meraki,mr16|\ + ubnt,routerstation|\ + ubnt,routerstation-pro) uci set system.@system[0].compat_version="2.0" uci commit system ;; diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index 953d6a96d36f..642a9891ff29 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -14,21 +14,21 @@ redboot_fis_do_upgrade() { local kern_part="$2" local magic=$(get_magic_word "$sysup_file") - if [ "$magic" = "4349" ]; then - local kern_length=0x$(dd if="$sysup_file" bs=2 skip=1 count=4 2>/dev/null) + if [ "$magic" = "7379" ]; then + local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$') [ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP" - dd if="$sysup_file" bs=64k skip=1 2>/dev/null | \ - mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs - elif [ "$magic" = "7379" ]; then - local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$') - local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c) + if grep -q "mtd1.*loader" /proc/mtd; then + tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ + mtd -r $append write - loader:firmware - [ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP" - tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ - mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs + else + local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c) + tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ + mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs + fi else echo "Unknown image, aborting!" return 1 diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile index 768ec5704490..32a4b2abed05 100644 --- a/target/linux/ath79/image/Makefile +++ b/target/linux/ath79/image/Makefile @@ -8,14 +8,6 @@ DEVICE_VARS += LOADER_FLASH_MAX LOADER_KERNEL_MAGIC DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID DEVICE_VARS += RAS_BOARD RAS_ROOTFS_SIZE RAS_VERSION -define Build/combined-image - sh $(TOPDIR)/scripts/combined-image.sh \ - "$(IMAGE_KERNEL)" \ - "$@" \ - "$@.new" - @mv $@.new $@ -endef - define Build/loader-common rm -rf $@.src $(MAKE) -C lzma-loader \ diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 2381d9256747..cb7a6417b080 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -394,14 +394,24 @@ define Device/ubnt_routerstation_common kmod-usb2 fconfig DEVICE_VENDOR := Ubiquiti SOC := ar7161 - IMAGE_SIZE := 16128k + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x50000 + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile | lzma | pad-to 128k + IMAGE_SIZE := 16000k IMAGES += factory.bin - IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | \ - check-size - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \ - check-size | append-metadata - KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) + IMAGE/factory.bin := append-kernel | uImage lzma -M 0x4f4b4c49 | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | pad-to $$$$(BLOCKSIZE) | \ + mkubntimage $$$$(KDIR)/loader-$(1).bin | check-size + IMAGE/sysupgrade.bin := append-kernel | uImage lzma -M 0x4f4b4c49 | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | pad-to $$$$(BLOCKSIZE) | check-size | \ + sysupgrade-tar kernel=$$$$(KDIR)/loader-$(1).bin rootfs=$$$$@ | append-metadata + KERNEL := kernel-bin | append-dtb | lzma KERNEL_INITRAMFS := kernel-bin | append-dtb + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := Partition design has changed compared to older versions (19.07 and 21.02) \ + due to kernel drivers restrictions. Upgrade via sysupgrade mechanism is one way operation. \ + Downgrading OpenWrt version will involve usage of TFTP recovery or bootloader command line interface. endef define Device/ubnt_routerstation @@ -411,7 +421,6 @@ define Device/ubnt_routerstation UBNT_TYPE := RSx UBNT_CHIP := ar7100 DEVICE_PACKAGES += -swconfig - SUPPORTED_DEVICES += routerstation endef TARGET_DEVICES += ubnt_routerstation @@ -421,7 +430,6 @@ define Device/ubnt_routerstation-pro UBNT_BOARD := RSPRO UBNT_TYPE := RSPRO UBNT_CHIP := ar7100pro - SUPPORTED_DEVICES += routerstation-pro endef TARGET_DEVICES += ubnt_routerstation-pro diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index c4b810cb59a6..2b81690654e6 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1454,15 +1454,24 @@ define Device/jjplus_ja76pf2 DEVICE_VENDOR := jjPlus DEVICE_MODEL := JA76PF2 DEVICE_PACKAGES += -kmod-ath9k -swconfig -wpad-basic-wolfssl -uboot-envtools fconfig - IMAGES += kernel.bin rootfs.bin - IMAGE/kernel.bin := append-kernel - IMAGE/rootfs.bin := append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \ - check-size | append-metadata - KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x60000 + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile | lzma | pad-to 128k + ARTIFACTS := loader.bin + ARTIFACT/loader.bin := append-loader-okli $(1) + IMAGES += firmware.bin + IMAGE/firmware.bin := append-kernel | uImage lzma -M 0x4f4b4c49 | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | pad-to $$$$(BLOCKSIZE) | check-size + IMAGE/sysupgrade.bin := $$(IMAGE/firmware.bin) | \ + sysupgrade-tar kernel=$$$$(KDIR)/loader-$(1).bin rootfs=$$$$@ | append-metadata + KERNEL := kernel-bin | append-dtb | lzma KERNEL_INITRAMFS := kernel-bin | append-dtb - IMAGE_SIZE := 16000k - SUPPORTED_DEVICES += ja76pf2 + IMAGE_SIZE := 15872k + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := Partition design has changed compared to older versions (19.07 and 21.02) \ + due to kernel drivers restrictions. Upgrade via sysupgrade mechanism is one way operation. \ + Downgrading OpenWrt version will involve usage of bootloader command line interface. endef TARGET_DEVICES += jjplus_ja76pf2 From patchwork Mon Jul 4 12:23:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 1651982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=TzaU1e86; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=terefe.re header.i=@terefe.re header.a=rsa-sha256 header.s=default header.b=CMhgMXdz; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lc4np5Nv1z9sGC for ; Mon, 4 Jul 2022 22:27:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nAA1Ne9kjQNp7f5GO6TlMkzOAvjkeWjDBN9t606UdM8=; b=TzaU1e86wqOHzw yPCsb9eq+Xfi0RWcv/wuU3dykVTweDjAR/huxrl2nr4ZWlkn6+di83CFhswj0FEyXsGa6QmozwsJI v7TyQg4edNmodIGyHKmIXjx2d2fmglIStHs4httaHTfJDFi7MjNxVTBJIxOtUbHvZSX9N1zMw4NfO ldQNFcH+PFbegDaZ9Wh9Mc+JuAHzIqybA3ZlAz7pB9VqB4DO6uP+O2OBF1LEas2+H82eEtKcjpLEM Ggk/BCvuwiOEPgN9xfyHkpE0OAnGVKZdKkPaJLk10SshY8NMQVtbm5ofa7CMdP1JXx+y6osJx/oiy BRYz59wMHUmI81whsgUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8L8E-008kHn-Tu; Mon, 04 Jul 2022 12:24:51 +0000 Received: from mail.terefe.re ([2a04:52c0:101:a4a:0:ffff:5ff:60c8]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8L74-008jd0-5T for openwrt-devel@lists.openwrt.org; Mon, 04 Jul 2022 12:23:39 +0000 Received: from localhost.localdomain (unknown [212.106.161.60]) by mail.terefe.re (Postfix) with ESMTPSA id 6962820145; Mon, 4 Jul 2022 14:23:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=terefe.re; s=default; t=1656937407; bh=kqyuTmE71c979esFOAThRn/rNBmQXkOAmLiaX1CrUd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CMhgMXdzIq5EXH2pFngBKlQ9Qixzg1RSRbC9T3niLdN8wSfodMu0bGVDbnokwLWSb OA3+u2fhnp7bHUr5MRsDX9MRUgwfOi/FlKeeMD9ZiuhBqVhFp9FApMcmz6NuMi1RKA U6Y3i0mwca56LKtyYW2EC0netb5ZqNrcwQvSangZFUrl14zZzFc1CczyIrzuKUHGyZ 5W5sYF1B9bUxzm3y3qVl/S7QSwZapC7ckmr0KAWAdI7qM8UaFDEDryciSEw+YUm5SR eIUYwL5Ceu/4WYh3q/0zoNSGAlv0WxnYO4VE4Ngb6sRtRAey+m9G8FoPHsxHWGw4nQ O11Azuk4A2E9Q== From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Cc: Tomasz Maciej Nowak Subject: [PATCH 22.03 2/4] ath79: move image check for devices with RedBoot Date: Mon, 4 Jul 2022 14:23:04 +0200 Message-Id: <20220704122306.6263-2-tmn505@terefe.re> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220704122306.6263-1-tmn505@terefe.re> References: <20220704122306.6263-1-tmn505@terefe.re> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220704_052338_384930_2E9F0FD1 X-CRM114-Status: GOOD ( 13.41 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Tomasz Maciej Nowak Don't comence the switch to RAMFS when the image format is wrong. This led to rebooting the device, which could lead to false impression that upgrade succeded. Being here, factor out the code responsi [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Tomasz Maciej Nowak Don't comence the switch to RAMFS when the image format is wrong. This led to rebooting the device, which could lead to false impression that upgrade succeded. Being here, factor out the code responsible for upgrading RedBoot devices to separate file. Signed-off-by: Tomasz Maciej Nowak (cherry picked from commit 5897c52e78e3cd3846db083d48dd9d6b47ff3a08) --- .../base-files/lib/upgrade/platform.sh | 46 ++++++------------- .../base-files/lib/upgrade/redboot-fis.sh | 31 +++++++++++++ 2 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 target/linux/ath79/generic/base-files/lib/upgrade/redboot-fis.sh diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index 642a9891ff29..f161540a6877 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -8,35 +8,19 @@ REQUIRE_IMAGE_METADATA=1 RAMFS_COPY_BIN='fw_printenv fw_setenv' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' -redboot_fis_do_upgrade() { - local append - local sysup_file="$1" - local kern_part="$2" - local magic=$(get_magic_word "$sysup_file") - - if [ "$magic" = "7379" ]; then - local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$') - - [ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP" - - if grep -q "mtd1.*loader" /proc/mtd; then - tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ - mtd -r $append write - loader:firmware - - else - local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c) - - tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ - mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs - fi - else - echo "Unknown image, aborting!" - return 1 - fi -} - platform_check_image() { - return 0 + local board=$(board_name) + + case "$board" in + jjplus,ja76pf2|\ + ubnt,routerstation|\ + ubnt,routerstation-pro) + platform_check_image_redboot_fis "$1" + ;; + *) + return 0 + ;; + esac } platform_do_upgrade() { @@ -45,7 +29,7 @@ platform_do_upgrade() { case "$board" in adtran,bsap1800-v2|\ adtran,bsap1840) - redboot_fis_do_upgrade "$1" vmlinux_2 + platform_do_upgrade_redboot_fis "$1" vmlinux_2 ;; allnet,all-wap02860ac|\ araknis,an-300-ap-i-n|\ @@ -66,7 +50,7 @@ platform_do_upgrade() { platform_do_upgrade_failsafe_datachk "$1" ;; jjplus,ja76pf2) - redboot_fis_do_upgrade "$1" linux + platform_do_upgrade_redboot_fis "$1" linux ;; openmesh,a40|\ openmesh,a60|\ @@ -98,7 +82,7 @@ platform_do_upgrade() { ;; ubnt,routerstation|\ ubnt,routerstation-pro) - redboot_fis_do_upgrade "$1" kernel + platform_do_upgrade_redboot_fis "$1" kernel ;; *) default_do_upgrade "$1" diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/redboot-fis.sh b/target/linux/ath79/generic/base-files/lib/upgrade/redboot-fis.sh new file mode 100644 index 000000000000..f45d9a2e790e --- /dev/null +++ b/target/linux/ath79/generic/base-files/lib/upgrade/redboot-fis.sh @@ -0,0 +1,31 @@ +platform_check_image_redboot_fis() { + if [ "$(get_magic_word "$1")" != "7379" ]; then + v "Unknown image format, aborting!" + return 1 + else + return 0 + fi +} + +platform_do_upgrade_redboot_fis() { + local append + local sysup_file="$1" + local kern_part="$2" + + if [ "$(get_magic_word "$sysup_file")" = "7379" ]; then + local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$') + + [ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP" + + if grep -q "mtd1.*loader" /proc/mtd; then + tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ + mtd -r $append write - loader:firmware + + else + local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c) + + tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ + mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs + fi + fi +} From patchwork Mon Jul 4 12:23:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 1651980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=g7fF3zyx; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=terefe.re header.i=@terefe.re header.a=rsa-sha256 header.s=default header.b=hyWMFJTj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lc4nq45PZz9sGG for ; Mon, 4 Jul 2022 22:27:43 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/7/hpRc2kRgcA+brOyb31SAgBo7YiSVAMlXiFHpjxLg=; b=g7fF3zyx2miflR w0B0yQISONddOBMdFaEPWBXO3IMQJi94/Wz1ovHaecfotGt1GACVnqU+iAHP5o5TmJwvq8wcbDRoP l1vrXkr578vmoqnKz6iwxR6nsGvHLiY4cFyVR/k0fWEqL7qXeMsiXkHuKQY8kLzu97Io51JHLSttD 6gHwrRvK8/ZI7QwYsYjzuFYTgv5FKxcCdKjFD5GwoZEiuSxByYeACcyq7ZyjHptVd+Wu1ai/AHMEy hSHZMDYbOzwESSlJgpDdSWQari3wkFArggSYMafljp58yL/rRjbHrbLzDRpGjSWKr25IbWY2CizeY OZrwZ3Fg5l3oy4qm78Uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8L8p-008kSg-S1; Mon, 04 Jul 2022 12:25:28 +0000 Received: from mail.terefe.re ([5.255.96.200]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8L74-008jdG-OH for openwrt-devel@lists.openwrt.org; Mon, 04 Jul 2022 12:23:40 +0000 Received: from localhost.localdomain (unknown [212.106.161.60]) by mail.terefe.re (Postfix) with ESMTPSA id CE74620149; Mon, 4 Jul 2022 14:23:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=terefe.re; s=default; t=1656937408; bh=0y6Yi8sGRLsK8DRdQOARMcfGtF9XZRmbPakPuuzE/AQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hyWMFJTjCssCo4ZRZ4hP2QzmnBB1ntacNFoKODnWECsT/wA6lAZLvPiqNyOTD/NhH at93NWdR9ysuu/WaGMZG08TuxTvr424kgxho0PazVXDhaCnfkm6DH/NnVCxFZve00q cItHAeSj8hETmYa5yWKJlLqYCwbRn2/u6RUhTurzXZn/0mMF0GhwAQhiGbq3XSVduw TR/FRp8VWdu/ggaJ+7VdjDudXRcBvBUWE3QDxUXwaaZbUwuF5jcpobsWBMhTMPgiGJ /mvPqVAA4Ohu7PGuOnmg+SNIis99skvRZ2WLOBFjN2o1MyyVINz8+PrL4q1+SZZ7nq vugywDRKHDteg== From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Cc: Tomasz Maciej Nowak Subject: [PATCH 22.03 3/4] ath79: ja76pf2: use nvmem cells to specify MAC addresses Date: Mon, 4 Jul 2022 14:23:05 +0200 Message-Id: <20220704122306.6263-3-tmn505@terefe.re> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220704122306.6263-1-tmn505@terefe.re> References: <20220704122306.6263-1-tmn505@terefe.re> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220704_052338_991061_8A5C183E X-CRM114-Status: UNSURE ( 8.06 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Tomasz Maciej Nowak The bootloader on this board hid the partition containig MAC addresses and prevented adding this space to FIS directory, therefore those had to be stored in RedBoot configuration as aliases to be able [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Tomasz Maciej Nowak The bootloader on this board hid the partition containig MAC addresses and prevented adding this space to FIS directory, therefore those had to be stored in RedBoot configuration as aliases to be able to assigne them to proper interfaces. Now that fixed partition size are used instead of redboot-fis parser, the partition containig MAC addresses could be specified, and with marking it as nvmem cell, we can assign them without userspace involvement. Signed-off-by: Tomasz Maciej Nowak (cherry picked from commit b52719b71a3337e5ae840c7a50fe41ebdc070f4e) --- target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts | 15 +++++++++++++++ .../generic/base-files/etc/board.d/02_network | 4 ---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts b/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts index 7a8e2faa538f..3d2ef9b5ee94 100644 --- a/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts +++ b/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts @@ -90,12 +90,16 @@ ð0 { status = "okay"; + nvmem-cells = <&macaddr_lan>; + nvmem-cell-names = "mac-address"; phy-handle = <&phy0>; }; ð1 { status = "okay"; + nvmem-cells = <&macaddr_wan>; + nvmem-cell-names = "mac-address"; phy-handle = <&phy4>; }; @@ -150,6 +154,17 @@ label = "Atheros Board Data"; reg = <0xff0000 0x10000>; read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_wan: macaddr@1000 { + reg = <0x1000 0x6>; + }; + + macaddr_lan: macaddr@1006 { + reg = <0x1006 0x6>; + }; }; }; }; 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 258b0814424d..e7de69ba18c1 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 @@ -659,10 +659,6 @@ ath79_setup_macs() wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) label_mac=$wan_mac ;; - jjplus,ja76pf2) - wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n alias/ethaddr) - lan_mac=$(macaddr_add "$wan_mac" 1) - ;; mercury,mw4530r-v1|\ tplink,tl-wdr3600-v1|\ tplink,tl-wdr4300-v1|\ From patchwork Mon Jul 4 12:23:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 1651981 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=1ofq3k0V; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=terefe.re header.i=@terefe.re header.a=rsa-sha256 header.s=default header.b=lscxzds2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lc4np4ySKz9sFr for ; Mon, 4 Jul 2022 22:27:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NvAYpws2g1S2CMsg2FKfMm0GMyp5hLpfgXcmVBDwiOw=; b=1ofq3k0VEwrA2g BngG552QpjadGOvsrTuNktMVBccTzoEBsjxQ4oBdq7yGZONy23hr6Gpxco2iCIFzX3Uqusr3tGEwY RFfL1N+jlec8C6jV5bHpCsTX+1jWrErjs+krYEanJQ6+tTc6enjkvzxj1mUg9az5zK+C7hfLU8RjC 2asoW7ZI560WqOpp1pYY/+1AAytJ1F/yN0QgZWSUISRK8+AG5QKxZgBF+cgpPKvQfkbRgMzpbEtwp 3xGm5E9SOS3wvwYxiqZI2aFuoiu98C5SLuh56xmjKzqzuwexhW455aV7nrlwBEYjfS+xHji8exQLT GQTJPljyYID8VZiI60Mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8L7G-008jje-2o; Mon, 04 Jul 2022 12:23:51 +0000 Received: from mail.terefe.re ([5.255.96.200]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8L73-008jch-83 for openwrt-devel@lists.openwrt.org; Mon, 04 Jul 2022 12:23:39 +0000 Received: from localhost.localdomain (unknown [212.106.161.60]) by mail.terefe.re (Postfix) with ESMTPSA id 3DE912014A; Mon, 4 Jul 2022 14:23:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=terefe.re; s=default; t=1656937408; bh=auv/LpB8EOGSbZE+fam0tSlhSSw32sNdrh2pw8fclaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lscxzds2I9YT+gmoIZGgkchP+zaEA+qwdvyvK1ZJpXXC9O2BwaPgZNGdGR+KWChYL 1LoR6vrWEYHdyc/0w9IT+VJv/4IxzakI2j5l37G7FdgHh3Ua619FWxBU5LCBYi2Wsr hqkVqSFlcUb1/6cWzcVxWLxHUIT9O0g5902ZvDDkqxW033N08IF7n1n0JGO+k+2b3s pYYFXwjZOLMVT7zyJ/5kKCS3iLT3SmCR6CG2tRDT0dk7MS4QaUdQEYSQLg2S0F6ZwT Lx5pFv0ac2PkuBJoLOkDewXbqN8lEtP0A8+iooLz4ZIxEmVSW7Wrs4he/hWCSaSZBv bwPTfDEfcx8UQ== From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Cc: Tomasz Maciej Nowak Subject: [PATCH 22.03 4/4] ath79: bsap18x0: pad rootfs image Date: Mon, 4 Jul 2022 14:23:06 +0200 Message-Id: <20220704122306.6263-4-tmn505@terefe.re> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220704122306.6263-1-tmn505@terefe.re> References: <20220704122306.6263-1-tmn505@terefe.re> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220704_052337_765806_2529725D X-CRM114-Status: UNSURE ( 8.85 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Tomasz Maciej Nowak This image is supposed to be written with help of bootloader to the flash, but as it stands, it's not aligned to block size and RedBoot will happily create non-aligned partition size in FIS directory. [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Tomasz Maciej Nowak This image is supposed to be written with help of bootloader to the flash, but as it stands, it's not aligned to block size and RedBoot will happily create non-aligned partition size in FIS directory. This could lead to kernel to mark the partition as read-only, therefore pad the image to block erase size boundary. Signed-off-by: Tomasz Maciej Nowak (cherry picked from commit 9decd2a8436d2bb6b5f436268c92a6e6728486ce) --- target/linux/ath79/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 2b81690654e6..2d4d1e5c91b8 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -208,7 +208,7 @@ define Device/adtran_bsap1880 IMAGE_SIZE := 11200k IMAGES += kernel.bin rootfs.bin IMAGE/kernel.bin := append-kernel - IMAGE/rootfs.bin := append-rootfs | pad-rootfs + IMAGE/rootfs.bin := append-rootfs | pad-rootfs | pad-to $$(BLOCKSIZE) IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | \ check-size | sysupgrade-tar rootfs=$$$$@ | append-metadata endef