mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] pbl: factorise decompress code and add none compress support
@ 2013-01-28  9:23 Jean-Christophe PLAGNIOL-VILLARD
  2013-01-28  9:26 ` [PATCH 1/3] pbl: move configs to pbl/Kconfig Jean-Christophe PLAGNIOL-VILLARD
  2013-01-30 21:33 ` [PATCH 0/3] pbl: factorise decompress code and add none compress support Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-28  9:23 UTC (permalink / raw)
  To: barebox

HI,

The following changes since commit cd1c289b2a4949e8acb235d4847419bde784a9d6:

  Merge branch 'for-next/misc' into next (2013-01-25 19:51:11 +0100)

are available in the git repository at:


  git://git.jcrosoft.org/barebox.git delivery/pbl

for you to fetch changes up to c71c520fe4fc180c4546a37105ce2ed4fc674383:

  pbl: add none compression support (2013-01-24 06:30:57 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (3):
      pbl: move configs to pbl/Kconfig
      pbl: factorise decompressor
      pbl: add none compression support

 arch/arm/cpu/start-pbl.c        |   21 ++-------------------
 arch/arm/pbl/Makefile           |    3 ++-
 arch/arm/pbl/piggy.shipped.S    |    6 ++++++
 arch/mips/boot/main_entry-pbl.c |   23 +----------------------
 arch/mips/pbl/Makefile          |    3 ++-
 arch/mips/pbl/piggy.shipped.S   |    6 ++++++
 common/Kconfig                  |   42 +-----------------------------------------
 include/pbl.h                   |   15 +++++++++++++++
 pbl/Kconfig                     |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 pbl/Makefile                    |    1 +
 pbl/decomp.c                    |   44 ++++++++++++++++++++++++++++++++++++++++++++
 11 files changed, 126 insertions(+), 84 deletions(-)
 create mode 100644 arch/arm/pbl/piggy.shipped.S
 create mode 100644 arch/mips/pbl/piggy.shipped.S
 create mode 100644 include/pbl.h
 create mode 100644 pbl/Kconfig
 create mode 100644 pbl/decomp.c

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] pbl: move configs to pbl/Kconfig
  2013-01-28  9:23 [PATCH 0/3] pbl: factorise decompress code and add none compress support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-28  9:26 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-01-28  9:26   ` [PATCH 2/3] pbl: factorise decompressor Jean-Christophe PLAGNIOL-VILLARD
  2013-01-28  9:26   ` [PATCH 3/3] pbl: add none compression support Jean-Christophe PLAGNIOL-VILLARD
  2013-01-30 21:33 ` [PATCH 0/3] pbl: factorise decompress code and add none compress support Sascha Hauer
  1 sibling, 2 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-28  9:26 UTC (permalink / raw)
  To: barebox

so it more easy to add new entry and to maintain

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/Kconfig |   42 +-----------------------------------------
 pbl/Kconfig    |   43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 41 deletions(-)
 create mode 100644 pbl/Kconfig

diff --git a/common/Kconfig b/common/Kconfig
index eccae4c..21c061c 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -105,47 +105,7 @@ config ENVIRONMENT_VARIABLES
 
 menu "memory layout"
 
-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"
-
-endchoice
-
-endif
-
-endif
+source "pbl/Kconfig"
 
 config MMU
 	bool "Enable MMU"
diff --git a/pbl/Kconfig b/pbl/Kconfig
new file mode 100644
index 0000000..ea7d227
--- /dev/null
+++ b/pbl/Kconfig
@@ -0,0 +1,43 @@
+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"
+
+endchoice
+
+endif
+
+endif
+
+
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] pbl: factorise decompressor
  2013-01-28  9:26 ` [PATCH 1/3] pbl: move configs to pbl/Kconfig Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-28  9:26   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-01-28  9:26   ` [PATCH 3/3] pbl: add none compression support Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-28  9:26 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/cpu/start-pbl.c        |   21 ++-------------------
 arch/mips/boot/main_entry-pbl.c |   23 +----------------------
 include/pbl.h                   |   15 +++++++++++++++
 pbl/Makefile                    |    1 +
 pbl/decomp.c                    |   32 ++++++++++++++++++++++++++++++++
 5 files changed, 51 insertions(+), 41 deletions(-)
 create mode 100644 include/pbl.h
 create mode 100644 pbl/decomp.c

diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index c5f9705..f506792 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -24,6 +24,7 @@
 #include <common.h>
 #include <init.h>
 #include <sizes.h>
+#include <pbl.h>
 #include <asm/barebox-arm.h>
 #include <asm/barebox-arm-head.h>
 #include <asm-generic/memory_layout.h>
@@ -59,16 +60,6 @@ void __naked __bare_init reset(void)
 extern void *input_data;
 extern void *input_data_end;
 
-#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 unsigned long *ttb;
 
 static void create_sections(unsigned long addr, int size_m, unsigned int flags)
@@ -127,11 +118,6 @@ static void mmu_disable(void)
 	__mmu_cache_off();
 }
 
-static void noinline errorfn(char *error)
-{
-	while (1);
-}
-
 static void barebox_uncompress(void *compressed_start, unsigned int len)
 {
 	void (*barebox)(void);
@@ -155,10 +141,7 @@ static void barebox_uncompress(void *compressed_start, unsigned int len)
 	else
 		barebox = (void *)TEXT_BASE;
 
-	decompress((void *)compressed_start,
-			len,
-			NULL, NULL,
-			(void *)TEXT_BASE, NULL, errorfn);
+	pbl_barebox_uncompress((void*)TEXT_BASE, compressed_start, len);
 
 	if (use_mmu)
 		mmu_disable();
diff --git a/arch/mips/boot/main_entry-pbl.c b/arch/mips/boot/main_entry-pbl.c
index f39e936..4e87c52 100644
--- a/arch/mips/boot/main_entry-pbl.c
+++ b/arch/mips/boot/main_entry-pbl.c
@@ -30,28 +30,10 @@ extern void *input_data_end;
 unsigned long free_mem_ptr;
 unsigned long free_mem_end_ptr;
 
-#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
-
 void pbl_main_entry(void);
 
 static unsigned long *ttb;
 
-static noinline void errorfn(char *error)
-{
-	PUTS_LL(error);
-	PUTC_LL('\n');
-
-	unreachable();
-}
-
 static void barebox_uncompress(void *compressed_start, unsigned int len)
 {
 	/* set 128 KiB at the end of the MALLOC_BASE for early malloc */
@@ -60,10 +42,7 @@ static void barebox_uncompress(void *compressed_start, unsigned int len)
 
 	ttb = (void *)((free_mem_ptr - 0x4000) & ~0x3fff);
 
-	decompress((void *)compressed_start,
-			len,
-			NULL, NULL,
-			(void *)TEXT_BASE, NULL, errorfn);
+	pbl_barebox_uncompress((void*)TEXT_BASE, compressed_start, len);
 }
 
 void __section(.text_entry) pbl_main_entry(void)
diff --git a/include/pbl.h b/include/pbl.h
new file mode 100644
index 0000000..d041a3f
--- /dev/null
+++ b/include/pbl.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2
+ */
+
+#ifndef __PBL_H__
+#define __PBL_H__
+
+extern unsigned long free_mem_ptr;
+extern unsigned long free_mem_end_ptr;
+
+void pbl_barebox_uncompress(void *dest, void *compressed_start, unsigned int len);
+
+#endif /* __PBL_H__ */
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..bd67ed8
--- /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);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] pbl: add none compression support
  2013-01-28  9:26 ` [PATCH 1/3] pbl: move configs to pbl/Kconfig Jean-Christophe PLAGNIOL-VILLARD
  2013-01-28  9:26   ` [PATCH 2/3] pbl: factorise decompressor Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-28  9:26   ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-28  9:26 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/pbl/Makefile         |    3 ++-
 arch/arm/pbl/piggy.shipped.S  |    6 ++++++
 arch/mips/pbl/Makefile        |    3 ++-
 arch/mips/pbl/piggy.shipped.S |    6 ++++++
 pbl/Kconfig                   |    3 +++
 pbl/decomp.c                  |   12 ++++++++++++
 6 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/pbl/piggy.shipped.S
 create mode 100644 arch/mips/pbl/piggy.shipped.S

diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile
index 7faa51a..6eeee73 100644
--- a/arch/arm/pbl/Makefile
+++ b/arch/arm/pbl/Makefile
@@ -1,6 +1,7 @@
 
 suffix_$(CONFIG_IMAGE_COMPRESSION_GZIP) = gzip
 suffix_$(CONFIG_IMAGE_COMPRESSION_LZO)	= lzo
+suffix_$(CONFIG_IMAGE_COMPRESSION_NONE)	= shipped
 
 OBJCOPYFLAGS_zbarebox.bin = -O binary
 piggy_o := piggy.$(suffix_y).o
@@ -9,7 +10,7 @@ targets := zbarebox.lds zbarebox zbarebox.bin zbarebox.S \
 	   $(piggy_o) piggy.$(suffix_y)
 
 # Make sure files are removed during clean
-extra-y       += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern zbarebox.map
+extra-y       += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.shipped zbarebox.map
 
 $(obj)/zbarebox.bin:	$(obj)/zbarebox FORCE
 	$(call if_changed,objcopy)
diff --git a/arch/arm/pbl/piggy.shipped.S b/arch/arm/pbl/piggy.shipped.S
new file mode 100644
index 0000000..dbc2569
--- /dev/null
+++ b/arch/arm/pbl/piggy.shipped.S
@@ -0,0 +1,6 @@
+	.section .piggydata,#alloc
+	.globl  input_data
+input_data:
+	.incbin "arch/arm/pbl/piggy.shipped"
+	.globl  input_data_end
+input_data_end:
diff --git a/arch/mips/pbl/Makefile b/arch/mips/pbl/Makefile
index 7faa51a..6eeee73 100644
--- a/arch/mips/pbl/Makefile
+++ b/arch/mips/pbl/Makefile
@@ -1,6 +1,7 @@
 
 suffix_$(CONFIG_IMAGE_COMPRESSION_GZIP) = gzip
 suffix_$(CONFIG_IMAGE_COMPRESSION_LZO)	= lzo
+suffix_$(CONFIG_IMAGE_COMPRESSION_NONE)	= shipped
 
 OBJCOPYFLAGS_zbarebox.bin = -O binary
 piggy_o := piggy.$(suffix_y).o
@@ -9,7 +10,7 @@ targets := zbarebox.lds zbarebox zbarebox.bin zbarebox.S \
 	   $(piggy_o) piggy.$(suffix_y)
 
 # Make sure files are removed during clean
-extra-y       += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern zbarebox.map
+extra-y       += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.shipped zbarebox.map
 
 $(obj)/zbarebox.bin:	$(obj)/zbarebox FORCE
 	$(call if_changed,objcopy)
diff --git a/arch/mips/pbl/piggy.shipped.S b/arch/mips/pbl/piggy.shipped.S
new file mode 100644
index 0000000..963262d
--- /dev/null
+++ b/arch/mips/pbl/piggy.shipped.S
@@ -0,0 +1,6 @@
+	.section .piggydata,#alloc
+	.globl  input_data
+input_data:
+	.incbin "arch/mips/pbl/piggy.shipped"
+	.globl  input_data_end
+input_data_end:
diff --git a/pbl/Kconfig b/pbl/Kconfig
index ea7d227..37e4c4a 100644
--- a/pbl/Kconfig
+++ b/pbl/Kconfig
@@ -34,6 +34,9 @@ config IMAGE_COMPRESSION_LZO
 config IMAGE_COMPRESSION_GZIP
 	bool "gzip"
 
+config IMAGE_COMPRESSION_NONE
+	bool "none"
+
 endchoice
 
 endif
diff --git a/pbl/decomp.c b/pbl/decomp.c
index bd67ed8..aa6a31e 100644
--- a/pbl/decomp.c
+++ b/pbl/decomp.c
@@ -18,6 +18,18 @@
 #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);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] pbl: factorise decompress code and add none compress support
  2013-01-28  9:23 [PATCH 0/3] pbl: factorise decompress code and add none compress support Jean-Christophe PLAGNIOL-VILLARD
  2013-01-28  9:26 ` [PATCH 1/3] pbl: move configs to pbl/Kconfig Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-30 21:33 ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2013-01-30 21:33 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Mon, Jan 28, 2013 at 10:23:20AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> HI,
