From patchwork Sun Sep 27 13:59:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sander Vanheule X-Patchwork-Id: 1372072 X-Patchwork-Delegate: ynezz@true.cz 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=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=svanheule.net 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=merlin.20170209 header.b=07/6YUHO; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 header.s=mail1707 header.b=yWCb7RxZ; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 4BznRD0HbKz9sPB for ; Mon, 28 Sep 2020 00:02:45 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=YolsiqHAszBpJOsV02d3dLUU4W6DkUXwurzCnrMbsHY=; b=07/6YUHOZsFoTY6myu/ut080iE 8KmGWpt6l2guo0mrg54aF/M9k8lv889tOQ6T+SGu1P+psOotdYfpbOubJSaoJlOEQC5E7pXRFAIa4 peeYLE0/WaxJmLdvdoOZklckj4p88wNYZcTfMDdAhd/5dByh7h0vVPr8vi+Ood08/w0zs73KdAV2y v5nbdm4aQGmv+jueK3HU84urDs1DH2nPJuButCOGJ+IqvAXsjwp22nD5KKkOgCeRppIdNormkjieA SUDXWQDEBeqwWyq+zMIV0U/WhUmT0m6XH3/R0eobgFlNgY+/k1+iDEZGZRsZaTOBtEcOFHuJt293z I35qRwZA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMXDZ-0004oY-Di; Sun, 27 Sep 2020 13:59:57 +0000 Received: from polaris.svanheule.net ([2a00:c98:2060:a004:1::200]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMXDW-0004nf-Ig for openwrt-devel@lists.openwrt.org; Sun, 27 Sep 2020 13:59:56 +0000 Received: from terra.local.svanheule.net (unknown [IPv6:2a02:a03f:eafe:ac01:5a36:718b:fd23:d93e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sander@svanheule.net) by polaris.svanheule.net (Postfix) with ESMTPSA id 692861864C7; Sun, 27 Sep 2020 15:59:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; s=mail1707; t=1601215185; 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=7VrxP4chTh+mvFKMbIUVAdwhTxAgAvWrMQxlrTLu6Dc=; b=yWCb7RxZ4th+qeBhFWZs/v3EXJMhwox07t+BLW8jqmpyX0mHI2ATMzIPTCdz0E0S7vBaEz 7OH+x71OR0yIouJR2KO2fbgFyfWCSOMEbg++J91xancf6z+YFaEQAWKjXn2frPqwiyGdeW 2n9FTqdJuafgdtitn2YbsBeGXij/Fki58wWSvctTdHMgi14/kWBWGfUq4umWQlqRgPI4yx Nb4ed9H5XE7xV8k3KpJ/W1VbmJUbJjFEwrWqR/zBREXmaUoslusoHzQEhC3gym5KjIe0Ga Hg3InW+Lniv6DsGBrcoQEaloNRR+wdQeMtkW6h9wQBCco9s7lFcvil198RYcuA== From: Sander Vanheule To: openwrt-devel@lists.openwrt.org Subject: [PATCH] ath79: switch to kernel loader for ar9344 CPE/WBS Date: Sun, 27 Sep 2020 15:59:33 +0200 Message-Id: <20200927135933.419394-1-sander@svanheule.net> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200927_095954_944996_AC2E200B X-CRM114-Status: GOOD ( 17.03 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:c98:2060:a004:1:0:0:200 listed in] [list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sander Vanheule Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Now that firmware partitions starting with an ELF kernel loader can be split automatically, move the TP-Link ar9344-based CPE and WBS devices from an OKLI loader to a plain kernel loader. This reduces the size of the device images a bit (2kB for initramfs and sysupgrade). More importantly it takes away the requirement to periodically resize the kernel partition to allow for larger kernels. Note that the firmware size in tplink-safeloader.c is one erase block smaller than the one in the DTSI, due to some runtime space reclamation happening on these devices. Also rebases tplink-eap2x5 on the new tplink-safeloader-elf base device. Signed-off-by: Sander Vanheule --- I've build tested this patch for all affected devices, but I cannot test these new images on the CPE/WBS devices as I do not have these. Any volunteer willing to test this patch on their device would be welcome to do so. target/linux/ath79/dts/ar9344_tplink_cpe.dtsi | 15 +-------- target/linux/ath79/image/common-tp-link.mk | 8 ++--- target/linux/ath79/image/generic-tp-link.mk | 27 +++++++-------- tools/firmware-utils/Makefile | 2 +- tools/firmware-utils/src/tplink-safeloader.c | 33 +++++++------------ 5 files changed, 27 insertions(+), 58 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi b/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi index 044f6c5c19..27c85a8491 100644 --- a/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi +++ b/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi @@ -63,22 +63,9 @@ }; partition@40000 { + compatible = "openwrt,elf"; label = "firmware"; reg = <0x040000 0x780000>; - - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "kernel"; - reg = <0x000000 0x300000>; - }; - - partition@300000 { - label = "rootfs"; - reg = <0x300000 0x480000>; - }; }; partition@7c0000 { diff --git a/target/linux/ath79/image/common-tp-link.mk b/target/linux/ath79/image/common-tp-link.mk index 0b7b0e1935..7ce71811bb 100644 --- a/target/linux/ath79/image/common-tp-link.mk +++ b/target/linux/ath79/image/common-tp-link.mk @@ -84,13 +84,9 @@ define Device/tplink-safeloader-uimage KERNEL_INITRAMFS := $$(KERNEL) endef -define Device/tplink-safeloader-okli +define Device/tplink-safeloader-elf $(Device/tplink-safeloader) LOADER_TYPE := elf - LOADER_FLASH_OFFS := 0x43000 - COMPILE := loader-$(1).elf - COMPILE/loader-$(1).elf := loader-okli-compile - KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | \ - loader-okli $(1) 12288 + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel KERNEL_INITRAMFS := $$(KERNEL) endef diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index 22d1ac8a9e..3a066c1fd6 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -247,7 +247,7 @@ endef TARGET_DEVICES += tplink_archer-d7b-v1 define Device/tplink_cpe210-v1 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := CPE210 @@ -285,7 +285,7 @@ endef TARGET_DEVICES += tplink_cpe210-v3 define Device/tplink_cpe220-v2 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := CPE220 @@ -308,7 +308,7 @@ endef TARGET_DEVICES += tplink_cpe220-v3 define Device/tplink_cpe510-v1 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := CPE510 @@ -320,7 +320,7 @@ endef TARGET_DEVICES += tplink_cpe510-v1 define Device/tplink_cpe510-v2 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := CPE510 @@ -332,7 +332,7 @@ endef TARGET_DEVICES += tplink_cpe510-v2 define Device/tplink_cpe510-v3 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := CPE510 @@ -343,7 +343,7 @@ endef TARGET_DEVICES += tplink_cpe510-v3 define Device/tplink_cpe610-v1 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := CPE610 @@ -353,7 +353,7 @@ endef TARGET_DEVICES += tplink_cpe610-v1 define Device/tplink_cpe610-v2 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := CPE610 @@ -363,10 +363,7 @@ endef TARGET_DEVICES += tplink_cpe610-v2 define Device/tplink-eap2x5 - $(Device/tplink-safeloader) - LOADER_TYPE := elf - KERNEL := kernel-bin | append-dtb | lzma | loader-kernel - KERNEL_INITRAMFS := $$(KERNEL) + $(Device/tplink-safeloader-elf) IMAGE/factory.bin := append-rootfs | tplink-safeloader factory | \ pad-extra 128 endef @@ -737,7 +734,7 @@ endef TARGET_DEVICES += tplink_tl-wr902ac-v1 define Device/tplink_wbs210-v1 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := WBS210 @@ -749,7 +746,7 @@ endef TARGET_DEVICES += tplink_wbs210-v1 define Device/tplink_wbs210-v2 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := WBS210 @@ -760,7 +757,7 @@ endef TARGET_DEVICES += tplink_wbs210-v2 define Device/tplink_wbs510-v1 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := WBS510 @@ -772,7 +769,7 @@ endef TARGET_DEVICES += tplink_wbs510-v1 define Device/tplink_wbs510-v2 - $(Device/tplink-safeloader-okli) + $(Device/tplink-safeloader-elf) SOC := ar9344 IMAGE_SIZE := 7680k DEVICE_MODEL := WBS510 diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 39c3503886..7f1754a347 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME := firmware-utils -PKG_RELEASE := 3 +PKG_RELEASE := 4 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/kernel.mk diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index 82166a9ebb..5674d2fecb 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -140,8 +140,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000}, @@ -263,8 +262,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000}, @@ -342,8 +340,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000}, @@ -384,8 +381,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000}, @@ -426,8 +422,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000}, @@ -466,8 +461,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000}, @@ -506,8 +500,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000}, @@ -538,8 +531,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000}, @@ -570,8 +562,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000}, @@ -603,8 +594,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000}, @@ -636,8 +626,7 @@ static struct device_info boards[] = { {"default-mac", 0x30000, 0x00020}, {"product-info", 0x31100, 0x00100}, {"signature", 0x32000, 0x00400}, - {"os-image", 0x40000, 0x300000}, - {"file-system", 0x340000, 0x470000}, + {"firmware", 0x40000, 0x770000}, {"soft-version", 0x7b0000, 0x00100}, {"support-list", 0x7b1000, 0x00400}, {"user-config", 0x7c0000, 0x10000},