From patchwork Thu Aug 11 20:27:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1665691 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=XYxo2q0A; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3dfZ0rjDz9sGG for ; Fri, 12 Aug 2022 06:28:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 498C284A54; Thu, 11 Aug 2022 22:27:50 +0200 (CEST) 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="XYxo2q0A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8112C84A71; Thu, 11 Aug 2022 22:27:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 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 962BF841EE for ; Thu, 11 Aug 2022 22:27:45 +0200 (CEST) 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 9F97661314 for ; Thu, 11 Aug 2022 20:27:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D58EEC433D7 for ; Thu, 11 Aug 2022 20:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660249663; bh=Q/BjtAP5kUvMKvaxzB6teJkicCMz1+6qhHVo+Mx5gak=; h=From:To:Subject:Date:From; b=XYxo2q0AQdccLgxbVnYP9m6knEB9bqo8ldUFK4GgkJtR+4qCp/Irj060X3pJDe6Ce sX3ZKiznr+R9DHz+a0Ti2MZ9r7hxbZ7LJ1eVvfWO+mGoASiePYhjI2zpAqU+CCZGzO /MW8YeEfcvqfJgBo6Vw4fVx4AjuTMkY+v6taejtBHJPux5KuahWYXVIxKrSV+NVPJL UqyP03CUgYPuO84oLUgWpCMskzmloz2g+thhZGb4Zjf1VUVySPPolpBwPd9iNJeYYf v+KfgXbgTf0h7xrfJ/JkLD2VPiW3XH9zj5u/sybDbIIDBNAUUkOKiB6387qfbBhwkY wjE02gnCJoFJw== Received: by pali.im (Postfix) id B1701C06; Thu, 11 Aug 2022 22:27:39 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: u-boot@lists.denx.de Subject: [PATCH 1/5] Nokia RX-51: Fix invalidating zImage kernel format Date: Thu, 11 Aug 2022 22:27:21 +0200 Message-Id: <20220811202725.24752-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean Prior starting copy of kernel image to target location, invalidate also zImage magic header. This ensures that on target location would be image with valid header only in the case valid header was also in the source location and copy from source to target finished successfully. Copy is always skipped when kernel image in source location is invalid. Add also comment to the code which explain what is the code doing. Fixes: cc434fccba4c ("Nokia RX-51: Add support for booting kernel in zImage format") Signed-off-by: Pali Rohár --- board/nokia/rx51/lowlevel_init.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S index 11c2cbef89a6..632595f83785 100644 --- a/board/nokia/rx51/lowlevel_init.S +++ b/board/nokia/rx51/lowlevel_init.S @@ -72,7 +72,8 @@ copy_kernel_start: /* remove header in target kernel */ mov r5, #0 - str r5, [r3] + str r5, [r3] /* remove 4 bytes header of kernel uImage */ + str r5, [r3, #36] /* remove 4 bytes header of kernel zImage */ /* check for valid kernel uImage */ ldr r4, [r0] /* r4 - 4 bytes header of kernel */ @@ -93,6 +94,8 @@ copy_kernel_loop: bhi copy_kernel_loop copy_kernel_end: + + /* remove header in source kernel image */ mov r5, #0 str r5, [r0] /* remove 4 bytes header of kernel uImage */ str r5, [r0, #36] /* remove 4 bytes header of kernel zImage */