From patchwork Wed Nov 13 21:09:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Kletsky X-Patchwork-Id: 1194473 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=allycomm.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nct9oahJ"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 47Cy1c0h6Dz9s4Y for ; Thu, 14 Nov 2019 08:10:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date: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=I4xZQHKweEyj99BrHqnSHHQFtDKy+/5Wz3BVti84Bk4=; b=nct9oahJbJA2ky fBmqNTe8ikYtBCc2bwTNZKkJkzzPKfuNZfs/a7ic2O+0MUQdJMiFJUI2Mx45Rez+bKwjTFZpBbhKt TYjKQsraSGKJcUGvncLlfssbEbJ9P7nmUZmI6yRXfDYVnkA1qyBrm961Ng7TXqW4jdP2yi2Jr3cAs 8EsRJW63+FXRhNLMfWLfXPrOgsue31KQuxtS+mPIeWEZjjOS5qWPVpkBOdi0SR2626m8W39j+qNRO aHYgUkQ5tih1XcUtvieEc9D6PVubj7xc8lfvvCJuaygWjwDsJe143gUepiu09y3WJXe/nAj/97yO2 olJYTou3kVaziW27BXng==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUztu-0003mb-IB; Wed, 13 Nov 2019 21:10:06 +0000 Received: from mx.allycomm.com ([138.68.30.55]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUzto-000305-S5 for openwrt-devel@lists.openwrt.org; Wed, 13 Nov 2019 21:10:05 +0000 Received: from allycomm.com (unknown [IPv6:2601:647:5401:2210::49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.allycomm.com (Postfix) with ESMTPSA id CED5E49DEB; Wed, 13 Nov 2019 13:09:57 -0800 (PST) From: Jeff Kletsky To: openwrt-devel@lists.openwrt.org Date: Wed, 13 Nov 2019 13:09:48 -0800 Message-Id: <20191113210949.2490-1-lede@allycomm.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191113_131003_900251_1D60487F X-CRM114-Status: UNSURE ( 7.51 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH 1/2] build: define check-kernel-size to remove unflashable images X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chuanhong Guo , Jeff Kletsky Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Jeff Kletsky Certain boards have limitations on U-Boot that prevent flashing of images where the kernel size exceeds a threshold, yet sysupgrade can sucessfully manage larger kernels. The current check-size will remove the target artifact if its total size exceeds the threshold. If applied after append-kernel, it will remove the kernel, but the remaining image-assembly steps will continue, resulting in an image without a kernel that is likely unbootable. By defining check-kernel-size, it is now possible to prevent release of such unbootable images through a construct similar to: IMAGE/factory.img := append-kernel | pad-to $$$$(GL_UBOOT_UBI_OFFSET) | \ append-ubi | check-kernel-size $$$$(GL_UBOOT_UBI_OFFSET) Cc: Chuanhong Guo Signed-off-by: Jeff Kletsky --- include/image-commands.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/image-commands.mk b/include/image-commands.mk index 5dfd6a2c2f..f561ad4669 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -271,6 +271,13 @@ define Build/check-size } endef +define Build/check-kernel-size + @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$(stat -c%s $(IMAGE_KERNEL))" ] || { \ + echo "WARNING: Kernel for $@ is too big > $(1)" >&2; \ + rm -f $@; \ + } +endef + define Build/combined-image -sh $(TOPDIR)/scripts/combined-image.sh \ "$(IMAGE_KERNEL)" \ From patchwork Wed Nov 13 21:09:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Kletsky X-Patchwork-Id: 1194474 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=allycomm.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="q6uOV00Q"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 47Cy242hCyz9s4Y for ; Thu, 14 Nov 2019 08:10:36 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Wf+RmaJBhFQodL+N1Kbl7S+kgTSjpgQaKuisi6zO/oA=; b=q6uOV00QmVWCW4 b/IGIMCWU9a38gmxFxE1UE+EoutgPpBReCMqiaZ7fDDKPS/fTorbzMYEg/pJNxZt14s5DyOzG7fYY 5GXn5KNiqpBm07UDmp7KJfvrvmvMt5vSQSD2wKo8VZKlll3oi2ugOhgDeshu5nUEBNdVBdA+SiUWh f3Pn4RW9sfPfo7me1L++CgDpjzRc7rfA7ncCDKfcaTB4S+yZlSR6zkyy3GRYslvbpuYu2us/umSU2 nQoIJEy/7jNc7D23qRTdpduqPzIWi+5IMBO4MyC+0oV8dDQ1hV6KLTf4+/AFDQZpJjcCJFcZ4cSfX Hdkko87R5CWzZI7o9N0Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUzuK-0004Xf-Am; Wed, 13 Nov 2019 21:10:32 +0000 Received: from mx.allycomm.com ([138.68.30.55]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUzuH-0004Wk-Vk for openwrt-devel@lists.openwrt.org; Wed, 13 Nov 2019 21:10:31 +0000 Received: from allycomm.com (unknown [IPv6:2601:647:5401:2210::49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.allycomm.com (Postfix) with ESMTPSA id 6475B49DEC; Wed, 13 Nov 2019 13:09:59 -0800 (PST) From: Jeff Kletsky To: openwrt-devel@lists.openwrt.org Date: Wed, 13 Nov 2019 13:09:49 -0800 Message-Id: <20191113210949.2490-2-lede@allycomm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191113210949.2490-1-lede@allycomm.com> References: <20191113210949.2490-1-lede@allycomm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191113_131030_021073_DF76CC59 X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH 2/2] ath79: GL-AR750S (NOR/NAND): limit factory.img kernel size to 2 MB X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chuanhong Guo , Jeff Kletsky Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Jeff Kletsky The present U-Boot for GL-AR750S has a limit of 2 MB for kernel size. While sysupgrade can manage kernels up to the present limit of 4 MB, directly flashing a factory.img with a kernel size greater than 2 MB through U-Boot will result in an unbootable device. This commit uses the newly-introduced check-kernel-size build operation to prevent the output of factory.img when the kernel exceeds 2 MB in size, yet permits output of sysupgrade.img as long as the kernel is within KERNEL_SIZE := 4096k Cc: Chuanhong Guo Signed-off-by: Jeff Kletsky --- target/linux/ath79/image/nand.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 7940167e1a..75c1af89bb 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -89,12 +89,15 @@ define Device/glinet_gl-ar750s-common VID_HDR_OFFSET := 2048 endef +# NB: The kernel size is intentionally restricted at this time; see commit message define Device/glinet_gl-ar750s-nor-nand $(Device/glinet_gl-ar750s-common) DEVICE_VARIANT := NOR/NAND BLOCKSIZE := 128k + GL_UBOOT_UBI_OFFSET := 2048k IMAGES += factory.img - IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi + IMAGE/factory.img := append-kernel | pad-to $$$$(GL_UBOOT_UBI_OFFSET) | \ + append-ubi | check-kernel-size $$$$(GL_UBOOT_UBI_OFFSET) IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata SUPPORTED_DEVICES += glinet,gl-ar750s-nor endef