Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp222356rdb; Tue, 5 Dec 2023 03:49:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGwAdl3SSrPGmhIM7MDkT9XrDDOLd7Kw7gYTQnyMbD6vWtJovV6Ow0mYUQjxUAXIbpsySs+ X-Received: by 2002:a05:6a20:8fa3:b0:18f:97c:825b with SMTP id k35-20020a056a208fa300b0018f097c825bmr2410759pzj.101.1701776995171; Tue, 05 Dec 2023 03:49:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701776995; cv=none; d=google.com; s=arc-20160816; b=hjxKbPYDPWila6YgLmm7Ijw6SUzKmmtmmrdEcnpx/4ccigFT6PV/T5e5D+e+IClse8 14V+lXOIQMXVqGVbcLYPkiNQq5k7HfTEXXsswhwQO5Zg4BbCKD3kzKYiw9eJDRSBuAHO QYw/swohpSSUP9GM5U1XtD/u6EAdohEKPa/gPn7ElfeTqk0Hvci84KWOibm0ZhMC7lTO mKts34EBB5EFaTCxRGd50R5UXziZWgM0rjicBIGZXjMQWAJim96ezF2f4sKXhsEYUJEK b15tcxs7vQf6SsDttubNp4682XB9w9o0ahawPzTa4PFJGIhbN/Zr+5dptO03IhfhxeGw GPjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=XGk2U+VtNFyhT1gTTqGiRz5OpnoLlmsHibRaZKIvSz0=; fh=Wx6Ro6CX4YHMot0upqU7lnJFpS9f/+DM+ugynzkokDY=; b=P/1NP3n47c250rt8pMadlyf+aC+rOYuZrnhSyW3MsQWfbT190LuAwNH/ATQyFJjcQ9 +9DZ3cy2tkFOjm4Miu87CCU/O1m1gALChhAnG+HUtldtuJRKWsb32hsJ6P+buzX3a0yo GkeiN1YdTJ7lexTWFjV8XJaG/iBOL50uyRylXlabGJA+xHpC9aI+kHs3DotU0lVN/V4W liGedwoB6qfOmcI0aNavgvQ3nwjFXwxVZODB9Cgcr9p83bVbNQfRc9Zvg9UKcQPmPDsE eCXhAnuC1goOTD+nDpEiRNCbjBQnYR+jfDJ6TDnKb6XF5K0EdD55W61ZkEhnwRWR/1Rr jT9g== 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:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id l16-20020a170903245000b001d044978d7esi3534901pls.598.2023.12.05.03.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 03:49:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 47BE18052BDA; Tue, 5 Dec 2023 03:49:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442241AbjLELtR (ORCPT + 99 others); Tue, 5 Dec 2023 06:49:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442177AbjLELtH (ORCPT ); Tue, 5 Dec 2023 06:49:07 -0500 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB9D2CA for ; Tue, 5 Dec 2023 03:49:13 -0800 (PST) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rATuo-0007xC-VH; Tue, 05 Dec 2023 12:48:39 +0100 Message-ID: <92a3e3b4-6f4d-4ca4-947f-db905f328d4c@pengutronix.de> Date: Tue, 5 Dec 2023 12:48:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 2/2] arm64: boot: Support Flat Image Tree Content-Language: en-US To: Simon Glass , linux-arm-kernel@lists.infradead.org Cc: Masahiro Yamada , 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, Pengutronix Kernel Team References: <20231202035511.487946-1-sjg@chromium.org> <20231202035511.487946-3-sjg@chromium.org> From: Ahmad Fatoum In-Reply-To: <20231202035511.487946-3-sjg@chromium.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD,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 groat.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 (groat.vger.email [0.0.0.0]); Tue, 05 Dec 2023 03:49:52 -0800 (PST) Hello Simon, On 02.12.23 04:54, 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. > > Signed-off-by: Simon Glass kernel_noload support is now in barebox next branch and I tested this series against it: Tested-by: Ahmad Fatoum # barebox > +"""Build a FIT containing a lot of devicetree files > + > +Usage: > + make_fit.py -A arm64 -n 'Linux-6.6' -O linux > + -f arch/arm64/boot/image.fit -k /tmp/kern/arch/arm64/boot/image.itk > + /tmp/kern/arch/arm64/boot/dts/ -E -c gzip > + > +Creates a FIT containing the supplied kernel and a directory containing the > +devicetree files. > + > +Use -E to generate an external FIT (where the data is placed after the > +FIT data structure). This allows parsing of the data without loading > +the entire FIT. > + > +Use -c to compress the data, using bzip2, gzip, lz4, lzma, lzo and > +zstd algorithms. > + > +The resulting FIT can be booted by bootloaders which support FIT, such > +as U-Boot, Linuxboot, Tianocore, etc. Feel free to add barebox to the list. Did you check whether Linuxboot and Tianocore support kernel_noload? > + fsw.property_u32('load', 0) > + fsw.property_u32('entry', 0) I still think load and entry dummy values are confusing and should be dropped. > + with fsw.add_node(f'fdt-{seq}'): > + # Get the compatible / model information > + with open(fname, 'rb') as inf: > + data = inf.read() > + fdt = libfdt.FdtRo(data) > + model = fdt.getprop(0, 'model').as_str() > + compat = fdt.getprop(0, 'compatible') > + > + 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)) > + > + with open(fname, 'rb') as inf: > + compressed = compress_data(inf, compress) > + fsw.property('data', compressed) > + return model, compat After Doug's elaboration, extracting multiple compatibles is fine by me. Cheers, Ahmad -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |