From 14db8908bc9be79affa521e601d1b9d9ee1de40b Mon Sep 17 00:00:00 2001
From: Masahiro Yamada <yamada.masahiro@socionext.com>
Date: Fri, 26 Jan 2018 11:42:01 +0900
Subject: [PATCH] Build: add GZIP compression filter

One typical usage of the pre-tool image filter is data compression,
and GZIP is one of the most commonly used compression methods.
I guess this is generic enough to be put in the common script instead
of platform.mk.

If you want to use this, you can add something like follows to your
platform.mk:

    BL32_PRE_TOOL_FILTER := GZIP
    BL33_PRE_TOOL_FILTER := GZIP

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
 make_helpers/build_macros.mk | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
index 7ff1e154e..0d2cf1063 100644
--- a/make_helpers/build_macros.mk
+++ b/make_helpers/build_macros.mk
@@ -170,6 +170,19 @@ check_$(1):
 	$$(if $(wildcard $(value $(_V))),,$$(error '$(_V)=$(value $(_V))' was specified, but '$(value $(_V))' does not exist))
 endef
 
+################################################################################
+# Generic image processing filters
+################################################################################
+
+# GZIP
+define GZIP_RULE
+$(1): $(2)
+	@echo "  GZIP    $$@"
+	$(Q)gzip -n -f -9 $$< --stdout > $$@
+endef
+
+GZIP_SUFFIX := .gz
+
 ################################################################################
 # Auxiliary macros to build TF images from sources
 ################################################################################
-- 
GitLab