Hi Alexey,

On 9/21/26 4:27 PM, Alexey Charkov wrote:
Hi Quentin,

On Mon, Sep 21, 2026 at 5:14 PM Quentin Schulz <[email protected]> wrote:

Hi Alexey,

On 9/18/26 12:52 PM, Alexey Charkov wrote:
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/1319


Doesn't work on my PX30 Ringneck for any of the supported compression
algorithms (didn't check lzma as I'm daily driving Fedora and it doesn't
have lzma_alone binary).

Doesn't work on my RK3399 Puma as well (couldn't check zstd, SPL was too
big and overlapped with U-Boot FIT, note that Puma is special in that it
only allows (256-32)KiB for SPL, due to backward compatibility with
older versions of U-Boot that had U-Boot FIT located at offset 256KiB).

That's interesting. Does it work without my series though? With Gzip.


It also doesn't work without your series.

If it doesn't, the first thing I'd check is overlapping memory regions
for the compressed data and the ultimate load address of any of the
binaries involved.

Would you mind sharing your resulting FIT structure that binman
produced for the failing boards, including all the ATF segments?


BL31 for both come from upstream TF-A, seemingly from v2.13.0 (according to strings build/rk3399/release/bl31/bl31.elf | grep -E '^v').

ringneck-px30_defconfig + CONFIG_ROCKCHIP_UBOOT_COMP_GZIP=y

$ mkimage -l build/ringneck/u-boot.itb
Truncated file
FIT description: FIT image for U-Boot with bl31 (TF-A)
Created:         Mon Sep 21 17:29:13 2026
 Image 0 (u-boot)
  Description:  U-Boot
  Created:      Mon Sep 21 17:29:13 2026
  Type:         Standalone Program
  Compression:  gzip compressed
  Data Size:    315656 Bytes = 308.26 KiB = 0.30 MiB
  Architecture: AArch64
  Load Address: 0x00800000
  Entry Point:  0x00800000
  Hash algo:    sha256
Hash value: 1ab3cad555db60bcb81aa670798449758553a93100dccf0c08a4f9e426bb704c
 Image 1 (atf-1)
  Description:  ARM Trusted Firmware
  Created:      Mon Sep 21 17:29:13 2026
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    106496 Bytes = 104.00 KiB = 0.10 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0x00040000
  Hash algo:    sha256
Hash value: 8ffbc6cfd2fe46ea218e5afaf76c3a4b57d80adacedd3e6d793e67f8433c5936
 Image 2 (atf-2)
  Description:  ARM Trusted Firmware
  Created:      Mon Sep 21 17:29:13 2026
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    126 Bytes = 0.12 KiB = 0.00 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0x0005a000
  Hash algo:    sha256
Hash value: b108492f1fc2fb0046ace3f683cdfb5f4dae3df7cc3b4ec9ba2a06ad3b194f4e
 Image 3 (atf-3)
  Description:  ARM Trusted Firmware
  Created:      Mon Sep 21 17:29:13 2026
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    112 Bytes = 0.11 KiB = 0.00 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0xff020000
  Hash algo:    sha256
Hash value: 324fe45d21d49d4eef66d2edc3f69d15f3285c790e470db953976abc46ba6f94
 Image 4 (fdt-1)
  Description:  fdt-rockchip/px30-ringneck-haikou
  Created:      Mon Sep 21 17:29:13 2026
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    73216 Bytes = 71.50 KiB = 0.07 MiB
  Architecture: Unknown Architecture
  Hash algo:    sha256
Hash value: 5a17c482bc2f993bc8f971086cd4a173006236be79424dcec390a743580bcfdd
 Default Configuration: 'config-1'
 Configuration 0 (config-1)
  Description:  rockchip/px30-ringneck-haikou.dtb
  Kernel:       unavailable
  Firmware:     atf-1
  FDT:          fdt-1
  Compatible:   tsd,px30-ringneck-haikou
                rockchip,px30
  Loadables:    u-boot
                atf-2
                atf-3

Boot log:

U-Boot TPL board init
DDR4, 333MHz
BW=32 Col=10 Bk=4 BG=2 CS0 Row=16 CS=1 Die BW=16 Size=2048MB
out

U-Boot SPL 2026.10-rc4-00496-gf94e3597ec41 (Sep 21 2026 - 17:29:10 +0200)
Trying to boot from MMC1
## Checking hash(es) for config config-1 ... OK
## Checking hash(es) for Image atf-1 ... sha256+ OK
## Checking hash(es) for Image u-boot ... sha256+ OK
   Uncompressing Invalid Image to 800000
Error: inflate() returned -3
Uncompressing error
spl_load_simple_fit: can't load image loadables index 0 (ret = -5)
mmc_load_image_raw_sector: mmc block read error
Error: -38
SPL: Unsupported Boot Device!

puma-rk3399_defconfig + CONFIG_ROCKCHIP_UBOOT_COMP_GZIP=y

$ mkimage -l build/puma/u-boot.itb
Truncated file
FIT description: FIT image for U-Boot with bl31 (TF-A)
Created:         Mon Sep 21 17:36:47 2026
 Image 0 (u-boot)
  Description:  U-Boot
  Created:      Mon Sep 21 17:36:47 2026
  Type:         Standalone Program
  Compression:  gzip compressed
  Data Size:    433877 Bytes = 423.71 KiB = 0.41 MiB
  Architecture: AArch64
  Load Address: 0x00800000
  Entry Point:  0x00800000
  Hash algo:    sha256
Hash value: 2c24443bce4cffa899eb4e45e9903433f2cbc59b96d4b3dc98bf827544f2b252
 Image 1 (atf-1)
  Description:  ARM Trusted Firmware
  Created:      Mon Sep 21 17:36:47 2026
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    147456 Bytes = 144.00 KiB = 0.14 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0x00040000
  Hash algo:    sha256
Hash value: d737d2efb49d780d6cd72eb7e6c34c0cc5294753e6ac45f4495bab12f44b5a93
 Image 2 (atf-2)
  Description:  ARM Trusted Firmware
  Created:      Mon Sep 21 17:36:47 2026
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    78 Bytes = 0.08 KiB = 0.00 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0x00064000
  Hash algo:    sha256
Hash value: f59dc67a835f14d92d5bfee57920f5a8a68d06609481b5ede9492f4e2d379a21
 Image 3 (atf-3)
  Description:  ARM Trusted Firmware
  Created:      Mon Sep 21 17:36:47 2026
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    8024 Bytes = 7.84 KiB = 0.01 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0xff3b0000
  Hash algo:    sha256
Hash value: 256c48c2a37faf72304b91d09daeee8442e70f06b2aae7c693e85f3d87662855
 Image 4 (atf-4)
  Description:  ARM Trusted Firmware
  Created:      Mon Sep 21 17:36:47 2026
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    8192 Bytes = 8.00 KiB = 0.01 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0xff8c0000
  Hash algo:    sha256
Hash value: c70fdb94f7bf6d48fb04ebd4f04b386323c41a6a796e0756beca23345ad3537f
 Image 5 (atf-5)
  Description:  ARM Trusted Firmware
  Created:      Mon Sep 21 17:36:47 2026
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    0 Bytes = 0.00 KiB = 0.00 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0xff8c2000
  Hash algo:    sha256
Hash value: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
 Image 6 (fdt-1)
  Description:  fdt-rockchip/rk3399-puma-haikou
  Created:      Mon Sep 21 17:36:47 2026
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    97768 Bytes = 95.48 KiB = 0.09 MiB
  Architecture: Unknown Architecture
  Hash algo:    sha256
Hash value: 70793f8f952644970f5e6b08f18a710276781023228ba9014b9a138ea8ceef18
 Default Configuration: 'config-1'
 Configuration 0 (config-1)
  Description:  rockchip/rk3399-puma-haikou.dtb
  Kernel:       unavailable
  Firmware:     atf-1
  FDT:          fdt-1
  Compatible:   tsd,rk3399-puma-haikou
                rockchip,rk3399
  Loadables:    u-boot
                atf-2
                atf-3
                atf-4
                atf-5

Boot log:

U-Boot TPL 2026.10-rc4-00496-gf94e3597ec41 (Sep 21 2026 - 17:36:45)

U-Boot TPL 2026.10-rc4-00496-gf94e3597ec41 (Sep 21 2026 - 17:36:45)
Channel 0: DDR3, 666MHz
BW=32 Col=10 Bk=8 CS0 Row=16 CS=1 Die BW=16 Size=2048MB
Channel 1: DDR3, 666MHz
BW=32 Col=10 Bk=8 CS0 Row=16 CS=1 Die BW=16 Size=2048MB
256B stride
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2026.10-rc4-00496-gf94e3597ec41 (Sep 21 2026 - 17:36:45 +0200)
Trying to boot from MMC1
## Checking hash(es) for config config-1 ... OK
## Checking hash(es) for Image atf-1 ... sha256+ OK
## Checking hash(es) for Image u-boot ... sha256+ OK
   Uncompressing Invalid Image to 800000
Error: inflate() returned -3
Uncompressing error
spl_load_simple_fit: can't load image loadables index 0 (ret = -5)
mmc_load_image_raw_sector: mmc block read error
Error: -38
SPL: Unsupported Boot Device!

Cheers,
Quentin

Reply via email to