> 
> The following changes since commit cd1c289b2a4949e8acb235d4847419bde784a9d6:
> 
>   Merge branch 'for-next/misc' into next (2013-01-25 19:51:11 +0100)
> 
> are available in the git repository at:
> 
> 
>   git://git.jcrosoft.org/barebox.git delivery/pbl

Applied, thanks

Sascha

> 
> for you to fetch changes up to c71c520fe4fc180c4546a37105ce2ed4fc674383:
> 
>   pbl: add none compression support (2013-01-24 06:30:57 +0800)
> 
> ----------------------------------------------------------------
> Jean-Christophe PLAGNIOL-VILLARD (3):
>       pbl: move configs to pbl/Kconfig
>       pbl: factorise decompressor
>       pbl: add none compression support
> 
>  arch/arm/cpu/start-pbl.c        |   21 ++-------------------
>  arch/arm/pbl/Makefile           |    3 ++-
>  arch/arm/pbl/piggy.shipped.S    |    6 ++++++
>  arch/mips/boot/main_entry-pbl.c |   23 +----------------------
>  arch/mips/pbl/Makefile          |    3 ++-
>  arch/mips/pbl/piggy.shipped.S   |    6 ++++++
>  common/Kconfig                  |   42 +-----------------------------------------
>  include/pbl.h                   |   15 +++++++++++++++
>  pbl/Kconfig                     |   46 ++++++++++++++++++++++++++++++++++++++++++++++
>  pbl/Makefile                    |    1 +
>  pbl/decomp.c                    |   44 ++++++++++++++++++++++++++++++++++++++++++++
>  11 files changed, 126 insertions(+), 84 deletions(-)
>  create mode 100644 arch/arm/pbl/piggy.shipped.S
>  create mode 100644 arch/mips/pbl/piggy.shipped.S
>  create mode 100644 include/pbl.h
>  create mode 100644 pbl/Kconfig
>  create mode 100644 pbl/decomp.c
> 
> Best Regards,
> J.
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-30 21:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-28  9:23 [PATCH 0/3] pbl: factorise decompress code and add none compress support Jean-Christophe PLAGNIOL-VILLARD
2013-01-28  9:26 ` [PATCH 1/3] pbl: move configs to pbl/Kconfig Jean-Christophe PLAGNIOL-VILLARD
2013-01-28  9:26   ` [PATCH 2/3] pbl: factorise decompressor Jean-Christophe PLAGNIOL-VILLARD
2013-01-28  9:26   ` [PATCH 3/3] pbl: add none compression support Jean-Christophe PLAGNIOL-VILLARD
2013-01-30 21:33 ` [PATCH 0/3] pbl: factorise decompress code and add none compress support Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox