Re: [PATCH v2 10/10] fdtfactor: Add compiled FIT image factoring support

From: Simon Glass

Date: Fri Oct 30 2026 - 08:53:31 EST


On 2026-10-28T21:46:49, Douglas Anderson <dianders@xxxxxxxxxxxx> wrote:
> fdtfactor: Add compiled FIT image factoring support
>
> Bootloaders such as depthcharge on Chromebooks and U-Boot use Flattened
> Image Tree (FIT) images to bundle a kernel image with multiple board FDT
> blobs (`fdt-1`, `fdt-2`, ...) and per-board configuration nodes.
>
> Add `-F`/`--fit`, `--outfile`, and `--single-base-dtb` options to
> `fdtfactor` to factor a compiled FIT image directly:
>
> - Parse non-overlay `type = "flat_dt"` nodes under `/images`,
> decompressing their `data` blobs according to their `compression`
> property (`none`, `lz4`, `lzma`, `xz`, `gzip`).
> - Reject FIT images containing `signature*` subnodes under `/images/*`
> or `/configurations/*`, as modifying FDT blobs and configurations
> would invalidate cryptographic signatures.
> - Partition the `flat_dt` blobs into compatible factor groups (by
> compression, architecture, FDT header fields, and node-path overlap)
> so a single FIT image containing multiple board/SoC families produces
> a separate `fdt-base-1`, `fdt-base-2`, etc. for each family.
> - Support `--single-base-dtb` to force all `flat_dt` blobs into a single
> base DTB regardless of node-path overlap, failing only if their FDT
> headers, architecture, or compression differ.
> - Insert each `fdt-base-N` node into `/images`, replace each factored
> `fdt-*` node's `data` with its compressed `.dtbo` overlay, recompute
> any `hash*` subnode digests, and prepend `fdt-base-N` to each matching
> configuration's `fdt` string list while preserving all other
> configuration properties (`description`, `compatible`, etc.,
> populating `compatible` from the board DTB's root node when omitted)
> and any pre-existing overlay entries.
>
> Add uncompressed, LZ4-compressed multi-family, signed-FIT rejection, and
> `--single-base-dtb` FIT image test cases to the `fdtfactor` test suite.
>
> Assisted-by: Gemini:gemini-pro-prerelease
> Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
>
> README.md | 17 ++
> fdtfactor | 588 ++++++++++++++++++++++++++++++++++++++++++---
> tests/Makefile.tests | 2 +-
> tests/fdtfactor_lz4.its | 109 +++++++++
> tests/fdtfactor_other1.dts | 33 +++
> tests/fdtfactor_other2.dts | 33 +++
> tests/fdtfactor_test.its | 109 +++++++++
> tests/run_tests.sh | 158 +++++++++++-
> 8 files changed, 1018 insertions(+), 31 deletions(-)

Reviewed-by: Simon Glass <sjg@xxxxxxxxxxxx>

BTW, 'FIT image' actually means an image in a FIT, so I think you
should try to call the whole thing a 'FIT' instead.