SPL knows about multiple compression algorithms, but only two are hand-rolled into the simple FIT loading code, in spite of a nice ready made helper already being available right there.
Generalize the compressed FIT handling code to accept any compression algorithm compiled into the SPL, and fix up the SPL_ZSTD linkage which requires xxhash in the SPL but which was absent to date. While here, also extend binman to support passing a compression level via its image templates, which helps squeeze additional ~15% size savings in my testing with Zstd level 19 without impacting decompression speed. This is done with Rockchip RK3576 in mind, so a small Rockchip image template refactor is included. CI passes all green: https://git.u-boot-project.org/u-boot/contributors/alchark/u-boot/-/pipelines/1289 Signed-off-by: Alexey Charkov <[email protected]> --- Alexey Charkov (11): boot: image: Keep the image-type table out of xPL lib: Build xxhash in the SPL phase lib: Let SPL minify zstd on its own lib: Track whether a phase has a decompressor spl: fit: Decompress any supported algorithm test: spl: Keep the payload create_fit() is handed test: spl: Size the FIT properties for the image name test: spl: Cover FIT image decompression sandbox: spl: Enable zstd binman: Allow choosing the compression level rockchip: Choose FIT payload compression via Kconfig arch/arm/dts/rockchip-u-boot.dtsi | 16 ++--- arch/arm/mach-rockchip/Kconfig | 78 ++++++++++++++++++++ boot/image.c | 7 +- common/spl/spl_fit.c | 27 +++---- configs/sandbox_spl_defconfig | 3 +- include/spl.h | 6 +- include/test/spl.h | 8 +++ lib/Kconfig | 54 +++++++++++++- lib/Makefile | 3 +- lib/zstd/Makefile | 2 +- test/image/spl_load.c | 84 +++++++++++++++++----- test/image/spl_load_nor.c | 2 + tools/binman/binman.rst | 21 ++++++ tools/binman/bintool.py | 10 ++- tools/binman/btool/lz4.py | 6 +- tools/binman/btool/lzma_alone.py | 6 +- tools/binman/entry.py | 6 +- tools/binman/ftest.py | 34 +++++++++ tools/binman/test/entry/compress_level.dts | 12 ++++ tools/binman/test/entry/compress_level_gzip.dts | 12 ++++ tools/binman/test/entry/compress_level_lzma.dts | 12 ++++ .../test/entry/compress_level_no_compress.dts | 11 +++ 22 files changed, 361 insertions(+), 59 deletions(-) --- base-commit: 37bbe6e3ed205037fbca390f239eff9899639e39 change-id: 20260915-spl-fit-compression-62108358dc6f Best regards, -- Alexey Charkov <[email protected]>
