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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81D1EC433EF for ; Fri, 5 Nov 2021 15:47:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6A053604DC for ; Fri, 5 Nov 2021 15:47:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6A053604DC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AB2428290A; Fri, 5 Nov 2021 16:47:41 +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="DqqJBpdj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C2DB5836F9; Fri, 5 Nov 2021 16:47:38 +0100 (CET) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 A877D8187B for ; Fri, 5 Nov 2021 16:47:35 +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: by mail.kernel.org (Postfix) with ESMTPSA id 00A2A6008E; Fri, 5 Nov 2021 15:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636127254; bh=ORNbkfZY3DGb6+G6/sqTSdZ4AN6+opvp/SZC3mVCO0s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DqqJBpdj873wFmhuAqbsPv1LcxyQix5rCSEChL1n7q4QEbvhuTWOkGQr33ytQfZvE iznj7wY5oDoiQqQpK7qJLfzguEbxLSzqCjwtKWM5oY0Ga5upP/kw4kGsFN9wawdMUb 0vspA7wTJiLniCdjTIMAGAjKdzkwwmRk0OqIcUhch+cBdYckfJIszAN7cIwKxndJY1 SY55H1NG24VBp78Ox2G0USGhcu5P7k8pzrULg7rokWY+GPy5diBjG7sBqNVEMinJNX zMzKADALpZRMxHqGKxamxZ8z1RP/Ug4/Fe6yOp5aj/j6kUs0jSumvN1GW/QYhbS9jW +YwPtN5Y/nuDQ== Received: by pali.im (Postfix) id 7F922638; Fri, 5 Nov 2021 16:47:31 +0100 (CET) Date: Fri, 5 Nov 2021 16:47:31 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Tom Rini Cc: Stefan Roese , Marek =?utf-8?B?QmVow7pu?= , u-boot@lists.denx.de Subject: Booting zImage with appended DTB without ATAGs support Message-ID: <20211105154731.qsckprgirfhn5rc5@pali> References: <20211011140321.GY7964@bill-the-cat> <20211011142548.35wvxhrvhiafghar@pali> <20211011143222.GE7964@bill-the-cat> <20211011143344.vyngtyi2h4dp6dvi@pali> <20211011144544.GF7964@bill-the-cat> <20211011154905.wuqf3rzpwkouucwx@pali> <20211105113821.4cb2kbaqysouy7pl@pali> <20211105143510.GT24579@bill-the-cat> <20211105151646.fgu42idv2esf6rcv@pali> <20211105152001.GV24579@bill-the-cat> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211105152001.GV24579@bill-the-cat> User-Agent: NeoMutt/20180716 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean On Friday 05 November 2021 11:20:01 Tom Rini wrote: > On Fri, Nov 05, 2021 at 04:16:46PM +0100, Pali Rohár wrote: > > So now I have a question: Do we want to support booting zImage with > > appended DTB in U-Boot when ATAGs support is now disabled by default? > > Based on your experience, yes, there are use cases for appended dtb > booting still. So it should be at least documented what you need to do > where in order for that to work, and perhaps some platforms will want to > enable it by default. What could be implemented in U-Boot is extracting DTB from zImage+DTB binary and boot it like if user supply separate zImage and separate DTB files. With this approach there is no need to have ATAGs support enabled. It would mean that kernel's code for using attached DTB would not be used anymore as DTB would be passed to kernel separately, like any modern boot setup. Main issue with this approach is that if you load zImage+DTB binary from disk or UART into memory then you loose information about total binary size. And if you examine memory after the zImage, you cannot be sure if data were loaded by previous command (disk read, UART transfer) or if is just some garbage in RAM. So you can have false-positive detection that DTB was appended. This issue does not happen in case of booting zImage+DTB encapsulated in uImage format, as in uImage is stored total size of that concatenated binary. So booting via bootm should be fine. IIRC zImage+DTB-in-uImage via bootm is used for booting new kernels on Nokia N900. Currently affected by this issue is bootz command, which takes only start address of the zImage binary and total size is not specified. Command bootz takes third argument which specifies location of DTB in memory and understand special value "-" which says to atags booting. I'm thinking here... what about adding a new special value e.g. "+" which would mean that DTB is attached to zImage? This could issue that automatic detection of attached DTB into zImage is not reliable. Any opinion? Another approach instead of extracting DTB from zImage+DTB binary could be to teach U-Boot to provide some simple minimalistic ATAGs and then boot those zImage+DTB binaries like before with minimalistic ATAGs...