From patchwork Thu Jun 4 08:52:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 480561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EF141140129 for ; Thu, 4 Jun 2015 18:53:05 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=cq3MNlEQ; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id CFE0C28C0A0; Thu, 4 Jun 2015 10:51:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, T_DKIM_INVALID autolearn=no version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id D1EEC28C0A0 for ; Thu, 4 Jun 2015 10:51:09 +0200 (CEST) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 4 Jun 2015 10:51:09 +0200 (CEST) Received: by wgez8 with SMTP id z8so28162281wge.0 for ; Thu, 04 Jun 2015 01:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=Pu7/x9OoYhJwNAOSDJ9oqxhNOYdPK0ooh5bIo0xi0AU=; b=cq3MNlEQkFzFGWkFplXqtdt7pBawh54BIE2LXIp9bZsjJ0zcDmMsEHkNVjl22SExlL pHeluWXU8aEVYq5pKmyTIqwIDXGeMxs7gAEBWGvuHFybGDQ1VFjOlP9G/VyJxeKJdvyd 1gPp4moEam/GaFLmHcd1FTxkMTm2vJeLatD8PXcid+rA2FX1w1uVicMeBQamJNjV1N8r 7Fz84KkNCyLYk1ftITdxS6SBrggGbR+BHXNfmh3QUWDP//gRxaCl+V4tstlJ3isry0Cb I9yt8xZwfkBxHWDQWSt17pgG0knJpyFANji1q+dl2CfjK1uRFZd2bkUB1O1yLpfRv1BH yapw== X-Received: by 10.194.104.164 with SMTP id gf4mr69344717wjb.28.1433407963705; Thu, 04 Jun 2015 01:52:43 -0700 (PDT) Received: from linux-tdhb.lan (acyq161.neoplus.adsl.tpnet.pl. [83.11.200.161]) by mx.google.com with ESMTPSA id ul1sm4723969wjc.30.2015.06.04.01.52.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jun 2015 01:52:42 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: openwrt-devel@lists.openwrt.org, Felix Fietkau , John Crispin , Jo-Philipp Wich Date: Thu, 4 Jun 2015 10:52:31 +0200 Message-Id: <1433407952-22460-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1433325916-24324-1-git-send-email-zajec5@gmail.com> References: <1433325916-24324-1-git-send-email-zajec5@gmail.com> MIME-Version: 1.0 Subject: [OpenWrt-Devel] [PATCH V2 1/2] base-files: default_do_upgrade: accept & forward image extraction command X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" get_image allows passing 2nd argument that is used in a pipe for extracting firmware from a non-native format. By accepting such command in default_do_upgrade we allow platforms to use this helper for vendor specific images. Signed-off-by: Rafał Miłecki --- V2: Slightly document default_do_upgrade --- package/base-files/files/lib/upgrade/common.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 8cdabc6..189ef69 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -212,12 +212,16 @@ jffs2_copy_config() { fi } +# Flash firmware to MTD partition +# +# $(1): path to image +# $(2): (optional) pipe command to extract firmware, e.g. dd bs=n skip=m default_do_upgrade() { sync if [ "$SAVE_CONFIG" -eq 1 ]; then - get_image "$1" | mtd $MTD_CONFIG_ARGS -j "$CONF_TAR" write - "${PART_NAME:-image}" + get_image "$1" "$2" | mtd $MTD_CONFIG_ARGS -j "$CONF_TAR" write - "${PART_NAME:-image}" else - get_image "$1" | mtd write - "${PART_NAME:-image}" + get_image "$1" "$2" | mtd write - "${PART_NAME:-image}" fi }