From patchwork Mon Jan 14 17:54:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 1024734 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) 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=lemmela.net Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cTU/dGog"; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=lemmela.net header.i=@lemmela.net header.b="GyH9lENl"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43dh413sldz9sCr for ; Tue, 15 Jan 2019 04:56:33 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject: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=4GrDQYm8RBQ5AP9rIukVYof7lLxpQWqibQbWyXHGV1I=; b=cTU/dGogWJw9zd p6+26hbrqMYW/6zQT33w5368D/RiyIChwhklBvzVl2GoASyCRceI0kaGBEXHMAI6vs5AVSSj94NkZ ozHR9riNnDnr4i0zbAfx1Nkefb72Mox3Jkr6ewrrl7+ENG/Yv/nlkuX/FhrFWNU/idVzMfdRvNZ/p WERjzELM6HyWOX17JJ/aHtE4e6J3rC3jluMlayJORbKjj0d3yQxONFm7PyLMH8OedxCjPi+Xelbs8 tqxRvoUe09MQ9Sq1EIdovkRTnmTQk0c6hk/LOh+aVnSLJXW2M1332jgSoqKaW65lYxSSBLwpM3+6a o7znWMv9RlXF5ZUAdvtg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gj6TN-0004AE-Oq; Mon, 14 Jan 2019 17:56:29 +0000 Received: from mail1.kuutio.org ([2001:41d0:401:3100::431a]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gj6Ro-0001Dj-Ng for openwrt-devel@lists.openwrt.org; Mon, 14 Jan 2019 17:54:56 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id 5B01C1FBEA; Mon, 14 Jan 2019 18:54:48 +0100 (CET) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received; s=dkim; t=1547488487; x= 1550080488; bh=NcUZs+lW2Ebn62rrZNx29xSQahOm0+CHl4C42VObhAU=; b=G yH9lENlkpLLgz7dKyb/KXIm7dTQCh1glNInK1BZXxbQk3zXJB1rz9ysPaBjqMXJn VCAUsJn7zci/I1+ylBOA01uUi62WgfZ8kmQFUo5s/H8qILBoBHWhaJpe06MfbJ64 5qZdTyUVYgJucE0yf1e87K4ZMU1PYuaXAit2aUg0+1rSIC8rCJ1qbcI5E95Bu63E f0JonHmgaFl3HjguBCMyYWixnc+kDGDCWz6sEcUynZ8CLyMIcKavnWqZDfLdSpvq nnLkNaI8WIaD2Et20OibArEdZ5hoQEje21+aAlb2HlTkV/W14dUhzW3ezbieXA8o bweju8kaWVcfWybPD3takIDQmD9mGBKN0xqaZ7JpigNDSPSrXDU9xCkd26dBPVX1 umgciIVA5D0Qo57Xp+kic7aFb3mI62c9qBy2wj+wVJf9EJbbQtGi6aodKdYKmA93 CWkTcoZf2wnk6VHulBRd31m6l1xmH+VRRfKLOyDgYDXx9hVZmtHpn5soy+vygoE1 yByawQ1uZRLOjsEGxBrZulUopnixDvdD1kvn3JcnHGvI4UBNQEwqkbgnQDr/DNBQ G2Tr0lm0KgCs+rNlX9kG0KiMUHeFe5bBfDjOu/oPd6Ho/++65Q0cIxN/QjiFI3pe f403K8vmAtpK+ssCKz8yPPBYvZYHLD2/+BXXVL/noI= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 6MfoYHuExbLL; Mon, 14 Jan 2019 18:54:47 +0100 (CET) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id 7C4251FBFA; Mon, 14 Jan 2019 18:54:42 +0100 (CET) From: Oskari Lemmela To: openwrt-devel@lists.openwrt.org Date: Mon, 14 Jan 2019 19:54:29 +0200 Message-Id: <20190114175429.7320-10-oskari@lemmela.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190114175429.7320-1-oskari@lemmela.net> References: <20190114175429.7320-1-oskari@lemmela.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190114_095453_276795_DFFDD4FA X-CRM114-Status: GOOD ( 10.02 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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_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 Subject: [OpenWrt-Devel] [PATCH 9/9] sunxi: sysupgrade: add support for pine64 lts spi flash X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Oskari Lemmela MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Add support for updating SPI flash device firmware. U-boot has to be programmed to spi flash device /dev/mtd0 manually before switching from sdcard to SPI flash device. Running sysupgrade with sysupgrade.bin will write firmware partition and copy configuration files from sdcard. Signed-off-by: Oskari Lemmela --- .../sunxi/base-files/lib/upgrade/platform.sh | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/target/linux/sunxi/base-files/lib/upgrade/platform.sh b/target/linux/sunxi/base-files/lib/upgrade/platform.sh index 88ef4790e9..436e4d8517 100644 --- a/target/linux/sunxi/base-files/lib/upgrade/platform.sh +++ b/target/linux/sunxi/base-files/lib/upgrade/platform.sh @@ -1,5 +1,17 @@ +PART_NAME=firmware + platform_check_image() { local diskdev partdev diff + local firmware_mtd=$(find_mtd_part firmware) + local image_magic="$(get_magic_long "$1")" + + if [ -n "$firmware_mtd" ] && [ "$image_magic" != "00000000" ]; then + REQUIRE_IMAGE_METADATA=1 + if ! $(fwtool_check_image $@); then + return 1 + fi + return 0 + fi export_bootdevice && export_partdevice diskdev -2 || { echo "Unable to determine upgrade device" @@ -35,7 +47,7 @@ platform_copy_config() { fi } -platform_do_upgrade() { +platform_do_upgrade_mmc() { local diskdev partdev diff export_bootdevice && export_partdevice diskdev -2 || { @@ -87,3 +99,19 @@ platform_do_upgrade() { echo "Writing new UUID to /dev/$diskdev..." get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync } + +platform_do_upgrade() { + local board=$(board_name) + local image_magic="$(get_magic_long "$1")" + + if [ "$image_magic" != "00000000" ]; then + case "$board" in + pine64,pine64-lts) + default_do_upgrade "$ARGV" + ;; + esac + else + platform_do_upgrade_mmc "$ARGV" + fi + +}