Skip to contentSkip to conversation

add lzop decompression support

PATCH New Peter Korsgaard 3 participants 5 messages Nov 19, 2009 – Dec 5, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add lzop decompression support

Add lzop decompression support to the existing lzo bitstream handling (think gzip versus zlib), and support it for uImage decompression if CONFIG_LZO is enabled.

Lzop doesn't compress as good as gzip (~10% worse), but decompression is very fast (~0.7s faster here on a slow ppc). The lzop decompression code is based on Albin Tonnerre's recent ARM Linux lzo support patch.

Cc albin.tonnerre at free-electrons.com
---
 common/cmd_bootm.c                 |   22 +++++++++
 common/image.c                     |    1 +
 include/image.h                    |    1 +
 include/linux/lzo.h                |    4 ++
 lib_generic/lzo/lzo1x_decompress.c |   87 ++++++++++++++++++++++++++++++++++++
 5 files changed, 115 insertions(+), 0 deletions(-)
common/cmd_bootm.c +22 -0
index 8f83598..aa85faf 100644
@@ -57,6 +57,10 @@
 #include <lzma/LzmaTools.h>
 #endif /* CONFIG_LZMA */
 
+#ifdef CONFIG_LZO
+#include <linux/lzo.h>
+#endif /* CONFIG_LZO */
+
 DECLARE_GLOBAL_DATA_PTR;
 
 extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
@@ -405,6 +409,24 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 		*load_end = load + unc_len;
 		break;
 #endif /* CONFIG_LZMA */
+#ifdef CONFIG_LZO
+	case IH_COMP_LZO:
+		printf ("   Uncompressing %s ... ", type_name);
+
+		int ret = lzop_decompress((const unsigned char *)image_start,
+					  image_len, (unsigned char *)load,
+					  &unc_len);
+		if (ret != LZO_E_OK) {
+			printf ("LZO: uncompress or overwrite error %d "
+			      "- must RESET board to recover\n", ret);
+			if (boot_progress)
+				show_boot_progress (-6);
+			return BOOTM_ERR_RESET;
+		}
+
+		*load_end = load + unc_len;
+		break;
+#endif /* CONFIG_LZO */
 	default:
 		printf ("Unimplemented compression type %d\n", comp);
 		return BOOTM_ERR_UNIMPLEMENTED;
common/image.c +1 -0
index 6eaf41e..5cc3ab4 100644
@@ -148,6 +148,7 @@ static table_entry_t uimage_comp[] = {
 	{	IH_COMP_BZIP2,	"bzip2",	"bzip2 compressed",	},
 	{	IH_COMP_GZIP,	"gzip",		"gzip compressed",	},
 	{	IH_COMP_LZMA,	"lzma",		"lzma compressed",	},
+	{	IH_COMP_LZO,	"lzo",		"lzo compressed",	},
 	{	-1,		"",		"",			},
 };
 
include/image.h +1 -0
index 5a424e6..cc38eae 100644
@@ -164,6 +164,7 @@
 #define IH_COMP_GZIP		1	/* gzip	 Compression Used	*/
 #define IH_COMP_BZIP2		2	/* bzip2 Compression Used	*/
 #define IH_COMP_LZMA		3	/* lzma  Compression Used	*/
+#define IH_COMP_LZO		4	/* lzo   Compression Used	*/
 
 #define IH_MAGIC	0x27051956	/* Image Magic Number		*/
 #define IH_NMLEN		32	/* Image Name Length		*/
include/linux/lzo.h +4 -0
index d793497..88687fa 100644
@@ -27,6 +27,10 @@ int lzo1x_1_compress(const unsigned char *src, size_t src_len,
 int lzo1x_decompress_safe(const unsigned char *src, size_t src_len,
 			unsigned char *dst, size_t *dst_len);
 
+/* decompress lzop format */
+int lzop_decompress(const unsigned char *src, size_t src_len,
+		    unsigned char *dst, size_t *dst_len);
+
 /*
  * Return values (< 0 = Error)
  */
lib_generic/lzo/lzo1x_decompress.c +87 -0

93 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 1/1 add lzop decompression support

Quoted 8 lines

Add lzop decompression support to the existing lzo bitstream handling (think gzip versus zlib), and support it for uImage decompression if CONFIG_LZO is enabled.

Lzop doesn't compress as good as gzip (~10% worse), but decompression is very fast (~0.7s faster here on a slow ppc). The lzop decompression code is based on Albin Tonnerre's recent ARM Linux lzo support patch.

Perhaps you want to have a look at the patch I just sent:
[PATCH RFC] zlib: Optimize decompression

Jocke

#2 lore raw

PATCH 1/1 add lzop decompression support

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Joakim" == Joakim Tjernlund <[email protected]> writes:

Hi,

Quoted 4 lines
Quoted 4 lines

Lzop doesn't compress as good as gzip (~10% worse), but decompression is very fast (~0.7s faster here on a slow ppc). The lzop decompression code is based on Albin Tonnerre's recent ARM Linux lzo support patch.

Joakim> Perhaps you want to have a look at the patch I just sent:
Joakim> [PATCH RFC] zlib: Optimize decompression

Yes, I noticed (and your corresponding kernel patch). I'll give it a try, but it's probably still slower than lzo.

Thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/1 add lzop decompression support

In reply to Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Peter> Add lzop decompression support to the existing lzo bitstream handling Peter> (think gzip versus zlib), and support it for uImage decompression if Peter> CONFIG_LZO is enabled.

Comments?

Peter> Lzop doesn't compress as good as gzip (~10% worse), but decompression Peter> is very fast (~0.7s faster here on a slow ppc). The lzop decompression Peter> code is based on Albin Tonnerre's recent ARM Linux lzo support patch.

Peter> Cc: albin.tonnerre at free-electrons.com Peter> Signed-off-by: Peter Korsgaard <[email protected]> Peter> ---

 Peter>  common/cmd_bootm.c                 |   22 +++++++++
 Peter>  common/image.c                     |    1 +
 Peter>  include/image.h                    |    1 +
 Peter>  include/linux/lzo.h                |    4 ++
 Peter>  lib_generic/lzo/lzo1x_decompress.c |   87 ++++++++++++++++++++++++++++++++++++

Peter> 5 files changed, 115 insertions(+), 0 deletions(-)

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 add lzop decompression support

In reply to Peter Korsgaard

Dear Peter Korsgaard,

Quoted 10 lines · In message <[email protected]> you wrote:

Add lzop decompression support to the existing lzo bitstream handling (think gzip versus zlib), and support it for uImage decompression if CONFIG_LZO is enabled.

Lzop doesn't compress as good as gzip (~10% worse), but decompression is very fast (~0.7s faster here on a slow ppc). The lzop decompression code is based on Albin Tonnerre's recent ARM Linux lzo support patch.

Cc albin.tonnerre at free-electrons.com
Quoted 7 lines
---
 common/cmd_bootm.c                 |   22 +++++++++
 common/image.c                     |    1 +
 include/image.h                    |    1 +
 include/linux/lzo.h                |    4 ++
 lib_generic/lzo/lzo1x_decompress.c |   87 ++++++++++++++++++++++++++++++++++++
 5 files changed, 115 insertions(+), 0 deletions(-)

Applied to "next", thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There's always been Tower of Babel sort of  bickering  inside  Unix,
but  this  is the most extreme form ever. This means at least several
years of confusion." - Bill Gates, founder and chairman of Microsoft,
about the Open Systems Foundation