summaryrefslogtreecommitdiffstats
path: root/pbl
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-02-04 15:49:07 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-02-04 15:49:07 +0100
commit56325edd792632df816fc89cc897bf4c39a908af (patch)
tree2d73524b70ec28c9619e13e86ac3f8e16303cf02 /pbl
parentcfb14ce242c4681062c741d383a4c1e20ae4db2b (diff)
parent08147d427f9ee4723a6ba8525a2f85b2123f840e (diff)
downloadbarebox-56325edd792632df816fc89cc897bf4c39a908af.tar.gz
Merge branch 'for-next/pbl'
Diffstat (limited to 'pbl')
-rw-r--r--pbl/Kconfig44
-rw-r--r--pbl/Makefile1
-rw-r--r--pbl/decomp.c44
3 files changed, 89 insertions, 0 deletions
diff --git a/pbl/Kconfig b/pbl/Kconfig
new file mode 100644
index 0000000..39752cc
--- /dev/null
+++ b/pbl/Kconfig
@@ -0,0 +1,44 @@
+config HAVE_PBL_IMAGE
+ bool
+
+config HAVE_IMAGE_COMPRESSION
+ bool
+
+config PBL_IMAGE
+ bool "Pre-Bootloader image"
+ depends on HAVE_PBL_IMAGE
+
+config PBL_FORCE_PIGGYDATA_COPY
+ bool
+ help
+ In some case we need to copy the PIGGYDATA as the link address
+ as example we run from SRAM and shutdown the SDRAM/DDR for
+ reconfiguration but most of the time we just need to copy the
+ executable code.
+
+if PBL_IMAGE
+
+config IMAGE_COMPRESSION
+ bool
+ depends on HAVE_IMAGE_COMPRESSION
+ default y
+
+if IMAGE_COMPRESSION
+
+choice
+ prompt "Compression"
+
+config IMAGE_COMPRESSION_LZO
+ bool "lzo"
+
+config IMAGE_COMPRESSION_GZIP
+ bool "gzip"
+
+config IMAGE_COMPRESSION_NONE
+ bool "none"
+
+endchoice
+
+endif
+
+endif
diff --git a/pbl/Makefile b/pbl/Makefile
index 7169c6c..a2d7468 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 0000000..aa6a31e
--- /dev/null
+++ b/pbl/decomp.c
@@ -0,0 +1,44 @@
+/*
+ * 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
+
+#ifdef CONFIG_IMAGE_COMPRESSION_NONE
+STATIC int decompress(u8 *input, int in_len,
+ int (*fill) (void *, unsigned int),
+ int (*flush) (void *, unsigned int),
+ u8 *output, int *posp,
+ void (*error) (char *x))
+{
+ memcpy(output, input, in_len);
+ return 0;
+}
+#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);
+}