summaryrefslogtreecommitdiff
path: root/pbl
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2013-01-28 10:26:11 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-01-30 22:32:13 +0100
commitf73a37aa7845cdf7e2bf7aba0184e065dca78198 (patch)
tree55c18f6090f0086b4fe05ed98a9edac6cdf71f1b /pbl
parent36db2a0f05f8dab8c8c38e47b5112dbb89a47781 (diff)
downloadbarebox-f73a37aa7845cdf7e2bf7aba0184e065dca78198.tar.gz
pbl: factorise decompressor
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'pbl')
-rw-r--r--pbl/Makefile1
-rw-r--r--pbl/decomp.c32
2 files changed, 33 insertions, 0 deletions
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 <s.hauer@pengutronix.de>, Pengutronix
+ * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2 only
+ */
+
+#include <common.h>
+#include <pbl.h>
+
+#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);
+}