Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp892548rdb; Tue, 30 Jan 2024 01:31:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlkzTqMTU+sq5OsxmzLxvkZbZKJb338Snz2CfPO3NnRS/m3QdcYXZiuLqmliYUYC6MOsVI X-Received: by 2002:a05:6a00:26d3:b0:6db:ea8b:52a2 with SMTP id p19-20020a056a0026d300b006dbea8b52a2mr3759520pfw.30.1706607091293; Tue, 30 Jan 2024 01:31:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706607091; cv=pass; d=google.com; s=arc-20160816; b=oogtbopo9OZmXs0I7eSaMvcZoY4zh79QYH/LJxFag6imyXx/hpMalKmKdS/hme5azv AYUEfca4cPT/8IDBErAuWaTfV6lNv0Y1fu6GS5zi1fI7UYT3HCvrQB1Vk0xgU7r5In7Q N7f4YFEYrgSXEnUC/aoInD1WVqf9D+GPJ+KNfhQRfs1WJVDmk+AgcXaVFM72A9EcBne9 B3IgnWZOPJOq5ZN8LrE4hK7qZUlgpQrz7052ZRQZcPn1hEq6sx109vLHkNSqWVUyhnrz YIGlHi7eqKa3BdnZeVqy08brzLHbiLFgvxE6A+Qc7ydIWJ6TCfHsJapo2A5swDHKfFOQ MXug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=/g9kUCUWP3rAstQmb3k/E/8b5dVY+cPvNEuWAep7g6Y=; fh=s12VEd2Kzf1Sc14H/gwGTKCcw1xbzIbuG8HiQIP76kY=; b=TTFVwmdW5E31Px0wRr1d+OImoAvZxQjhari1WB4CLRE5XStk4aBDrqxgCqvJj2vbfv GE3CRXMm4qK5HxczofKRmfcPN07OA8ZsFLvBA/yTnK2Ad1nkDla4nxwNGA4YbnLMTeFg LEsC3V6sAcZt79uOkO+FaW5VS62AwWvHXUrNNWKG/UNywmFyrWtKXDiS/gikqOdQ2w0B Hg25VomtUypeJG8+7wXGfOdqvpWKCx94Wx0mEKhYLH/89RABKknhzi00dHiqp0UM36t6 N8i4EXzAmEgY8DgwGWZ+2c3ZIHhmuvo76bbmottIxx++iGBg2yFsxfnHbbK3mwqzkl6y 6pRw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LI6damsW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44233-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h2-20020aa79f42000000b006da83a2ceadsi7085083pfr.328.2024.01.30.01.31.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 01:31:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44233-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LI6damsW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44233-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2A156294B53 for ; Tue, 30 Jan 2024 09:18:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 342F8657DD; Tue, 30 Jan 2024 09:16:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LI6damsW" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E34915F849; Tue, 30 Jan 2024 09:16:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706606214; cv=none; b=XvbbbBv4BdN96/6qNjjvBLQnacO7PJrWZfhkwJ15QCMoS3YC8pnX4RH7SWYvqI77i3v+2n+PmX61Vncnn89qiuJY/gyJV8O0uijEXNQDXM3ZLcpsl6vxL5YWQXqtdzrwlN1st22V+aX9K0WZKM57YwSE0z2XuTX21yhvd6ivqeA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706606214; c=relaxed/simple; bh=tTAS6UztStpo0SYXx14eTSJP+yk4zMdR6h+ep2k7+s4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=a6Ij615pRaliq8G9j4eYMggyg+tJ4g4nwtkHMHnHomHeyq0fFIK8HnjL8dWRdTv9r6rjrwUzu7CQMsQHtKGc4TYIJC0rQlxHpkdvk/XopndELc1/xvDaqdnnVSHkQVwxQGH/huqO+UqQ4zPwQLnhNsNfeQ9YjLokPogi9qpB75I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LI6damsW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FF54C433F1; Tue, 30 Jan 2024 09:16:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706606213; bh=tTAS6UztStpo0SYXx14eTSJP+yk4zMdR6h+ep2k7+s4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LI6damsWx45gi0EMf45wHMGUnuXtIwsTNZogYgpI5h5B+rgxfpc9gOdVtrqGbUGIa +UJujQrtAIFMXyzaUjuM7PEaxxWUP74kPpmpKFg8eOblA6UPD2Qxxj3yNhQBPFgJ3k MbNuoA8jnneE4CH3xGTInz1nauTv8RJPLKlT5zdGGHxDfg6IaugG4MhiDtWg3QT4KK /ZXHpgr2oaaQR6EZsIFKSr5FraPB+3mSJ24KuNOGt3q6NF4QEfzDSQpOZtwEAyiCWq KgB6ZslNcjIPKDZK/dxqlRF8woq2Z5ITZ93fjHEGquF2SV0m9hq476FEnmeITe8JZ7 izDIdpR4+sdDw== Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-210ce33ea1aso1917683fac.0; Tue, 30 Jan 2024 01:16:53 -0800 (PST) X-Gm-Message-State: AOJu0Yww8nKGiBtIzUIVR9O2YbCT0ZoP9wDTRjuamPzZyktJW8ftps2T cGn2fuSjeLZDNtEC+f2smapa0sNMaai2MbjBOTiEeg5lqWoLgaST/p/9WOLUaO2ChfO32BwawwA RVWcxXNSYrexTNZtk+h84hlSKRjc= X-Received: by 2002:a05:6870:b684:b0:214:ff12:3dda with SMTP id cy4-20020a056870b68400b00214ff123ddamr7405022oab.2.1706606212712; Tue, 30 Jan 2024 01:16:52 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231202035511.487946-1-sjg@chromium.org> <20231202035511.487946-3-sjg@chromium.org> <20231213121353.GA31326@willie-the-truck> <20240109143349.GR1610741@bill-the-cat> In-Reply-To: From: Masahiro Yamada Date: Tue, 30 Jan 2024 18:16:16 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 2/2] arm64: boot: Support Flat Image Tree To: Simon Glass Cc: Tom Rini , Will Deacon , linux-arm-kernel@lists.infradead.org, Ahmad Fatoum , U-Boot Mailing List , Nicolas Schier , Catalin Marinas , Jonathan Corbet , Nathan Chancellor , Nick Terrell , linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, workflows@vger.kernel.org, Rob Herring Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 26, 2024 at 1:04=E2=80=AFAM Simon Glass wrot= e: > > Hi, > > On Wed, 17 Jan 2024 at 06:14, Simon Glass wrote: > > > > Hi Masahiro, Tom, > > > > On Tue, 9 Jan 2024 at 07:33, Tom Rini wrote: > > > > > > On Tue, Jan 09, 2024 at 11:01:42PM +0900, Masahiro Yamada wrote: > > > > Hi Simon, > > > > > > > > > > > > On Wed, Jan 3, 2024 at 8:47=E2=80=AFAM Simon Glass wrote: > > > > > > > > > > Hi Masahiro, > > > > > > > > > > On Wed, Dec 13, 2023 at 5:14=E2=80=AFAM Will Deacon wrote: > > > > > > > > > > > > On Fri, Dec 01, 2023 at 08:54:42PM -0700, Simon Glass wrote: > > > > > > > Add a script which produces a Flat Image Tree (FIT), a single= file > > > > > > > containing the built kernel and associated devicetree files. > > > > > > > Compression defaults to gzip which gives a good balance of si= ze and > > > > > > > performance. > > > > > > > > > > > > > > The files compress from about 86MB to 24MB using this approac= h. > > > > > > > > > > > > > > The FIT can be used by bootloaders which support it, such as = U-Boot > > > > > > > and Linuxboot. It permits automatic selection of the correct > > > > > > > devicetree, matching the compatible string of the running boa= rd with > > > > > > > the closest compatible string in the FIT. There is no need fo= r > > > > > > > filenames or other workarounds. > > > > > > > > > > > > > > Add a 'make image.fit' build target for arm64, as well. Use > > > > > > > FIT_COMPRESSION to select a different algorithm. > > > > > > > > > > > > > > The FIT can be examined using 'dumpimage -l'. > > > > > > > > > > > > > > This features requires pylibfdt (use 'pip install libfdt'). I= t also > > > > > > > requires compression utilities for the algorithm being used. = Supported > > > > > > > compression options are the same as the Image.xxx files. For = now there > > > > > > > is no way to change the compression other than by editing the= rule for > > > > > > > $(obj)/image.fit > > > > > > > > > > > > > > While FIT supports a ramdisk / initrd, no attempt is made to = support > > > > > > > this here, since it must be built separately from the Linux b= uild. > > > > > > > > > > > > > > Signed-off-by: Simon Glass > > > > > > > --- > > > > > > > > > > > > > > Changes in v9: > > > > > > > - Move the compression control into Makefile.lib > > > > > > > > > > > > > > Changes in v8: > > > > > > > - Drop compatible string in FDT node > > > > > > > - Correct sorting of MAINTAINERS to before ARM64 PORT > > > > > > > - Turn compress part of the make_fit.py comment in to a sente= nce > > > > > > > - Add two blank lines before parse_args() and setup_fit() > > > > > > > - Use 'image.fit: dtbs' instead of BUILD_DTBS var > > > > > > > - Use '$( > > > > > > - Add 'mkimage' details Documentation/process/changes.rst > > > > > > > - Allow changing the compression used > > > > > > > - Tweak cover letter since there is only one clean-up patch > > > > > > > > > > > > > > Changes in v7: > > > > > > > - Add Image as a dependency of image.fit > > > > > > > - Drop kbuild tag > > > > > > > - Add dependency on dtbs > > > > > > > - Drop unnecessary path separator for dtbs > > > > > > > - Rebase to -next > > > > > > > > > > > > > > Changes in v5: > > > > > > > - Drop patch previously applied > > > > > > > - Correct compression rule which was broken in v4 > > > > > > > > > > > > > > Changes in v4: > > > > > > > - Use single quotes for UIMAGE_NAME > > > > > > > > > > > > > > Changes in v3: > > > > > > > - Drop temporary file image.itk > > > > > > > - Drop patch 'Use double quotes for image name' > > > > > > > - Drop double quotes in use of UIMAGE_NAME > > > > > > > - Drop unnecessary CONFIG_EFI_ZBOOT condition for help > > > > > > > - Avoid hard-coding "arm64" for the DT architecture > > > > > > > > > > > > > > Changes in v2: > > > > > > > - Drop patch previously applied > > > > > > > - Add .gitignore file > > > > > > > - Move fit rule to Makefile.lib using an intermediate file > > > > > > > - Drop dependency on CONFIG_EFI_ZBOOT > > > > > > > - Pick up .dtb files separately from the kernel > > > > > > > - Correct pylint too-many-args warning for write_kernel() > > > > > > > - Include the kernel image in the file count > > > > > > > - Add a pointer to the FIT spec and mention of its wide indus= try usage > > > > > > > - Mention the kernel version in the FIT description > > > > > > > > > > > > > > Documentation/process/changes.rst | 9 + > > > > > > > MAINTAINERS | 7 + > > > > > > > arch/arm64/Makefile | 7 +- > > > > > > > arch/arm64/boot/.gitignore | 1 + > > > > > > > arch/arm64/boot/Makefile | 6 +- > > > > > > > scripts/Makefile.lib | 16 ++ > > > > > > > scripts/make_fit.py | 291 ++++++++++++++++++++= ++++++++++ > > > > > > > 7 files changed, 334 insertions(+), 3 deletions(-) > > > > > > > create mode 100755 scripts/make_fit.py > > > > > > > > > > > > I'll need Masahiro's Ack on the scripts/ changes before I can t= ake this > > > > > > one. > > > > > > > > > > Any thoughts on this request, please? > > > > > > > > > > Regards, > > > > > Simon > > > > > > > > > > > > > > > > > > > > > As I mentioned before, I am concerned with having > > > > the same "compatible" entries, with different contents, > > > > as you use the "compatible" string as an ID to selecting > > > > the target config node, right? > > > > > > > > > > > > > > > > > > > > > > > > $ fdtdump arch/arm64/boot/image.fit > > > > > > > > ... > > > > > > > > conf-10 { > > > > compatible =3D "tq,am642-tqma6442l-mbax4xxl", > > > > "tq,am642-tqma6442l", "ti,am642"; > > > > description =3D "TQ-Systems TQMa64xxL SoM on MBax4xxL c= arrier board"; > > > > fdt =3D "fdt-10"; > > > > kernel =3D "kernel"; > > > > }; > > > > > > > > ... > > > > > > > > conf-25 { > > > > compatible =3D "tq,am642-tqma6442l-mbax4xxl", > > > > "tq,am642-tqma6442l", "ti,am642"; > > > > description =3D "TQ-Systems TQMa64xxL SoM on MBax4xxL c= arrier board"; > > > > fdt =3D "fdt-25"; > > > > kernel =3D "kernel"; > > > > }; > > > > > > I had asked Rob a while ago about if having the same compatible for t= wo > > > functionally different machines is a feature, or a bug, and I don't > > > think either of us fully agreed either way. I'd be leaning towards > > > saying the above example is a bug in the dts files, it's just not bee= n a > > > bug people have worried about before due to (sadly) how little the > > > top-level compatible has been used. > > > > Yes I believe this is a bug in the files. > > > > What should the script do in this case? Print a warning, perhaps? > > Is there anything I should do here? Would a warning be helpful, or > just confusing? I do not think it is useful. You would almost always get a warning, and there is no way to fix it. With arm64 defconfig, image.fit will include a thousand DTBs. The config node of my board was listed 214th. (I found it by fdtdump) Then, I learned > bootm ${loadaddr}#conf-214 is the correct command to boot my board. Of course, the "214" will be different in the future. The node names, conf-*, are useless. Only the useful way is to enable CONFIG_FIT_BEST_MATCH in U-Boot, but this relies on the uniqueness of a compatible string, which is not true. (I do not know how to do it in barebox) I think using the file name as a config node mitigates the issue because a file name is considered unique. For example, with composite DTBs: imx8mm-venice-gw72xx-0x-imx219-dtbs :=3D imx8mm-venice-gw72xx-0x.dtb imx8mm-venice-gw72xx-0x-imx219.dtbo imx8mm-venice-gw72xx-0x-rpidsi-dtbs :=3D imx8mm-venice-gw72xx-0x.dtb imx8mm-venice-gw72xx-0x-rpidsi.dtbo configurations { imx8mm-venice-gw72xx-0x-imx219 { ... }; imx8mm-venice-gw72xx-0x-rpidsi { ... } }; Then, we can distinguish them by node, even if they have the same compatible string. At least we can do > bootm ${loadaddr}#imx8mm-venice-gw72xx-0x-imx219 For the issue including stale DTBs, you can use my patch: [PATCH 1/4] kbuild: create a list of all built DTB files (https://lore.kernel.org/linux-kbuild/CAK7LNASOxi-gzve+_d-sCW9z_eEJ5TMMnzPE= vN2Nj2AwgVjF9g@mail.gmail.com/T/#ma3595627a96a04554a78cbbd22056831e13db260) You can change scripts/make_fit.py to take the DTB files instead of the directory to search. Optionally, you can support '@' syntax to take command arguments from a file. scripts/make_fit.py ... @arch/$(SRCARCH)/boot/dts/dtbs-list For the separate base and overlays support, you can use my patch as a base: [PATCH 3/4] kbuild: create a list of base and overlays for each DTB (https://lore.kernel.org/linux-kbuild/CAK7LNASOxi-gzve+_d-sCW9z_eEJ5TMMnzPE= vN2Nj2AwgVjF9g@mail.gmail.com/T/#m32c5bdde9098901b7c7776b932827493a05c82d5) Lastly, you do not need to require mkimage for args.external. You can simply concatenate files. -- Best Regards Masahiro Yamada