aboutsummaryrefslogtreecommitdiffstats
path: root/lib/zlib/zlib.mk
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-01-26 11:42:01 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-02-02 00:18:54 +0900
commitc43d68510e309b8e8d152c158ec46450f14d72a6 (patch)
tree3c8f200dcc9ec93b069c2f84ae831f4eeb75612d /lib/zlib/zlib.mk
parent221b1638aed1bedd7b17802d66c3288c07a60c85 (diff)
downloadplatform_external_arm-trusted-firmware-c43d68510e309b8e8d152c158ec46450f14d72a6.tar.gz
platform_external_arm-trusted-firmware-c43d68510e309b8e8d152c158ec46450f14d72a6.tar.bz2
platform_external_arm-trusted-firmware-c43d68510e309b8e8d152c158ec46450f14d72a6.zip
zlib: add gunzip() support
This commit adds some more files to use zlib from TF. To use zlib, ->zalloc and ->zfree hooks are needed. The implementation depends on the system. For user-space, the libc provides malloc() and friends. Unfortunately, ARM Trusted Firmware does not provide malloc() or any concept of dynamic memory allocation. I implemented very simple calloc() and free() for this. Stupidly, zfree() never frees memory, but it works enough for this. The purpose of using zlib is to implement gunzip() - this function takes compressed data from in_buf, then dumps the decompressed data to oub_buf. The work_buf is used for memory allocation during the decompress. Upon exit, it updates in_buf and out_buf. If successful, in_buf points to the end of input data, out_buf to the end of the decompressed data. To use this feature, you need to do: - include lib/zlib/zlib.mk from your platform.mk - add $(ZLIB_SOURCES) to your BL*_SOURCES Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'lib/zlib/zlib.mk')
-rw-r--r--lib/zlib/zlib.mk25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/zlib/zlib.mk b/lib/zlib/zlib.mk
new file mode 100644
index 000000000..98d4efaa8
--- /dev/null
+++ b/lib/zlib/zlib.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+ZLIB_PATH := lib/zlib
+
+# Imported from zlib 1.2.11 (do not modify them)
+ZLIB_SOURCES := $(addprefix $(ZLIB_PATH)/, \
+ adler32.c \
+ crc32.c \
+ inffast.c \
+ inflate.c \
+ inftrees.c \
+ zutil.c)
+
+# Implemented for TF
+ZLIB_SOURCES += $(addprefix $(ZLIB_PATH)/, \
+ tf_gunzip.c)
+
+INCLUDES += -Iinclude/lib/zlib
+
+# REVISIT: the following flags need not be given globally
+TF_CFLAGS += -DZ_SOLO -DDEF_WBITS=31