From patchwork Tue Nov 10 13:45:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397659 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=KED3GGa6; 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=MNbF2aPV; 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 4CVq2P0Pyvz9sPB for ; Wed, 11 Nov 2020 00:48:29 +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=+5yPLG0KaChkTLjcV9VY4hnZ2wqYFK43f+MfUH1q1Tc=; b=KED3GGa638ZsKZiB2LhQjpedg PQfVofUoHnkHGBHAkUgPOn/MPK5NAC37MBtvN1j2BLBUAk9WPHWxQ4BVv4DRlbedIZN+yQ/vKCnhK 3MjjbcdnRq+/qqj9dLQRHO8VO0ixSa9JWJQyiYsFIFAHg/H5mq1AIL8Ni1/N2bYHUx+akocabYkns YUhO4Qkz4hVywjiRiTHDbLMzK6ZmqxTGc9u/rZecpCHpka8TeIFGymAcN6Ew8VvC+ETmF1iO4bM/5 wuGY9+TxZanX3qNChNuZHroqiCz+bQjJoMBrXI80nBk6VKWugZcSEQ5zJ8SL91J0luTGWkacwYjKx Pz+sjJZPA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcTzJ-0002Zt-5e; Tue, 10 Nov 2020 13:47:09 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcTyn-00029t-Dc for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 13:46:40 +0000 Received: by mail-pg1-x542.google.com with SMTP id i26so10199629pgl.5 for ; Tue, 10 Nov 2020 05:46:37 -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=Fcl2JvQjiSLGcWeI3ykKVYR1QQesdP3Hk4YgYVnlVfo=; b=MNbF2aPVUG9ogfzHigvl+d2h+BbgmBidsHDFdkeKLGfo7v0Pf2S7qcWnuf1f2SW0BO gNQchl8nxjR2eTD3kVzO+U5QJCf1RoYiIB/H09AKYNWppdw73VLThf+n7dWK+HLCcyjz 2LytRULNWQ/+ghNYLVivILS7wZooMJ5Z/Dx1D/1SvTchCxydttgiPpLQuoQPDuC9qGBp TWJeLqK43U2YZNGqKdATe7Xw3yHWXhiOAQJLy03vLVKcY1e6hUxg9rKRFOn72Kg1CdAx NoSlXnX4igTmWYkgluxCJHDe8fo6LtZYFt/vO+IM3f9B8LjYqkfVx67H4+GYubJAQ3K4 vO4g== 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=Fcl2JvQjiSLGcWeI3ykKVYR1QQesdP3Hk4YgYVnlVfo=; b=Qts85vA5SU6OU7HIAUQbzFuQpTpu4TM5wrlpaPAOGKpWMpDK146oLYCfRycEhIO8PZ GoNW76MLtmxcWZ1mNxRBUfONsyjxt11ZveKrfisRxSH1grXWF7RgLQyqw0kKwxqrxIUr zytu0cMQ8NaOJfIQt2X4pahDz7n8QrkwupMzoL9pSgeaZHPTojkoCFxjDF7I/DOwaJGA 2ppzqTyEqWqT/fBJfO9hxvG8/gymnC6yFoENN2L9zItDo5SdCvSAWW95qoCZoh424z3p mdHAjNw0HP5oLjqaLTo2mSZP1hGfSOxi8bXhEFHKo9FoL8WRE8wgng5GmvISvZqBvQCp q+ng== X-Gm-Message-State: AOAM531eROwi3T3bN3/nskpyOoooPcYQ67FGI8AoZwmnQ8SXWCBB1pzG Z/wWhUswIEYDU3RpWN+wZwg= X-Google-Smtp-Source: ABdhPJyzlbjIzr4Prm298vYFV5pLEcjJzrF9RIjpjg8k95LCF5D4Upy8xMKajap+DW0qw/8NEM56jg== X-Received: by 2002:a17:90a:3f10:: with SMTP id l16mr5251463pjc.110.1605015995422; Tue, 10 Nov 2020 05:46:35 -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.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Nov 2020 05:46:34 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v3 09/11] x86: upgrade: use v function for writting logs Date: Tue, 10 Nov 2020 21:45:56 +0800 Message-Id: <20201110134558.7905-10-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_084637_507456_2736C24F X-CRM114-Status: GOOD ( 13.55 ) 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:542 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 Signed-off-by: Yousong Zhou --- .../linux/x86/base-files/lib/upgrade/platform.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index 1bcd492dd7..617b267e68 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -7,13 +7,13 @@ platform_check_image() { case "$(get_magic_word "$1")" in eb48|eb63) ;; *) - echo "Invalid image type" + v "Invalid image type" return 1 ;; esac export_bootdevice && export_partdevice diskdev 0 || { - echo "Unable to determine upgrade device" + v "Unable to determine upgrade device" return 1 } @@ -30,7 +30,7 @@ platform_check_image() { rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image if [ -n "$diff" ]; then - echo "Partition layout has changed. Full image will be written." + v "Partition layout has changed. Full image will be written." ask_bool 0 "Abort" && exit 1 return 0 fi @@ -57,7 +57,7 @@ platform_do_bootloader_upgrade() { echo "(hd0) /dev/$diskdev" > /tmp/device.map part_magic_efi "/dev/$diskdev" && parttable=gpt - echo "Upgrading bootloader on /dev/$diskdev..." + v "Upgrading bootloader on /dev/$diskdev..." grub-bios-setup \ -m "/tmp/device.map" \ -d "/tmp/boot/boot/grub" \ @@ -73,7 +73,7 @@ platform_do_upgrade() { local diskdev partdev diff export_bootdevice && export_partdevice diskdev 0 || { - echo "Unable to determine upgrade device" + v "Unable to determine upgrade device" return 1 } @@ -107,15 +107,15 @@ platform_do_upgrade() { #iterate over each partition from the image and write it to the boot disk while read part start size; do if export_partdevice partdev $part; then - echo "Writing image to /dev/$partdev..." + v "Writing image to /dev/$partdev..." get_image "$@" | dd of="/dev/$partdev" ibs=512 obs=1M skip="$start" count="$size" conv=fsync else - echo "Unable to find partition $part device, skipped." + v "Unable to find partition $part device, skipped." fi done < /tmp/partmap.image #copy partition uuid - echo "Writing new UUID to /dev/$diskdev..." + v "Writing new UUID to /dev/$diskdev..." get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync platform_do_bootloader_upgrade "$diskdev"