Re: [PATCH v9 2/2] arm64: boot: Support Flat Image Tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 2, 2024 at 6:03 AM Rob Herring <robh@xxxxxxxxxx> wrote:
>
> On Wed, Jan 31, 2024 at 8:09 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> >
> > On Thu, Feb 1, 2024 at 7:03 AM Rob Herring <robh@xxxxxxxxxx> wrote:
> > >
> > > On Tue, Jan 30, 2024 at 3:16 AM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> > > >
> > > > On Fri, Jan 26, 2024 at 1:04 AM Simon Glass <sjg@xxxxxxxxxxxx> wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > On Wed, 17 Jan 2024 at 06:14, Simon Glass <sjg@xxxxxxxxxxxx> wrote:
> > > > > >
> > > > > > Hi Masahiro, Tom,
> > > > > >
> > > > > > On Tue, 9 Jan 2024 at 07:33, Tom Rini <trini@xxxxxxxxxxxx> wrote:
> > > > > > >
> > > > > > > On Tue, Jan 09, 2024 at 11:01:42PM +0900, Masahiro Yamada wrote:
> > > > > > > > Hi Simon,
> > > > > > > >
> > > > > > > >
> > > > > > > > On Wed, Jan 3, 2024 at 8:47 AM Simon Glass <sjg@xxxxxxxxxxxx> wrote:
> > > > > > > > >
> > > > > > > > > Hi Masahiro,
> > > > > > > > >
> > > > > > > > > On Wed, Dec 13, 2023 at 5:14 AM Will Deacon <will@xxxxxxxxxx> 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.
> > > > > > > > > > >
> > > > > > > > > > > Signed-off-by: Simon Glass <sjg@xxxxxxxxxxxx>
> > > > > > > > > > > ---
> > > > > > > > > > >
> > > > > > > > > > > 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 sentence
> > > > > > > > > > > - Add two blank lines before parse_args() and setup_fit()
> > > > > > > > > > > - Use 'image.fit: dtbs' instead of BUILD_DTBS var
> > > > > > > > > > > - Use '$(<D)/dts' instead of '$(dir $<)dts'
> > > > > > > > > > > - 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 industry 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 take 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 = "tq,am642-tqma6442l-mbax4xxl",
> > > > > > > > "tq,am642-tqma6442l", "ti,am642";
> > > > > > > >             description = "TQ-Systems TQMa64xxL SoM on MBax4xxL carrier board";
> > > > > > > >             fdt = "fdt-10";
> > > > > > > >             kernel = "kernel";
> > > > > > > >         };
> > > > > > > >
> > > > > > > >         ...
> > > > > > > >
> > > > > > > >         conf-25 {
> > > > > > > >             compatible = "tq,am642-tqma6442l-mbax4xxl",
> > > > > > > > "tq,am642-tqma6442l", "ti,am642";
> > > > > > > >             description = "TQ-Systems TQMa64xxL SoM on MBax4xxL carrier board";
> > > > > > > >             fdt = "fdt-25";
> > > > > > > >             kernel = "kernel";
> > > > > > > >         };
> > > > > > >
> > > > > > > I had asked Rob a while ago about if having the same compatible for two
> > > > > > > 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 been a
> > > > > > > bug people have worried about before due to (sadly) how little the
> > > > > > > top-level compatible has been used.
> > >
> > > I much prefer being able to use compatibles over filenames.
> > >
> > > > > >
> > > > > > 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.
> > >
> > > The above case is due to overlays. Why would you have a FIT image with
> > > both a base tree and applied overlays?
> >
> >
> >
> > Because they are different hardware.
>
> Meaning the base tree is valid on its own without any overlays?



If the base board is directly added to dtb-y, we need to assume
it is valid as a standalone board.


k3-am654-gp-evm-dtbs is a base of other composite DTBs, and
it is also added to dtb-y.


dtb-$(CONFIG_ARCH_K3) += k3-am654-base-board.dtb



Not only the base board.


There are multiple composite DTBs that have the same compatible string.


k3-am654-gp-evm-dtbs := k3-am654-base-board.dtb
k3-am654-base-board-rocktech-rk101-panel.dtbo
k3-am654-evm-dtbs := k3-am654-base-board.dtb k3-am654-icssg2.dtbo



k3-am654-base-board.dtb, k3-am654-gp-evm-dtbs, and k3-am654-evm-dtbs
have the same top-level compatible string.




>
> > If FIT includes only base DTBs, how to use a base with extensions?
>
> I would expect that you package up base and overlays or DTs with
> already applied overlays, but not both together. That would be based
> on whether your bootloader can apply overlays or not.


Correct.



> This problem boils down to your firmware knows or gains the knowledge
> of some set of extra features or h/w pop options. The result is you
> need base plus X, Y, Z whether those are a list of overlays or an
> encoding of filename or something else. For example, FIT entries could
> have a field that just lists those X, Y, Z features. But I'd much
> rather have something that works outside of FIT images.
>
> > > In any case, maybe we need to record in dtb overlays that have been
> > > applied (which you asked about recently on dtc list). Not sure what
> > > that looks like though. Overlays have a 'top-level' compatible that we
> > > add in either separately or merged with the base's top-level
> > > compatible?
> >
> >
> > If there is a way to make "compatible" unique, that will be good.
> >
> > But, in my understanding, we can replace a property value,
> > but not modify it.
>
> Currently yes, but that shouldn't be too hard to add. The dtc
> modification is the easy part. The hard part is figuring out the
> policy around how we would use that.
>
> But I don't really know what you want to accomplish with FIT here.
> IMO, if you need filenames, then use a filesystem. They work pretty
> well for storing large collections of files.


Whom does the term "you" point to?

If you have questions about the motivation for this patch,
ask its author.



There are two ways to look up the config node;
node-name or compatible string.

The key-value lookup works only when the key is unique.

Apparently, the compatible string is not unique
when overlay comes into play.







>
> Rob

--
Best Regards
Masahiro Yamada





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux