[PATCH] spl: Fix link when LZMA is enabled without legacy image format support

Alexey Charkov <[email protected]>
Newsgroups gmane.comp.boot-loaders.u-boot
Message-ID <[email protected]>
spl_load_legacy_lzma() lives in common/spl/spl_legacy.c, which is only
built when CONFIG_$(PHASE_)LEGACY_IMAGE_FORMAT is set, but the call site
in _spl_load() is guarded by CONFIG_SPL_LZMA alone. Enabling LZMA
decompression without the legacy image format therefore fails to link:

  ld: common/spl/spl.o: in function `_spl_load':
  include/spl_load.h:73: undefined reference to `spl_load_legacy_lzma'

CONFIG_SPL_LZMA is also needed to support LZMA-compressed payloads with a
FIT-only SPL, so add the missing condition to avoid including the legacy
image related function call when legacy image support is not built.

Signed-off-by: Alexey Charkov <[email protected]>
---
 include/spl_load.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/spl_load.h b/include/spl_load.h
index 525e0c9e86c6..31ed5651f7bb 100644
--- a/include/spl_load.h
+++ b/include/spl_load.h
@@ -63,6 +63,7 @@ static inline int _spl_load(struct spl_image_info *spl_image,
 		return spl_load_imx_container(spl_image, info, offset);
 
 	if (IS_ENABLED(CONFIG_SPL_LZMA) &&
+	    CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT) &&
 	    image_get_magic(header) == IH_MAGIC &&
 	    image_get_comp(header) == IH_COMP_LZMA) {
 		spl_image->flags |= SPL_COPY_PAYLOAD_ONLY;

---
base-commit: 44f0dcf476140c1077ee3dbe16a80fdb6f8265c4
change-id: 20260730-spl-lzma-link-34a6fe432cfd

Best regards,
--  
Alexey Charkov <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.