Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp728161rdb; Tue, 5 Dec 2023 19:55:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGx7LTJo51Em1HlZfAZuHuPYQLY01niWeEOToHmto+QWWKZKM2CxWQnIQ/oZeaCKTudPUia X-Received: by 2002:a05:6359:5e2f:b0:170:17eb:9c51 with SMTP id pw47-20020a0563595e2f00b0017017eb9c51mr286393rwb.50.1701834922166; Tue, 05 Dec 2023 19:55:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701834922; cv=none; d=google.com; s=arc-20160816; b=fnvVTz7gApJepvN1y7qpZ0Teg6KTvKQOQw83DDyxkSvvbHdR/R8wE44ztXHrVFuWZr 21n5fhtVh70zA/uciLYiN58zJ07MlYVrjWZAYrxlnAPY9VMqRuSFBZilkSFVLj7GGTHo KGsi6u7moWqb9iAceodQOmG72zR6U9E7QOKDDKWVwPEN2QaUkSLi300tKdHEvQezjzEB M5rV4nu8IA3GTwi09WPKN3mS7K77DNLj8tMcdx+I+oSe/uL7hSU3VO7WZFvE4jWeE5il NYwH35GFmcKmko6tOq9W/ruAy5l+kYXj9aTedCSmW5SlA8ZV52IUKqLNk8s/jXWkTADJ 2h6Q== 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=BsR8qY+uS6/BsLD1U3jPPzDAagYHPNv5M9ReQzqjMkA=; fh=1kJdg0B4MMEw+DfYC5QlGUOcXlXDEA3mwCxFHGrC164=; b=jhr/DU5gbHsZY40EFPnpc/WZPnfb4r+hCwTsaHomShqg+XfIZ3uC1I6DgqRYC02cFV 0v+PwMBrYWI2QvZLPwR03DQ9l5A6IpZrfge79kmMpNcVZUjDAXBwc1pFD3bFtf7yuSnp BsNssFNsp2LqOPSD/WJGufdqXhS17dheG5Fbr5bJLjZKVQ4nawlJ3RtUcrdiftyW81tC dIIYhQ21h9rh49oFuyoxZ1sWiS9pg99QCzrsXaLdK0OxH0a05Ny8C/0RwS0kQujz9eUn Ikko4GIPZvimRXiCy9166Gn7cJMprFYu8CzQJAX3qLVqqycvsAn8cvS2Id2Iwe0HthwD f9Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="UXm8uYZ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id t5-20020a17090a448500b00286bd949d17si3900257pjg.81.2023.12.05.19.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 19:55:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="UXm8uYZ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 5BBE58030A6E; Tue, 5 Dec 2023 19:55:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbjLFDy5 (ORCPT + 99 others); Tue, 5 Dec 2023 22:54:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjLFDyz (ORCPT ); Tue, 5 Dec 2023 22:54:55 -0500 Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BED411BF for ; Tue, 5 Dec 2023 19:55:01 -0800 (PST) Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-5d7346442d4so40176587b3.2 for ; Tue, 05 Dec 2023 19:55:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701834900; x=1702439700; 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=BsR8qY+uS6/BsLD1U3jPPzDAagYHPNv5M9ReQzqjMkA=; b=UXm8uYZ/Xl/VBZ/flQFs+9dAjL8MxLfaV1SwXude+vyG7dViCJ20LbYT4CQUaXdQFr fetTd2xYcTrMmRoc2jpfsvdKFz+fBWlPhE4CEIuG1FJ7VLs5Iu3/o6sr2F61CeOPnDky 7TVjn+/jo9MjtLIgnTeHDtHwyNNDRS6XzCia8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701834900; x=1702439700; 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=BsR8qY+uS6/BsLD1U3jPPzDAagYHPNv5M9ReQzqjMkA=; b=p9me7O5YRBeEMWgSb/KbRgjqd4o+9hGpNzG5RkJHAkFgikUNVkD4hgpC8ymhEf/Mkl vpvSqYR/WiOPAudXcq8gZLUS0kdSGgXh91hoEyiDPbKtSaLtZy6QIWBnspNAkJNwANV7 BKT05ocWELxZnZD4JVU0Xf4mHdfiMfJkiBanV30eigf111pjxrG5zxw3KPxDWFxfXvpy ywkQ0ubMtXuKj2ut+Wy+BgLupoDFcvA+wDtAOReFIJySfPyBZnlAX4sEEXHHBvQx9WyC qdWX2brlbOfzCvnGQCpUKA/OA8o/9z2D2Ym0FmDEgrKfvs3j2i7WNRAGkpCmTgPwTlrP 0x/g== X-Gm-Message-State: AOJu0YxtPaG2tDLzZguiuy2Ta4JiCHAZyYGMT/mawh+N+LYHfjZ/AwmZ xFh6xbs/5kMtGmfUQylq2PlsfADzpIqirBbrGm8fMw== X-Received: by 2002:a81:6dce:0:b0:5d7:3104:5649 with SMTP id i197-20020a816dce000000b005d731045649mr174139ywc.3.1701834900083; Tue, 05 Dec 2023 19:55:00 -0800 (PST) MIME-Version: 1.0 References: <20231202035511.487946-1-sjg@chromium.org> <20231202035511.487946-3-sjg@chromium.org> <92a3e3b4-6f4d-4ca4-947f-db905f328d4c@pengutronix.de> In-Reply-To: <92a3e3b4-6f4d-4ca4-947f-db905f328d4c@pengutronix.de> From: Simon Glass Date: Tue, 5 Dec 2023 20:54:41 -0700 Message-ID: Subject: Re: [PATCH v9 2/2] arm64: boot: Support Flat Image Tree To: Ahmad Fatoum Cc: linux-arm-kernel@lists.infradead.org, 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 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,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 05 Dec 2023 19:55:19 -0800 (PST) Hi Ahmad, On Tue, 5 Dec 2023 at 04:48, Ahmad Fatoum wrote: > > 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 > OK great thank you. > > +"""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? Only what I was told by people in those projects. They may not even look at the load address, but I am not an expert on that. > > > + fsw.property_u32('load', 0) > > + fsw.property_u32('entry', 0) > > I still think load and entry dummy values are confusing and should be dropped. This is what the spec requires at present. But I agree we should change it. I will dig into that at some point to see what is needed. > > > + 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. OK good. Regards, Simon