Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4817524rdh; Wed, 29 Nov 2023 11:28:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYWivvRvPKLIbgfFNcE1yfm9ABw8Najgm8pgtQTDCIp4SsYhwn5Pi6wzaWoVRQiNW0c39w X-Received: by 2002:a17:902:f68e:b0:1cf:9bd1:aaea with SMTP id l14-20020a170902f68e00b001cf9bd1aaeamr23726773plg.11.1701286086926; Wed, 29 Nov 2023 11:28:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701286086; cv=none; d=google.com; s=arc-20160816; b=KlgoNpZmgaNlNVzbsZwWfW4oOJxLn+TZQbDRsdnwTeub9/FgZy56ey9Uo1LIiyA4lo Fme4aX4cht/IIGd4bBusJ4I0sX8IvMrNGTev88pw9a2ckD7lbD0yTWz0Khm3TEmdhPB5 c6S7dwk8KeyqOPHkYtB9nd4P3oWvv1a4OKNO79gmsWlbQUcm2Ndx51l+MMIPE09uv09z +cfARnf4AO1TDzEoyGazfLuHFK8ni3Jmlx8v+BMe4dR1GJnxNdBP86tomVaSmmBIxwcq LQt/VWjL9wzTki9GFnCSYc6N/VE2xHe+3YatZPGK+zGrk8YrowlYPv+Anwdboro3/aVq p6Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6gR6QlSoTlyq04eRwNKCnLLqDlXv6VkMGmXKmkbAaQ0=; fh=hE818ivoe0UZgus+AMQyIn64tEUoOmlIpLc/j3V+Ylg=; b=Mq0GXPebZXwPnKh7wH5EXQBTffLpLJOBkKSBzsBajLRqM9EClcMcaEkAaaJ/WxA4C5 ojHDA+L8/pLJjENzky0Mfqs39+VEijWEtBYSLu0UuJ2PWjVriow7DgkpfwTpsypw0gYf saSy3Dm1yEWTC2udxx47MojqO5T/PdVVOr503TSZ10m81qphMtW0ZxYI2WMB+EvzUKjS J25VqlOZ1kl16dvSD3L/fSEIvi/HBQmdTBPN4YLO1R+TN9PDGTr59/X/srJky4yREflD cYrzeOegJHkJcJk22oCKc87rqyehpaJqlQKaRYWbC8c1GXsCJaHLC42nsa4wrEgntIhL 92hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YIKd2P8k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id x5-20020a170902ec8500b001cfdbf8f24fsi5930273plg.503.2023.11.29.11.28.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 11:28:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YIKd2P8k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 33121804080E; Wed, 29 Nov 2023 11:28:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230355AbjK2T1r (ORCPT + 99 others); Wed, 29 Nov 2023 14:27:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbjK2T1q (ORCPT ); Wed, 29 Nov 2023 14:27:46 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EDAEA2 for ; Wed, 29 Nov 2023 11:27:52 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a178e82a445so16512166b.2 for ; Wed, 29 Nov 2023 11:27:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701286070; x=1701890870; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=6gR6QlSoTlyq04eRwNKCnLLqDlXv6VkMGmXKmkbAaQ0=; b=YIKd2P8k4sSMCmJtAiaRX/RXoHwSEE0jNkpZy69FznQzOS1y8AWKOAlHZEhf90qKqG 0qIgyp/EHkAVsEi/r4HZl0XbafWUCyhBF3qjyFLNJ3O6qtew+Yvl20lW6nvgB9aiKEUF w/pB6sC7iE90vxTNzTCV9hbpW7aBSUCh5roIk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701286070; x=1701890870; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6gR6QlSoTlyq04eRwNKCnLLqDlXv6VkMGmXKmkbAaQ0=; b=QJn/CbDtNtyg1Zo0+wtOUJ5knJeHBd9+VW9vnLBSZunrV8bVXT7YV0rypf/R4FbX4s dNuc96MwGWzPV9MjhyLhTS7/P81FmJR9adWqB/aqH2ehiDcMrwygQlE5VNn3G4vFFpX1 dWRZwfA2T9Dpv0NGfGycrVsLCF4SyL69D3Rr5JycpeVyygKaqIcyp0TEyczuMHvwFr2t Kqe3mNDyLdEm6f5UoY+QwEO4AQGk0UtwBt1ppiufD6gLofC/9RiNq6WgmJjQTds3QItL UvKAMgWMAO7ZT3jpN3rLphn92cFavtxx7sbXcax9KiW6VpX77opAVwlS73paiAeaVItF 4bLQ== X-Gm-Message-State: AOJu0YwLHqpoMmjzc6tekJ8KhYbazo0HyFa4uJMxw0WZTkhteEgsUUwa 3z633ioZBc3Xsm7ffTkPpdsQR7FhiWtVmA4ouQDcRA== X-Received: by 2002:a17:906:ccc5:b0:a11:d323:c1bc with SMTP id ot5-20020a170906ccc500b00a11d323c1bcmr5061259ejb.19.1701286070318; Wed, 29 Nov 2023 11:27:50 -0800 (PST) MIME-Version: 1.0 References: <20231129172200.430674-1-sjg@chromium.org> <20231129172200.430674-3-sjg@chromium.org> <30f32467-51ea-47de-a272-38e074f4060b@pengutronix.de> <875f0dbc-1d78-4901-91b2-6ad152bcea5a@pengutronix.de> In-Reply-To: <875f0dbc-1d78-4901-91b2-6ad152bcea5a@pengutronix.de> From: Simon Glass Date: Wed, 29 Nov 2023 12:27:38 -0700 Message-ID: Subject: Re: [PATCH v7 2/2] arm64: boot: Support Flat Image Tree To: Ahmad Fatoum Cc: linux-arm-kernel@lists.infradead.org, Masahiro Yamada , Tom Rini , lkml , U-Boot Mailing List , Catalin Marinas , Nathan Chancellor , Nick Terrell , Nicolas Schier , Will Deacon , linux-kbuild@vger.kernel.org, Pengutronix Kernel Team Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 29 Nov 2023 11:28:04 -0800 (PST) Hi Ahmad, On Wed, 29 Nov 2023 at 12:15, Ahmad Fatoum wrote: > > Hello Simon, > > On 29.11.23 20:02, Simon Glass wrote: > > Hi Ahmad, > > > > On Wed, 29 Nov 2023 at 11:59, Ahmad Fatoum wrote: > >> > >> Hi, > >> > >> a few more comments after decompiling the FIT image: > >> > >> On 29.11.23 18:21, Simon Glass wrote: > >>> + with fsw.add_node('kernel'): > >>> + fsw.property_string('description', args.name) > >>> + fsw.property_string('type', 'kernel_noload') > >> > >> The specification only says no loading done, but doesn't explain what it > >> means for a bootloader to _not_ load an image. Looking into the U-Boot commit > >> b9b50e89d317 ("image: Implement IH_TYPE_KERNEL_NOLOAD") that introduces this, > >> apparently no loading means ignoring load and entry address? > >> > >> I presume missing load and entry is something older U-Boot versions > >> were unhappy about? Please let me know if the semantics are as I understood, > >> so I can prepare a barebox patch supporting it. > > > > Oh, see my previous email. > > Thanks. > > > > >> > >>> + fsw.property_string('arch', args.arch) > >>> + fsw.property_string('os', args.os) > >>> + fsw.property_string('compression', args.compress) > >>> + fsw.property('data', data) > >>> + fsw.property_u32('load', 0) > >>> + fsw.property_u32('entry', 0) > >>> + > >>> + > >>> +def finish_fit(fsw, entries): > >>> + """Finish the FIT ready for use > >>> + > >>> + Writes the /configurations node and subnodes > >>> + > >>> + Args: > >>> + fsw (libfdt.FdtSw): Object to use for writing > >>> + entries (list of tuple): List of configurations: > >>> + str: Description of model > >>> + str: Compatible stringlist > >>> + """ > >>> + fsw.end_node() > >>> + seq = 0 > >>> + with fsw.add_node('configurations'): > >>> + for model, compat in entries: > >>> + seq += 1 > >>> + with fsw.add_node(f'conf-{seq}'): > >>> + fsw.property('compatible', bytes(compat)) > >> > >> The specification says that this is the root U-Boot compatible, > >> which I presume to mean the top-level compatible, which makes sense to me. > >> > >> The code here though adds all compatible strings from the device tree though, > >> is this intended? > > > > Yes, since it saves needing to read in each DT just to get the > > compatible stringlist. > > The spec reads as if only one string (root) is supposed to be in the list. > The script adds all compatibles though. This is not really useful as a bootloader > that's compatible with e.g. fsl,imx8mm would just take the first device tree > with that SoC, which is most likely to be wrong. It would be better to just > specify the top-level compatible, so the bootloader fails instead of taking > the first DT it finds. We do need to have a list, since we have to support different board revs, etc. > > >>> + fsw.property_string('description', model) > >>> + fsw.property_string('type', 'flat_dt') > >>> + fsw.property_string('arch', arch) > >>> + fsw.property_string('compression', compress) > >>> + fsw.property('compatible', bytes(compat)) > >> > >> I think I've never seen a compatible for a fdt node before. > >> What use does this serve? > > > > It indicates the machine that the DT is for. > > Who makes use of this information? U-Boot uses it, I believe. There is an optimisation to use this instead of reading the DT itself. Regards, Simon