Re: [PATCH 3/4] fdtfactor: Support compressed DTB inputs and outputs

From: David Gibson

Date: Mon Oct 26 2026 - 00:53:09 EST


On Thu, Oct 15, 2026 at 11:21:36AM -0700, Douglas Anderson wrote:
> Firmware and FIT image build pipelines frequently store device tree
> blobs compressed with LZ4, LZMA/XZ, or gzip (e.g., `.dtb.lz4`).
>
> Extend `fdtfactor` to detect compressed input blobs by magic bytes or
> file extension, transparently decompress them before factoring, and
> compress the resulting `.dtbo` and `base.dtb` outputs when appropriate:
>
> - Support `.lz4` (via the `lz4` CLI), `.lzma`/`.xz` (via Python's
> `lzma` module), and `.gz` (via Python's `gzip` module).
> - Preserve the input compression format on generated `.dtbo` files and
> compress `base.dtb` when its output path carries a compression suffix
> (e.g., `-b base.dtb.lz4`).
> - Report compressed size savings alongside uncompressed savings when
> `-v`/`--verbose` is specified.
>
> On the 47 Qualcomm SC7180 Trogdor Chromebook `.dtb.lz4` files,
> `fdtfactor -S` reduces total LZ4-compressed size from 1.71 MB to 213 KB
> (87.5% savings).

I'm not going to review patches 3 & 4 at this time. Patch 2 will need
a bunch of rework before it's ready, which will necessarily require
substantial changes to the following patches as well. So, I'll defer
considering these until (at least) the next spin.

--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature