From patchwork Sat Mar 20 10:48:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Mork?= X-Patchwork-Id: 1456089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=k7829/8y; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=mork.no header.i=@mork.no header.a=rsa-sha256 header.s=b header.b=WwpGBcKn; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F2cxX4MyJz9sWC for ; Sat, 20 Mar 2021 21:50:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=4O5bIkZDzFKD+EhZ8Uvz2QmdzHiqFn7OHfARYElhJCo=; b=k7829/8yle23cDZs/iohyFajM Znk77wn6/RoIgNPufrRIg8UBREcdt3sDzYhCJMhojcWxFlU/zcuH2T+djc/w2yjAlsmZQbM2cBT9b p+pkVGkd4YGg7EG04VRS+7XlbccqrgRd+2R1vWiLSwo1VOLCKwO6hTZaIyXHRHSOcU/inv3TSqmpo 6IRTIlhI/he459RWzIHyFeRhIfI36PTVvtpSv7HixduNs1oHxg3iKnqN9yYExyfQKDPc68gWmbcrq ClTbeW1XhDsIXBCAyPl7TtMlapKm1jLmLppPbmvLQGDVDlbmv5sz0YvUaiPbCOFzg4QoY+UTyue1w hhxIJsOKg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNZA4-008jK8-I7; Sat, 20 Mar 2021 10:48:52 +0000 Received: from canardo.mork.no ([2001:4641::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lNZ9r-008jIA-Mh for openwrt-devel@lists.openwrt.org; Sat, 20 Mar 2021 10:48:42 +0000 Received: from canardo.mork.no (ip6-localhost [IPv6:0:0:0:0:0:0:0:1]) by canardo.mork.no (8.15.2/8.15.2) with ESMTPS id 12KAmYnb028963 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Sat, 20 Mar 2021 11:48:34 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mork.no; s=b; t=1616237314; bh=XxB9BJsrFTkcbYeOnZMp22V3qt+k47fbU0iIkGG1pB4=; h=From:To:Cc:Subject:Date:Message-Id:References:From; b=WwpGBcKnqGUBQYDskAsQGF/x34xBB1DOuQqnKgMKzV/VwQ5Y63UV4+WoTsfa40Jcl nowIdxWO65E3GMX2V5od94uWKFzjlBB73c8X5JUBZUTblggvw48MerSs0OKTIOKT40 5vG8yZ7o5rYpu2IcBRSuMyd2CWJ8fKsypNyG3i2U= Received: (from bjorn@localhost) by canardo.mork.no (8.15.2/8.15.2/Submit) id 12KAmY2h028954; Sat, 20 Mar 2021 11:48:34 +0100 From: =?utf-8?q?Bj=C3=B8rn_Mork?= To: openwrt-devel@lists.openwrt.org Cc: =?utf-8?q?Bj=C3=B8rn_Mork?= Subject: [PATCH 1/4] mvebu: sysupgrade: drop unnecessary UBI to UBI logic Date: Sat, 20 Mar 2021 11:48:24 +0100 Message-Id: <20210320104827.28887-2-bjorn@mork.no> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210320104827.28887-1-bjorn@mork.no> References: <20210320104827.28887-1-bjorn@mork.no> MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on canardo.mork.no X-Virus-Scanned: clamav-milter 0.102.4 at canardo X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210320_104840_021712_4F80D89E X-CRM114-Status: GOOD ( 11.91 ) X-Spam-Score: -2.5 (--) 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: The recent changes to the maximum kernel size for Mamba and Venom highlighted the fact that the old Mamba kernel size has been hardcoded in linksys_get_root_magic() even for devices with a different k [...] Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2001:4641:0:0:0:0:0:1 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 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 The recent changes to the maximum kernel size for Mamba and Venom highlighted the fact that the old Mamba kernel size has been hardcoded in linksys_get_root_magic() even for devices with a different kernel/rootfs split. The purpose of this code seems to be to avoid issues caused by partially overwriting an existing UBI partition, where some of the erase counters would be reset but not the unmodified ones. This problem has been solved in a more generic way by the UBI EOF marker. This ensures that any old PEBs after the marker are properly initialized. It is therefore unnecessary to erase the whole partition before flashing a new OpenWrt factory image. Signed-off-by: Bjørn Mork --- .../base-files/lib/upgrade/linksys.sh | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/linksys.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/linksys.sh index c5da471d76f1..aaa32eb4ea78 100644 --- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/linksys.sh +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/linksys.sh @@ -44,10 +44,6 @@ linksys_get_target_firmware() { esac } -linksys_get_root_magic() { - (get_image "$@" | dd skip=786432 bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2>/dev/null -} - platform_do_upgrade_linksys() { local magic_long="$(get_magic_long "$1")" @@ -75,20 +71,7 @@ platform_do_upgrade_linksys() { nand_upgrade_tar "$1" } [ "$magic_long" = "27051956" -o "$magic_long" = "0000a0e1" ] && { - # check firmwares' rootfs types - local target_mtd=$(find_mtd_part $part_label) - local oldroot="$(linksys_get_root_magic $target_mtd)" - local newroot="$(linksys_get_root_magic "$1")" - - if [ "$newroot" = "55424923" -a "$oldroot" = "55424923" ] - # we're upgrading from a firmware with UBI to one with UBI - then - # erase everything to be safe - mtd erase $part_label - get_image "$1" | mtd -n write - $part_label - else - get_image "$1" | mtd write - $part_label - fi + get_image "$1" | mtd write - $part_label } }