[PATCH 1/4] Respect that some compression algos can be enabled separately for SPL

Tim Harvey tharvey at gateworks.com
Wed Jan 13 18:00:22 CET 2021


From: Frieder Schrempf <frieder.schrempf at kontron.de>

Some compression algorithms currently can be enabled for SPL and
U-Boot proper separately. Therefore we need to use
CONFIG_IS_ENABLED() in these cases and also prevent compiling these
functions in case of a host tool build.

Signed-off-by: Frieder Schrempf <frieder.schrempf at kontron.de>
Signed-off-by: Tim Harvey <tharvey at gateworks.com>
---
 common/image.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/common/image.c b/common/image.c
index 451fc68..bda19c0 100644
--- a/common/image.c
+++ b/common/image.c
@@ -72,6 +72,7 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
 
 #include <u-boot/crc.h>
 #include <imximage.h>
+#include <linux/kconfig.h>
 
 #ifndef CONFIG_SYS_BARGSIZE
 #define CONFIG_SYS_BARGSIZE 512
@@ -460,13 +461,13 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		else
 			ret = -ENOSPC;
 		break;
-#ifdef CONFIG_GZIP
+#if CONFIG_IS_ENABLED(GZIP) && !defined(USE_HOSTCC)
 	case IH_COMP_GZIP: {
 		ret = gunzip(load_buf, unc_len, image_buf, &image_len);
 		break;
 	}
 #endif /* CONFIG_GZIP */
-#ifdef CONFIG_BZIP2
+#if CONFIG_IS_ENABLED(BZIP2) && !defined(USE_HOSTCC)
 	case IH_COMP_BZIP2: {
 		uint size = unc_len;
 
@@ -482,7 +483,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_BZIP2 */
-#ifdef CONFIG_LZMA
+#if CONFIG_IS_ENABLED(LZMA) && !defined(USE_HOSTCC)
 	case IH_COMP_LZMA: {
 		SizeT lzma_len = unc_len;
 
@@ -492,7 +493,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_LZMA */
-#ifdef CONFIG_LZO
+#if CONFIG_IS_ENABLED(LZO) && !defined(USE_HOSTCC)
 	case IH_COMP_LZO: {
 		size_t size = unc_len;
 
@@ -501,7 +502,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_LZO */
-#ifdef CONFIG_LZ4
+#if CONFIG_IS_ENABLED(LZ4) && !defined(USE_HOSTCC)
 	case IH_COMP_LZ4: {
 		size_t size = unc_len;
 
@@ -510,7 +511,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_LZ4 */
-#ifdef CONFIG_ZSTD
+#if CONFIG_IS_ENABLED(ZSTD) && !defined(USE_HOSTCC)
 	case IH_COMP_ZSTD: {
 		size_t size = unc_len;
 		ZSTD_DStream *dstream;
-- 
2.7.4



More information about the U-Boot mailing list