]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
lzma: Add Kconfig options to optimize for size
authorTom Rini <trini@konsulko.com>
Thu, 18 Dec 2025 23:30:56 +0000 (17:30 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 6 Jan 2026 20:44:21 +0000 (14:44 -0600)
Currently, our LZMA library has an option for optimizing for size,
rather than speed. It is a minimal savings today, and has not been worth
enabling. As this will change in the near future, add options now to
allow disabling it in full U-Boot or in SPL, and enable these on
gardena-smart-gateway-mt7688 which is very close to the size limit
today.

Reviewed-by: Stefan Roese <stefan.roese@mailbox.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
configs/gardena-smart-gateway-mt7688_defconfig
lib/Kconfig
lib/lzma/Makefile

index 3c2bcc6a3c4451475c9b479b8dcf2f247f3ac120..aba8a2ffd1def08e39d6aba9f0b4f8c925d5c26a 100644 (file)
@@ -101,4 +101,6 @@ CONFIG_MT7621_SPI=y
 CONFIG_WDT=y
 CONFIG_WDT_MT7621=y
 CONFIG_LZMA=y
+CONFIG_LZMA_SIZE_OPTIMIZATION=y
 CONFIG_SPL_LZMA=y
+CONFIG_SPL_LZMA_SIZE_OPTIMIZATION=y
index fe0b878a206b7d600440f1e2fca644b599b22f94..96032eaddf95d754e878f5ce356ceaeedc0b1e60 100644 (file)
@@ -838,6 +838,13 @@ config LZMA
          ratio and fairly fast decompression speed. See also
          CONFIG_CMD_LZMADEC which provides a decode command.
 
+config LZMA_SIZE_OPTIMIZATION
+       bool "Optimize the LZMA algorithm for smaller binary size"
+       help
+         This enables building the LZMA library optimized for size, rather
+         than performance. This can be a loss of 15-20% in decompression
+         speed, but a savings of close to two kilobytes in many cases.
+
 config LZO
        bool "Enable LZO decompression support"
        help
@@ -932,6 +939,13 @@ config SPL_LZMA
        help
          This enables support for LZMA compression algorithm for SPL boot.
 
+config SPL_LZMA_SIZE_OPTIMIZATION
+       bool "Optimize the LZMA algorithm for smaller binary size in SPL"
+       help
+         This enables building the LZMA library optimized for size, rather
+         than performance. This can be a loss of 15-20% in decompression
+         speed, but a savings of close to two kilobytes in many cases.
+
 config TPL_LZMA
        bool "Enable LZMA decompression support for TPL build"
        depends on TPL
index c2fd3e4945416567e4501cf6b56c0e591adf77af..b8ad570ab1c2fcc98226847fdaf80c18311e45c8 100644 (file)
@@ -7,5 +7,6 @@
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 
 ccflags-y += -D_LZMA_PROB32
+ccflags-$(CONFIG_$(PHASE_)LZMA_SIZE_OPTIMIZATION) += -D_LZMA_SIZE_OPT
 
 obj-y += LzmaDec.o LzmaTools.o