Commit 8951b058 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

uniphier: support GZIP-compressed images



Allow to handle GZIP-compressed images by giving FIP_GZIP=1 from the
command line.

- Images are GZIP-compressed, then packed into FIP.  If Trusted Board
  Boot is enabled, certificates are generated based on the compressed
  images.

- GZIP decompressor is linked into BL2 to decompress images at
  run-time.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 0ac60c08
......@@ -103,6 +103,23 @@ $(ROTPK_HASH): $(ROT_KEY)
endif
ifeq (${FIP_GZIP},1)
include lib/zlib/zlib.mk
BL2_SOURCES += common/image_decompress.c \
$(ZLIB_SOURCES)
$(eval $(call add_define,UNIPHIER_DECOMPRESS_GZIP))
# compress all images loaded by BL2
SCP_BL2_PRE_TOOL_FILTER := GZIP
BL31_PRE_TOOL_FILTER := GZIP
BL32_PRE_TOOL_FILTER := GZIP
BL33_PRE_TOOL_FILTER := GZIP
endif
.PHONY: bl2_gzip
bl2_gzip: $(BUILD_PLAT)/bl2.bin.gz
%.gz: %
......
......@@ -82,7 +82,11 @@ unsigned int uniphier_calc_core_pos(u_register_t mpidr);
#define UNIPHIER_BLOCK_BUF_BASE ((UNIPHIER_SCP_BASE) + \
(UNIPHIER_SCP_MAX_SIZE))
#define UNIPHIER_BLOCK_BUF_SIZE ((UNIPHIER_NS_DRAM_LIMIT) - \
(UNIPHIER_BLOCK_BUF_BASE))
#define UNIPHIER_BLOCK_BUF_SIZE 0x00100000
#define UNIPHIER_IMAGE_BUF_BASE ((UNIPHIER_BLOCK_BUF_BASE) + \
(UNIPHIER_BLOCK_BUF_SIZE))
#define UNIPHIER_IMAGE_BUF_SIZE ((UNIPHIER_NS_DRAM_LIMIT) - \
(UNIPHIER_IMAGE_BUF_BASE))
#endif /* __UNIPHIER_H__ */
......@@ -9,8 +9,12 @@
#include <desc_image_load.h>
#include <errno.h>
#include <io/io_storage.h>
#include <image_decompress.h>
#include <platform.h>
#include <platform_def.h>
#ifdef UNIPHIER_DECOMPRESS_GZIP
#include <tf_gunzip.h>
#endif
#include <xlat_tables_v2.h>
#include "uniphier.h"
......@@ -115,8 +119,38 @@ bl_params_t *plat_get_next_bl_params(void)
return get_next_bl_params_from_mem_params_desc();
}
void bl2_plat_preload_setup(void)
{
#ifdef UNIPHIER_DECOMPRESS_GZIP
image_decompress_init(UNIPHIER_IMAGE_BUF_BASE,
UNIPHIER_IMAGE_BUF_SIZE,
gunzip);
#endif
}
int bl2_plat_handle_pre_image_load(unsigned int image_id)
{
#ifdef UNIPHIER_DECOMPRESS_GZIP
image_decompress_prepare(uniphier_get_image_info(image_id));
#endif
return 0;
}
int bl2_plat_handle_post_image_load(unsigned int image_id)
{
#ifdef UNIPHIER_DECOMPRESS_GZIP
struct image_info *image_info;
int ret;
image_info = uniphier_get_image_info(image_id);
if (!(image_info->h.attr & IMAGE_ATTRIB_SKIP_LOADING)) {
ret = image_decompress(uniphier_get_image_info(image_id));
if (ret)
return ret;
}
#endif
if (image_id == SCP_BL2_IMAGE_ID && uniphier_bl2_kick_scp)
uniphier_scp_start();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment