From patchwork Tue Nov 10 13:45:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397660 X-Patchwork-Delegate: yszhou4tech@gmail.com 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=gmail.com 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=ZPE2WD/N; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=alD/I8+3; 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 4CVq2S4qg3z9sPB for ; Wed, 11 Nov 2020 00:48:32 +1100 (AEDT) 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:References:In-Reply-To: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:List-Owner; bh=liO7BWKePv1IXib0R+R04VXfDzAIqL4pclJhW/KdJbI=; b=ZPE2WD/N/6B8Cnl1Nm/aa7s7z k3gOCjBozURhqMecntBaje4tU7Dl58mogHeN6DpRCDbj3siAhuTrsCXuDRo8ZDaQ6Kj3o1NWatLv7 DhoastZdUklLYn9Fgmlc5c1O1CpigVa5lOYwgSXayzIlRVbYkiKeBpF76uMoOu3Tpe3Gl/3tw5qsV RcesTY2g19PwevIw9qMRS/Vl9p3BP2iepEX2oC9NDASyYUXLp6LkCvccovnQjXSKIzzFZq69hGiLW Yt2t2s6ggrAmkVyNtXRST/DCLQ3YgR8rGJlA3PzH9DwB5xoQURdBSsvLnfnUQSX31CX1G5LCNA5iF zlmMgsO4Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcTzO-0002cb-RF; Tue, 10 Nov 2020 13:47:14 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcTyp-0002Dn-HU for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 13:46:43 +0000 Received: by mail-pf1-x441.google.com with SMTP id q10so11489705pfn.0 for ; Tue, 10 Nov 2020 05:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yacUHKKfjmck5cTCAA6En5tPBHMrJh0S1vVweiv+7Bg=; b=alD/I8+3HjesAvHu+tBRT0Dc6nn1muOHFbc3wcbj2yyk82xcg5Ni4RW8PJiFDAetVy YxY+ENFQ+/ekSTagGnJY8HXWo+SXfAqMeGjujfNF03ZBGLgv3jZLSfqKgsaoq5CsOt4C 9IHVv1GY/Xx1UbYA2sPU/GJYdjS0M/Cd3PhGcZozuSMVZTInsJEFrMfNENWo0JnQ7N84 zTg2C6gpMny8fE39z6G6BA+RKu2/FFWnPK3fUyrAtZMfMNXppvA3BuWFwFjhTWX9Z9s0 UQHym5RT6l81znHF+GEoVJ/pmUBkIZ5pTqphkzYSlnOvUr5EZGgY7jYkXkpRdEwk8HCn ijtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yacUHKKfjmck5cTCAA6En5tPBHMrJh0S1vVweiv+7Bg=; b=igoewbfnklRBdEwH/o+RpH7G19U2i7LzW1wwBUxX5t/dOsAW7JbAidYyEpIDdtAEm0 nN3nmAS5iBxWHMWyH9HkHPkelzt4djEkz4dZLv2V5TiW+PTEw4a/itNvgEJknNdGlxRT ZkDrs8ReCtjSKvOajXo5XB6wpPb5GpLbXekGtk6fAEY89j2KXUV/AVbnArhuZLm5QqtZ k6uaR5APGXooGalXM5v6/ivy87YTQvY4mkQ0550zN9Vh7SFu2zqytCjVamwk3t/A3al8 B43RN5kgOsNPtPLdU8KX/+nC76/hH0w31Esd3R2UUGFf8EhZhvPw6tKHJ9/2GYy+JluY wL0A== X-Gm-Message-State: AOAM532dvlqQBnRjr6JMDiI2fWEvJtHVk/GYSNXpDafrkXyHIUwb8ZBh p2eL6Z2yXTA2qqnJErbbcO0as7hvY0s= X-Google-Smtp-Source: ABdhPJyTdljFODNxMsA+nWO+VXSyLYem0WC4m+n/rdUyRt07lwM6yuDsgH89KJsFT24piYplrks+XQ== X-Received: by 2002:a17:90a:5916:: with SMTP id k22mr5467630pji.146.1605015997745; Tue, 10 Nov 2020 05:46:37 -0800 (PST) Received: from titan.office.yunion.io ([103.119.177.162]) by smtp.gmail.com with ESMTPSA id h68sm14605101pfe.74.2020.11.10.05.46.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Nov 2020 05:46:36 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v3 10/11] x86: upgrade: use get_image_dd Date: Tue, 10 Nov 2020 21:45:57 +0800 Message-Id: <20201110134558.7905-11-yszhou4tech@gmail.com> In-Reply-To: <20201110134558.7905-1-yszhou4tech@gmail.com> References: <20201110134558.7905-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_084639_680409_ECDB3FCB X-CRM114-Status: GOOD ( 13.09 ) 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 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [yszhou4tech[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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: Yousong Zhou , OpenWrt Development List Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3140 Reported-by: Philip Prindeville Signed-off-by: Yousong Zhou Reviewed-By: Philip Prindeville --- target/linux/x86/base-files/lib/upgrade/platform.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index 617b267e68..0b54caea29 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -20,7 +20,7 @@ platform_check_image() { get_partitions "/dev/$diskdev" bootdisk #extract the boot sector from the image - get_image "$@" | dd of=/tmp/image.bs count=63 bs=512b 2>/dev/null + get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b get_partitions /tmp/image.bs image @@ -83,7 +83,7 @@ platform_do_upgrade() { get_partitions "/dev/$diskdev" bootdisk #extract the boot sector from the image - get_image "$@" | dd of=/tmp/image.bs count=63 bs=512b >/dev/null + get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b get_partitions /tmp/image.bs image @@ -94,7 +94,7 @@ platform_do_upgrade() { fi if [ -n "$diff" ]; then - get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync + get_image_dd "$1" of="/dev/$diskdev" bs=4096 conv=fsync # Separate removal and addtion is necessary; otherwise, partition 1 # will be missing if it overlaps with the old partition 2 @@ -108,7 +108,7 @@ platform_do_upgrade() { while read part start size; do if export_partdevice partdev $part; then v "Writing image to /dev/$partdev..." - get_image "$@" | dd of="/dev/$partdev" ibs=512 obs=1M skip="$start" count="$size" conv=fsync + get_image_dd "$1" of="/dev/$partdev" ibs=512 obs=1M skip="$start" count="$size" conv=fsync else v "Unable to find partition $part device, skipped." fi @@ -116,7 +116,7 @@ platform_do_upgrade() { #copy partition uuid v "Writing new UUID to /dev/$diskdev..." - get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync + get_image_dd "$1" of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync platform_do_bootloader_upgrade "$diskdev" local parttype=ext4