From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E841FC6FD1C for ; Thu, 23 Mar 2023 19:59:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2810385A6E; Thu, 23 Mar 2023 20:58:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Ogtv9pZN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9EB5A858AB; Thu, 23 Mar 2023 20:58:37 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 86E968576A for ; Thu, 23 Mar 2023 20:58:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 04F866289F; Thu, 23 Mar 2023 19:58:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37AF4C433A0; Thu, 23 Mar 2023 19:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679601510; bh=rk0PidDISlBqR+3RZZFDXNKIXEYnjurDD5btA90FsvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ogtv9pZNteM6jqVgyKH1ysZslP1v+2z1Qd0ibEGiaZNDvtaf08LXF2gpzvCtkcbis bjYffnDdFiNstiF2tSXkIX0yxhs3CCfOOghfl7/D+HigxG1i5McyftSw/EUG2YiI5E 9FsxoqmtzWTtGar6eDH+g5wIPkveMbgRdPebeU59302ojL1Pt5xgNWXIXbaFmnJxKi qX32A9BEJftu0OIZEiX8lJzuEVrGVuHzMsRC3uLxWQWocQLgQyPSiViIwN8PiFNXM7 hoAZkjJgWO3fKEPEtLaIeMhyOVtcozMr3MEORiEzzUOdVBnANAXqzSCDkK0RqQ1teG sWNdKWEXsTOTQ== Received: by pali.im (Postfix) id B856D13A8; Thu, 23 Mar 2023 20:58:27 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese , Martin Rowe Cc: u-boot@lists.denx.de Subject: [PATCH u-boot-mvebu 3/5] tools: kwboot: Fix inserting UART data checksum without -B option Date: Thu, 23 Mar 2023 20:57:53 +0100 Message-Id: <20230323195755.5131-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230323195755.5131-1-pali@kernel.org> References: <20230323195755.5131-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Commit 7665ed2fa04e ("tools: kwboot: Fix parsing UART image without data checksum") added fixup code to insert place for data checksum if UART image does not have it. Together with option -B (change baudrate), kwboot calculates this checksum. Without option -B, it inserts only place for checksum but does not calculate it. This commit fix above logic and calculate data checksum also when kwboot is used without -B option. Fixes: 7665ed2fa04e ("tools: kwboot: Fix parsing UART image without data checksum") Signed-off-by: Pali Rohár --- tools/kwboot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/kwboot.c b/tools/kwboot.c index dd894e80db1c..23a893a9b9f8 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -2082,6 +2082,8 @@ kwboot_img_patch(void *img, size_t *size, int baudrate) goto err; } kwboot_img_grow_data_right(img, size, sizeof(uint32_t)); + /* Update the 32-bit data checksum */ + *kwboot_img_csum32_ptr(img) = kwboot_img_csum32(img); } if (!kwboot_img_has_ddr_init(img) && -- 2.20.1