summaryrefslogtreecommitdiffstats
path: root/pbl
diff options
context:
space:
mode:
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);
+}