XZDEC User Guide¶
REVISION HISTORY¶
| Revision No. | Description |
Date |
|---|---|---|
| 1.0 | 04/18/2023 | |
| 1.0 | 11/25/2025 |
1. Overview¶
This article describes how to use Sgs XZDEC to provide efficient decompression when loading compressed files for SPINOR and SPINAND (FLASH ECC). The compressed data does not need to be loaded into dram first and then decompressed by the CPU. Instead, bdma is used to create SPI and XZDEC Data transmission, the compressed data is loaded from spi to XZDEC by bdma, and XZDEC writes the decompressed data to dram.
2. Keyword Description¶
-
dtr
Bilateral edge data reading。
-
xzdec
Sgs hardware IP for decompression.
-
sz
Sgs-specific file compression format, corresponding to sgs xzdec hardware decompression.
3. project Configuration¶
3.1. Check the IMAGE_CONFIG currently used by defconfig¶
Enter the project directory to confirm the CONFIG_IMAGE_CONFIG being used:
/# make ipc_iford.nor.glibc-11.1.0-squashfs.ssc029a.512.bga12_ddr4_defconfig
/# cat .config |grep IMAGE
CONFIG_IMAGE_CONFIG="spinand.squashfs.partition.config"
3.2. Modify "spinand.squashfs.partition.config"¶
3.2.1 Uboot compression format selection¶

3.2.2 Kernel compression image format selection¶
When the kernel is compiled, it will automatically generate compressed files in .xz and .sz formats. During project compilation, kernel/arch/ will be linked to kbuild/(KERNEL_VERSION)/arch. By modifying kernel(RESOURCE), you can select the kernel image format to use.

4. uboot xzdec command usage¶
Command implementation file: boot/cmd/sgs/loados.c
Usage method 1:
Use the mtdparts command to check partition status:
loados nand/nor addr partname size
This loads data of size "size" from the partition named "partname" to memory at address "addr".
Usage method 2:
Use the mtdparts command to check partition status:
loados nand/nor by_header partname by_header
This reads data from the partition named "partname" based on the size and address filled in the first 64 bytes during pre-packaging.
This command is typically used in bootcmd, for example:
bootcmd=dcache on; sf probe 0; loados nor 0x23000000 KERNEL by_header; bootm 0x23000000;
5. xzdec Benefits Description¶
This test uses spinor flash as the storage medium, which adopts dtr four wire read mode. The test results may vary depending on the testing scenario. The following results are for reference only:
| uncompression | xz(cpudec) | sz(xzdec) | |
|---|---|---|---|
| image | u-boot.img.bin | u-boot.xz.img.bin | u-boot.sz.img.bin |
| image_size | 428696 | 146900 | 168138 |
| Pcompression_type | NA | memory xz | LMAZ2 |
| time(ms) | 4.443 | 81.353 | 2.234 |