diff --git a/lib/gunzip.c b/lib/gunzip.c
index d86aa87f688477219a16550f69ba6c3cdb1cebba..80b157f99eb4844dbade0925b0f20c0850d2bda5 100644
--- a/lib/gunzip.c
+++ b/lib/gunzip.c
@@ -70,6 +70,7 @@ int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp)
 	return zunzip(dst, dstlen, src, lenp, 1, i);
 }
 
+#ifdef CONFIG_CMD_UNZIP
 __weak
 void gzwrite_progress_init(u64 expectedsize)
 {
@@ -258,6 +259,7 @@ out:
 
 	return r;
 }
+#endif
 
 /*
  * Uncompress blocks compressed with zlib without headers