[U-Boot] [PATCH 2/4] gzip/zlib: make features optional

Mike Frysinger vapier at gentoo.org
Wed Nov 4 22:46:34 CET 2009


If you really want to slim down U-Boot and you would rather use a higher
compression scheme (like LZMA), it'd be nice to disable gzip/zlib since
these code bases take up a significant amount of space.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 common/cmd_bootm.c        |    2 ++
 include/config_defaults.h |    3 +++
 lib_generic/Makefile      |    4 ++--
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index f275d02..ce174d7 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -348,6 +348,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 		*load_end = load + image_len;
 		puts("OK\n");
 		break;
+#ifdef CONFIG_GZIP
 	case IH_COMP_GZIP:
 		printf ("   Uncompressing %s ... ", type_name);
 		if (gunzip ((void *)load, unc_len,
@@ -361,6 +362,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 
 		*load_end = load + image_len;
 		break;
+#endif /* CONFIG_GZIP */
 #ifdef CONFIG_BZIP2
 	case IH_COMP_BZIP2:
 		printf ("   Uncompressing %s ... ", type_name);
diff --git a/include/config_defaults.h b/include/config_defaults.h
index 08b6ede..0337163 100644
--- a/include/config_defaults.h
+++ b/include/config_defaults.h
@@ -14,4 +14,7 @@
 #define CONFIG_BOOTM_NETBSD 1
 #define CONFIG_BOOTM_RTEMS 1
 
+#define CONFIG_GZIP 1
+#define CONFIG_ZLIB 1
+
 #endif
diff --git a/lib_generic/Makefile b/lib_generic/Makefile
index 8d23c5d..ae2c282 100644
--- a/lib_generic/Makefile
+++ b/lib_generic/Makefile
@@ -36,7 +36,7 @@ COBJS-y += crc32.o
 COBJS-y += ctype.o
 COBJS-y += display_options.o
 COBJS-y += div64.o
-COBJS-y += gunzip.o
+COBJS-$(CONFIG_GZIP) += gunzip.o
 COBJS-$(CONFIG_LMB) += lmb.o
 COBJS-y += ldiv.o
 COBJS-$(CONFIG_MD5) += md5.o
@@ -45,7 +45,7 @@ COBJS-$(CONFIG_SHA256) += sha256.o
 COBJS-y += string.o
 COBJS-y	+= strmhz.o
 COBJS-y += vsprintf.o
-COBJS-y += zlib.o
+COBJS-$(CONFIG_ZLIB) += zlib.o
 COBJS-$(CONFIG_RBTREE)	+= rbtree.o
 
 COBJS	:= $(COBJS-y)
-- 
1.6.5.2



More information about the U-Boot mailing list