From patchwork Tue Nov 10 13:45:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397661 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=SkpnUJIG; 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=a/6TVVo3; 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 4CVq2W419pz9sPB for ; Wed, 11 Nov 2020 00:48:35 +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=NDjr8WVwnw/XDsV645RXY6QB8f1buLUPGcXWaI4wTvc=; b=SkpnUJIGvYG+NHxyntMjf/H4u dKoTptuvGQbdd5NGMWWLfAmUdKms4Cs+EXyJ8DynJ/42NbgeTBh/PU6qdA1QnwINZQXo5Rdj3bz0D hWqa7R9o9/bgklLIXRam1Xoa7edxnflS7l0Vvjid1/p1joBrQlmQF3QF9b2oho0OU76flNWLaPnFw m9f2E6emQia82lSqvUCvUMPDlDu3eD0jEiLaO1yRptHCbIAzgFPsa/b7fQZkL8MEmm8QVvufBtxXs oP6h/x9kK9SKnVvpklR27w+9nQueTtn8XvR3G0eeFOx2AhiToA1pqKPeYl0pVn5qM1B76t1pOUbTo ExMoNsjLA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcTzT-0002fh-9x; Tue, 10 Nov 2020 13:47:19 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcTys-0002Hg-4O for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 13:46:44 +0000 Received: by mail-pl1-x642.google.com with SMTP id w11so6501894pll.8 for ; Tue, 10 Nov 2020 05:46:41 -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=88rduSa4YDTMVA9xOmFNy7FIUS1w8K7Lo6KkIblnxYU=; b=a/6TVVo3lTnXyjJii5nmQzFTOYt/n9oNR278KdIg8l0aMu7ap9FYaF/Zoqt60RbWtM odIuh7HXGdmERI2Y9wfhSUwtc06QA07hiV5F/6hvsGQAqbBojRj1arwCI88Rh7Lf/Juk zOr2PBlngAgU3gUlPqVXYTDRS3gL4ADklqiLHn1rMu8T0CiHyc20mpzJoYPSkUS4PLzQ Qu/TWEBamnFOTcW9WPPV138XX0jEegPXL1JeDGQQsNS2tTumxjv58XQex1xEyPDM/5vE rYGUGUN+0HvMmz7K+EfolefqO52dewjZRyLhAiEykPkJwt1FW6JGy2l8Pn8iNbh7Y4En aKxw== 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=88rduSa4YDTMVA9xOmFNy7FIUS1w8K7Lo6KkIblnxYU=; b=q5lFh2zyqGG9WiQOMAKDKCSg9P/2EoCZDIHiZSEEt4HKL9dhwy6hgX+SUwMsT5PNsh lENgPjs0mJLlnCD9gYn/tYECdLoyElvYDgyFl6bMYikY67OCDEgLw2UhjQrmLxX/BSK2 xPt1s7pWzBfzI4+osNfpoTpES0t5LTkC1cTuRApB4fIfah8f/j7OVt2MiUO2+YdJtgN5 J2NA9a0ghxWliDfr8bwVTM7sdVpn6PZgXF5ntHfMI7guh3RlWWFCWRitDwjMmCOhYYNI mVCM8dFu2NVxT/fatJE+VizwAiV+J8BAVb0R/L+raQN378Yvkj79BSmATej+KAJMjUhW uf2Q== X-Gm-Message-State: AOAM530B0ax6iIEQnowZGkdr8tVVo0yXjGJcfBuLjYIxXlI+Cxp0kmZv 5OgNeWWKfN29LRBe41zfQ3I= X-Google-Smtp-Source: ABdhPJyjtvJVRC0kGAyDkiHBeS5JdgVLhK2yfvHdsOUJrUYHGNuRo4SNsgV9iHjFJ5UgEK1caaFS+A== X-Received: by 2002:a17:902:fe0f:b029:d6:9fa1:eee0 with SMTP id g15-20020a170902fe0fb02900d69fa1eee0mr16436927plj.24.1605016000002; Tue, 10 Nov 2020 05:46:40 -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.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Nov 2020 05:46:39 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v3 11/11] x86: upgrade: make code comment appear as log lines Date: Tue, 10 Nov 2020 21:45:58 +0800 Message-Id: <20201110134558.7905-12-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_084642_225902_32ACD9C5 X-CRM114-Status: GOOD ( 12.99 ) 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:642 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 The comment content can be useful for readers of both the log and code Previously when dd command "records in/out" messages are not filtered like now with get_image_dd, it's not clear that these messages are for extracting boot sectors. E.g. Before == upgrade: Reading partition table from bootdisk... 37+26 records in 37+26 records out == upgrade: Reading partition table from image... After == upgrade: Reading partition table from bootdisk... == upgrade: Extract boot sector from the image 37+26 records in 37+26 records out == upgrade: Reading partition table from image... Signed-off-by: Yousong Zhou --- target/linux/x86/base-files/lib/upgrade/platform.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index 0b54caea29..d8f2eba97e 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -19,7 +19,7 @@ platform_check_image() { get_partitions "/dev/$diskdev" bootdisk - #extract the boot sector from the image + v "Extract boot sector from the image" get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b get_partitions /tmp/image.bs image @@ -82,7 +82,7 @@ platform_do_upgrade() { if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then get_partitions "/dev/$diskdev" bootdisk - #extract the boot sector from the image + v "Extract boot sector from the image" get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b get_partitions /tmp/image.bs image @@ -114,7 +114,6 @@ platform_do_upgrade() { fi done < /tmp/partmap.image - #copy partition uuid v "Writing new UUID to /dev/$diskdev..." get_image_dd "$1" of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync @@ -129,5 +128,4 @@ platform_do_upgrade() { sed -i "s/\(PARTUUID=\)[a-f0-9-]\+/\1$4$3$2$1-$6$5-$8$7-$9/ig" /mnt/boot/grub/grub.cfg umount /mnt fi - }