From f73a37aa7845cdf7e2bf7aba0184e065dca78198 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Mon, 28 Jan 2013 10:26:11 +0100 Subject: pbl: factorise decompressor Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- pbl/Makefile | 1 + pbl/decomp.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 pbl/decomp.c (limited to 'pbl') diff --git a/pbl/Makefile b/pbl/Makefile index 7169c6c72a..a2d7468687 100644 --- a/pbl/Makefile +++ b/pbl/Makefile @@ -3,3 +3,4 @@ # pbl-y += misc.o pbl-y += string.o +pbl-y += decomp.o diff --git a/pbl/decomp.c b/pbl/decomp.c new file mode 100644 index 0000000000..bd67ed81e1 --- /dev/null +++ b/pbl/decomp.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2010-2012 Sascha Hauer , Pengutronix + * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD + * + * Under GPLv2 only + */ + +#include +#include + +#define STATIC static + +#ifdef CONFIG_IMAGE_COMPRESSION_LZO +#include "../../../lib/decompress_unlzo.c" +#endif + +#ifdef CONFIG_IMAGE_COMPRESSION_GZIP +#include "../../../lib/decompress_inflate.c" +#endif + +static void noinline errorfn(char *error) +{ + while (1); +} + +void pbl_barebox_uncompress(void *dest, void *compressed_start, unsigned int len) +{ + decompress((void *)compressed_start, + len, + NULL, NULL, + dest, NULL, errorfn); +} -- cgit v1.2.3