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 D78C2C19F2A for ; Thu, 11 Aug 2022 20:27:52 +0000 (UTC) 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) 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=20Roh=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 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.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 */ -- 2.20.1