Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5825465rdb; Wed, 13 Dec 2023 23:58:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYbmmOC4uZyb3j0KQ3YcdSNUnFs+JMAHWZ6ozm5MWKjgEkVGHPaHPnfhpes6PooKfV6OCc X-Received: by 2002:a05:6870:e30a:b0:1fb:75b:1322 with SMTP id z10-20020a056870e30a00b001fb075b1322mr11276061oad.116.1702540693700; Wed, 13 Dec 2023 23:58:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702540693; cv=none; d=google.com; s=arc-20160816; b=U4z+1zKU2eXoaFwLbMpcgquPBfkzmVUP3k2b9aextHuk868b9A2FUizjxGh3OfkYlK z7jzN7zpMBqhmf4ndSO+zRvuF5d0KVOYgdf79XR/odKacuKDdpIc4Q9PoXjgsB2I5hEw TJTbDR/hiPmAdAjR6kSM2SGT9SJXb/9EWJ+2qawtEfrUEE47VN783GVUJj4ScluOGeU5 7PJW9AhmrD4AA6G5XwRTIXZoCN9/HFADotd46Qxuu4o7o6sVylxf3nUICOvjXNsF7cOK po39Hp3cZlko3HOSwcjtOQ1FSp/8PvOJf6EDgvbyi21gwS5GioS1Bgcd+BvUag+h0aPy HoOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=yG1jP2eaB8AOg7G02/RRoFjkGD71tAvRW8PHG6aplsw=; fh=UABZsWfa9NvADst1491MwrQ9RawvsGyYjaKpsIPSY8c=; b=AoUKZIAqgL1S0GK0i4n2eWQHEsuSGd5hIny6GjykbxldWUU70FnoLU2ba0wo71E8fv cpa5+aoGBRZOHFGlYceS32fZsNU12ruI4mv9i44uveLpqLL797W/7j/perlCA/fk3t1V ZkJVdbKEluq4qRARKTazup96HMqjZPAdP6zhD3RJNklj+JznSV2P79drLyDW/5qoo9Fq 9KCdM2+Ajb4ve2NkX9iNHMbkVJv6Vq8vT9QUMKf2in6snW3RVBbcJZf2m4eLPFf4mFnO eKTOEFGH5rjxWXsU+j8nHz18kWuCzqYnfFuxm2dutVVCysdrnpMXi8WbDHXw1rBPFQRD IQxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e6-20020a654786000000b005c660ba30a7si10578944pgs.512.2023.12.13.23.58.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 23:58:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C901080CF54E; Wed, 13 Dec 2023 23:58:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234409AbjLNH6C convert rfc822-to-8bit (ORCPT + 99 others); Thu, 14 Dec 2023 02:58:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234342AbjLNH6A (ORCPT ); Thu, 14 Dec 2023 02:58:00 -0500 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91497E0; Wed, 13 Dec 2023 23:58:05 -0800 (PST) Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-dbcdfad714aso707894276.3; Wed, 13 Dec 2023 23:58:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702540684; x=1703145484; h=content-transfer-encoding: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=sj0NwqxPiof3ml42MbQY4Ahv5ohZXpex6OnUgaYQww8=; b=WJi/ohrGdnui+xHmqlYZ0jR7MAZ6XBk6cPmXjaN4qj3dMTl9zN1HGq66RyYnl9rlb5 xq9TnDWuGyXDdTBzZESIBk4TnVYlRkpYx9xpN6T6wDYc4nT+WlSqycTpXnRIUtaqEyrg DFZd7y+IU1d2ZuoSoRIaokqyiW3XC1rDa0GTYbkdGtJXqFoyJHPBKhmwOq7iKRTvyXkA albWcAXmUqS7f77l+rLLSbXK/QI5nkzT1lQgGSYuWzOyHrmNE1yhnkKmgG5PObsyUrKi bTnM516NcVUyTUSv5wG97bXVLEZeKTc36643sDpnjdyLKU9fIkAGnYjv9E2yiH4X7UMe g22A== X-Gm-Message-State: AOJu0YyGDDPBtyBQYfDNW9LfOF63NF02Cx9OCPP89r8dq5k+OuW75WOI 4iUxAZ+2MymYyEDLo1TKc5EvynVAw2WHcA== X-Received: by 2002:a25:f45:0:b0:dbc:e89d:659d with SMTP id 66-20020a250f45000000b00dbce89d659dmr75478ybp.50.1702540684524; Wed, 13 Dec 2023 23:58:04 -0800 (PST) Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com. [209.85.219.177]) by smtp.gmail.com with ESMTPSA id v139-20020a252f91000000b00dbccadd6dd8sm1265708ybv.59.2023.12.13.23.58.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Dec 2023 23:58:04 -0800 (PST) Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-dbcdec51ed9so779788276.0; Wed, 13 Dec 2023 23:58:04 -0800 (PST) X-Received: by 2002:a5b:7cf:0:b0:da0:442f:988e with SMTP id t15-20020a5b07cf000000b00da0442f988emr5673057ybq.19.1702540684087; Wed, 13 Dec 2023 23:58:04 -0800 (PST) MIME-Version: 1.0 References: <20231202035511.487946-1-sjg@chromium.org> <20231202035511.487946-3-sjg@chromium.org> <20231203153401.GV8402@pendragon.ideasonboard.com> <20231207142723.GA3187877@google.com> <20231207143814.GD15521@pendragon.ideasonboard.com> <20231209152946.GC13421@pendragon.ideasonboard.com> In-Reply-To: From: Geert Uytterhoeven Date: Thu, 14 Dec 2023 08:57:52 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 2/2] arm64: boot: Support Flat Image Tree To: Masahiro Yamada Cc: Chen-Yu Tsai , Laurent Pinchart , Simon Glass , linux-arm-kernel@lists.infradead.org, Ahmad Fatoum , U-Boot Mailing List , Nicolas Schier , Tom Rini , Catalin Marinas , Jonathan Corbet , Nathan Chancellor , Nick Terrell , Will Deacon , linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, workflows@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 23:58:12 -0800 (PST) Hi Yamada-san, On Thu, Dec 14, 2023 at 7:12 AM Masahiro Yamada wrote: > On Thu, Dec 14, 2023 at 1:03 PM Chen-Yu Tsai wrote: > > On Sun, Dec 10, 2023 at 1:31 AM Geert Uytterhoeven wrote: > > > On Sat, Dec 9, 2023 at 4:29 PM Laurent Pinchart > > > wrote: > > > > On Sat, Dec 09, 2023 at 10:13:59PM +0900, Chen-Yu Tsai wrote: > > > > > On Thu, Dec 7, 2023 at 11:38 PM Laurent Pinchart > > > > > wrote: > > > > > > On Thu, Dec 07, 2023 at 10:27:23PM +0800, Chen-Yu Tsai wrote: > > > > > > > On Sun, Dec 03, 2023 at 05:34:01PM +0200, Laurent Pinchart 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 size and > > > > > > > > > performance. > > > > > > > > > > > > > > > > > > The files compress from about 86MB to 24MB using this approach. > > > > > > > > > > > > > > > > > > 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 board with > > > > > > > > > the closest compatible string in the FIT. There is no need for > > > > > > > > > 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'). It 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 build. > > > > > > > > > > > > > > > > FIT images are very useful, so I think this is a very welcome addition > > > > > > > > to the kernel build system. It can get tricky though: given the > > > > > > > > versatile nature of FIT images, there can't be any > > > > > > > > one-size-fits-them-all solution to build them, and striking the right > > > > > > > > balance between what makes sense for the kernel and the features that > > > > > > > > users may request will probably lead to bikeshedding. As we all love > > > > > > > > bikeshedding, I thought I would start selfishly, with a personal use > > > > > > > > case :-) This isn't a yak-shaving request though, I don't see any reason > > > > > > > > to delay merging this series. > > > > > > > > > > > > > > > > Have you envisioned building FIT images with a subset of DTBs, or adding > > > > > > > > DTBOs ? Both would be fairly trivial extensions to this script by > > > > > > > > extending the supported command line arguments. It would perhaps be more > > > > > > > > difficult to integrate in the kernel build system though. This leads me > > > > > > > > to a second question: would you consider merging extensions to this > > > > > > > > script if they are not used by the kernel build system, but meant for > > > > > > > > users who manually invoke the script ? More generally, is the script > > > > > > > > > > > > > > We'd also be interested in some customization, though in a different way. > > > > > > > We imagine having a rule file that says X compatible string should map > > > > > > > to A base DTB, plus B and C DTBO for the configuration section. The base > > > > > > > DTB would carry all common elements of some device, while the DTBOs > > > > > > > carry all the possible second source components, like different display > > > > > > > panels or MIPI cameras for instance. This could drastically reduce the > > > > > > > size of FIT images in ChromeOS by deduplicating all the common stuff. > > > > > > > > > > > > Do you envision the "mapping" compatible string mapping to a config > > > > > > section in the FIT image, that would bundle the base DTB and the DTBOs ? > > > > > > > > > > That's exactly the idea. The mapping compatible string could be untied > > > > > from the base board's compatible string if needed (which we probably do). > > > > > > > > > > So something like: > > > > > > > > > > config { > > > > > config-1 { > > > > > compatible = "google,krane-sku0"; > > > > > fdt = "krane-baseboard", "krane-sku0-overlay"; > > > > > }; > > > > > }; > > > > > > > > > > With "krane-sku0-overlay" being an overlay that holds the differences > > > > > between the SKUs, in this case the display panel and MIPI camera (not > > > > > upstreamed) that applies to SKU0 in particular. > > > > > > > > The kernel DT makefiles already contain information on what overlays to > > > > apply to what base boards, in order to test the overlays and produce > > > > "full" DTBs. Maybe that information could be leveraged to create the > > > > configurations in the FIT image ? > > > > > > Although the "full" DTBs created may only be a subset of all possible > > > combinations (I believe Rob just started with creating one "full" DTB > > > for each overlay, cfr. the additions I made in commit a09c3e105a208580 > > > ("arm64: dts: renesas: Apply overlays to base dtbs")), that could > > > definitely be a start. > > > > > > Now, since the kernel build system already creates "full" DTBs, does > > > that mean that all of the base DTBs, overlays, and "full" DTBs will > > > end up in the FIT image? > > > > I suppose we could add an option to the packing tool to be able to _not_ > > add the "full" DTBs if they can also be assembled with a base DTB and > > overlays. Think of it as a firmware compatibility option: if the firmware > > supports overlays, then you almost always want the deconstructed parts, > > not the fully assembled ones. Vice versa. > > > > If we don't we could end up with two configurations that have the same > > compatible string? > > Right. > > We would end up with such situations because applying > an overlay does not change the compatible string. That is correct. Which is one of the reasons for not using overlays for this, cfr. the details in my reply in the other thread "Re: Proposal: FIT support for extension boards / overlays" https://lore.kernel.org/all/CAMuHMdXQdMeXUOAAw5nDO4+q5_HFvUc86Wi8ykMwjUwPex6wvQ@mail.gmail.com/ Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds