binman: Why is the first word the compressed size in compressed data

Stefan Herbrechtsmeier stefan.herbrechtsmeier-oss at weidmueller.com
Wed Jun 1 10:29:49 CEST 2022


Hi Simon,

I want to compress a FPGA Image on the fly via binman but this doesn't 
work. I have add a bintool implementation for gzip, add gzip support to 
comp_util.py and set `compress` and `compression` property in the binman 
node of the u-boot dtsi:

fpga-2cg {
	compatible = "u-boot,fpga-legacy";
	description = "FPGA";
	type = "fpga";
	compression = "gzip";
	load = <(CONFIG_SYS_TEXT_BASE + 0x4000000)>;

	blob-ext {
		compress = "gzip";
		filename = "2cg.bit.bin";
	};
};

It works if I remove the `compress` property and use a `2cg.bit.bin.gz` 
or remove the header for gzip [1].

Regarding the code binman add the compressed size as first word to the 
data [2]. The code in spl-fit.c doesn't remove the size [3]. Why is this 
size added?

[1] 
https://source.denx.de/u-boot/u-boot/-/blob/master/tools/binman/comp_util.py#L44
[2] 
https://source.denx.de/u-boot/u-boot/-/blob/master/tools/binman/entry.py#L1065
[3] 
https://source.denx.de/u-boot/u-boot/-/blob/master/common/spl/spl_fit.c#L334

Regards
   Stefan


More information about the U-Boot mailing list