From patchwork Thu Sep 29 10:10:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 1684351 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.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=FLjK1h25; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=narfation.org header.i=@narfation.org header.a=rsa-sha256 header.s=20121 header.b=mGmmMcL9; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MdTkN626Hz1ypH for ; Thu, 29 Sep 2022 20:14:52 +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=+OzGP/cH8v1JvgLBawHqIw8ktU86+VNec+Wu5ISxMv0=; b=FLjK1h256NB+IA YwXP0u576QXFA/z16c7RcrHdR9O+C9UfZgb3dVIPiTMz6NcarfVO/CTnZ3jChf+53gjO8/guOLGMt QgO3uIHzXKVHI8RzbYkxSmipkGfkXuhznlk5NfJM//KI5W0/geCznihhmGEASohZC0R9H1iNfl7WH r5t+I7Mm84RfcnxdwaWhZXHR1d0+oQJCunyDRyGnPE16r6YurwE3jdV8rZ7n3ZsbyyLOu6GYt1gbD XjYJo4si0yn9yo5D3o0rLxmHbZCXo7LnE63H6rg9rwNLPsO8uARJxMcQr7bE9hnWXiYsRR/ItqMMS hLHe/QnsD/vo1FAnDb+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1odqVK-002KkB-Ss; Thu, 29 Sep 2022 10:10:55 +0000 Received: from dvalin.narfation.org ([2a00:17d8:100::8b1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1odqVF-002Kg7-Qb for openwrt-devel@lists.openwrt.org; Thu, 29 Sep 2022 10:10:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1664446241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=AuRkHZJFMLI92/7zOfSGq06xw6oWkcLgcRBmrpioxdU=; b=mGmmMcL9FyECQwNz0dVMaw2NcWixiLI3ph7z4AZZbDZglAo5oFCpzQO3gvkE2gsYVvTv3K mUTBujth58CQymQyhOg6yuZfA6o+FDy0tRJaJ/8e2v7oEuSXIjttjMlOMuYjwe9NnNkU09 Wt5lGXyyAjdiLNubV3hQYIbqk84iaP4= From: Sven Eckelmann To: openwrt-devel@lists.openwrt.org Cc: Sven Eckelmann Subject: [PATCH] uboot-envtools: Fix format of autogenerated sectors Date: Thu, 29 Sep 2022 12:10:32 +0200 Message-Id: <20220929101032.1672697-1-sven@narfation.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220929_031050_323731_4DCAEDD9 X-CRM114-Status: UNSURE ( 7.43 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) 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: The sector number must be stored in hex. Otherwise, the number (like 16) will be parsed as hex and any write to the partition will end up with an error like: MTD erase error on /dev/mtd5: Invalid argument 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 [2a00:17d8:100:0:0:0:0:8b1 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an 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 The sector number must be stored in hex. Otherwise, the number (like 16) will be parsed as hex and any write to the partition will end up with an error like: MTD erase error on /dev/mtd5: Invalid argument Fixes: 9adfeccd8415 ("uboot-envtools: Add support for IPQ806x AP148 and DB149") Fixes: 54b275c8ed3a ("ipq40xx: add target") Signed-off-by: Sven Eckelmann Reviewed-by: Philippe Mathieu-Daudé --- package/boot/uboot-envtools/files/ipq40xx | 1 + package/boot/uboot-envtools/files/ipq806x | 1 + 2 files changed, 2 insertions(+) diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx index e45e26dcc7..823a33ca1b 100644 --- a/package/boot/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-envtools/files/ipq40xx @@ -26,6 +26,7 @@ ubootenv_mtdinfo () { fi sectors=$(( $ubootenv_size / $mtd_erase )) + sectors=$(printf "0x%x" $sectors ) echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors } diff --git a/package/boot/uboot-envtools/files/ipq806x b/package/boot/uboot-envtools/files/ipq806x index a8285d1452..77dfefbcd8 100644 --- a/package/boot/uboot-envtools/files/ipq806x +++ b/package/boot/uboot-envtools/files/ipq806x @@ -26,6 +26,7 @@ ubootenv_mtdinfo () { fi sectors=$(( $ubootenv_size / $mtd_erase )) + sectors=$(printf "0x%x" $sectors ) echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors }