Skip to contentSkip to conversation

Add support for LZMA uncompression algorithm.

PATCH Superseded Jean-Christophe PLAGNIOL-VILLARD 3 participants 10 messages Sep 7, 2008 – Oct 13, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add support for LZMA uncompression algorithm.

From: Luigi 'Comio' Mantellini <[email protected]>

---

Rebase to current HEAD
move lib_lzma to lib_generic/lzma
add Makefile Conditional compile

 Makefile                           |    1 +
 README                             |   23 ++
 common/cmd_bootm.c                 |   23 ++
 common/image.c                     |    1 +
 include/image.h                    |    1 +
 include/lzma/LzmaDecode.h          |   31 ++
 include/lzma/LzmaTools.h           |   31 ++
 include/lzma/LzmaTypes.h           |   31 ++
 lib_generic/lzma/LGPL.txt          |  504 +++++++++++++++++++++++++++
 lib_generic/lzma/LzmaDecode.c      |  584 +++++++++++++++++++++++++++++++
 lib_generic/lzma/LzmaDecode.h      |  113 ++++++
 lib_generic/lzma/LzmaTools.c       |  142 ++++++++
 lib_generic/lzma/LzmaTools.h       |   35 ++
 lib_generic/lzma/LzmaTypes.h       |   45 +++
 lib_generic/lzma/README.txt        |   28 ++
 lib_generic/lzma/history.txt       |  198 +++++++++++
 lib_generic/lzma/import_lzmasdk.sh |   38 ++
 lib_generic/lzma/lzma.txt          |  663 ++++++++++++++++++++++++++++++++++++
 18 files changed, 2492 insertions(+), 0 deletions(-)
 create mode 100644 include/lzma/LzmaDecode.h
 create mode 100644 include/lzma/LzmaTools.h
 create mode 100644 include/lzma/LzmaTypes.h
 create mode 100644 lib_generic/lzma/LGPL.txt
 create mode 100644 lib_generic/lzma/LzmaDecode.c
 create mode 100644 lib_generic/lzma/LzmaDecode.h
 create mode 100644 lib_generic/lzma/LzmaTools.c
 create mode 100644 lib_generic/lzma/LzmaTools.h
 create mode 100644 lib_generic/lzma/LzmaTypes.h
 create mode 100644 lib_generic/lzma/README.txt
 create mode 100644 lib_generic/lzma/history.txt
 create mode 100644 lib_generic/lzma/import_lzmasdk.sh
 create mode 100644 lib_generic/lzma/lzma.txt
Makefile +1 -0
index a5ff7b0..8f1c33b 100644
@@ -199,6 +199,7 @@ endif
 OBJS := $(addprefix $(obj),$(OBJS))
 
 LIBS  = lib_generic/libgeneric.a
+LIBS += lib_generic/lzma/liblzma.a
 LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \
 	"board/$(VENDOR)/common/lib$(VENDOR).a"; fi)
 LIBS += cpu/$(CPU)/lib$(CPU).a
README +23 -0
index 3e10233..6654226 100644
@@ -1044,6 +1044,29 @@ The following options need to be configured:
 		the malloc area (as defined by CFG_MALLOC_LEN) should
 		be at least 4MB.
 
+		CONFIG_LZMA
+
+		If this option is set, support for lzma compressed
+		images is included.
+
+		Note: The LZMA algorithm adds between 2 and 4KB of code and it
+		requires an amount of dynamic memory that is given by the
+		formula:
+
+			(1846 + 768 << (lc + lp)) * sizeof(uint16)
+
+		Where lc and lp stand for, respectively, Literal context bits
+		and Literal pos bits.
+
+		This value is upper-bounded by 14MB in the worst case. Anyway,
+		for a ~4MB large kernel image, we have lc=3 and lp=0 for a
+		total amount of (1846 + 768 << (3 + 0)) * 2 = ~41KB... that is
+		a very small buffer.
+
+		Use the lzmainfo tool to determinate the lc and lp values and
+		then calculate the amount of needed dynamic memory (ensuring
+		the appropriate CFG_MALLOC_LEN value).
+
 - MII/PHY support:
 		CONFIG_PHY_ADDR
 
common/cmd_bootm.c +23 -0
index 5cf0e3b..a4c6e6b 100644
@@ -50,6 +50,13 @@
 #include <fdt_support.h>
 #endif
 
+#ifdef CONFIG_LZMA
+#define _7ZIP_BYTE_DEFINED /* Byte already defined by zlib */
+#include <lzma/LzmaTypes.h>
+#include <lzma/LzmaDecode.h>
+#include <lzma/LzmaTools.h>
+#endif /* CONFIG_LZMA */
+
 DECLARE_GLOBAL_DATA_PTR;
 
 extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
@@ -332,6 +339,22 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 		*load_end = load + unc_len;
 		break;
 #endif /* CONFIG_BZIP2 */
+#ifdef CONFIG_LZMA
+	case IH_COMP_LZMA:
+		printf ("   Uncompressing %s ... ", type_name);
+
+		int ret = lzmaBuffToBuffDecompress(
+			(unsigned char *)load, &unc_len,
+			(unsigned char *)image_start, image_start);
+		if (ret != LZMA_RESULT_OK) {
+			printf ("LZMA: uncompress or overwrite error %d "
+				"- must RESET board to recover\n", ret);
+			show_boot_progress (-6);
+			return BOOTM_ERR_RESET;
+		}
+		*load_end = load + unc_len;
+		break;
+#endif /* CONFIG_LZMA */
 	default:
 		printf ("Unimplemented compression type %d\n", comp);
 		return BOOTM_ERR_UNIMPLEMENTED;
common/image.c +1 -0
index 55c4cce..604c0a9 100644
@@ -152,6 +152,7 @@ static table_entry_t uimage_comp[] = {
 	{	IH_COMP_NONE,	"none",		"uncompressed",		},
 	{	IH_COMP_BZIP2,	"bzip2",	"bzip2 compressed",	},
 	{	IH_COMP_GZIP,	"gzip",		"gzip compressed",	},
+	{	IH_COMP_LZMA,	"lzma",		"lzma compressed",	},
 	{	-1,		"",		"",			},
 };
 
include/image.h +1 -0
index 9be806e..7c884dd 100644
@@ -164,6 +164,7 @@
 #define IH_COMP_NONE		0	/*  No	 Compression Used	*/
 #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_MAGIC	0x27051956	/* Image Magic Number		*/
 #define IH_NMLEN		32	/* Image Name Length		*/
include/lzma/LzmaDecode.h new file +31 -0
new file mode 100644
index 0000000..8fdb2c0
@@ -0,0 +1,31 @@
+/*
+ * Fake include for LzmaDecode.h
+ *
+ * Copyright (C) 2007-2008 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini (luigi.mantellini at idf-hit.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __LZMADECODE_H__FAKE__
+#define __LZMADECODE_H__FAKE__
+
+#include "../../lib_generic/lzma/LzmaDecode.h"
+
+#endif
include/lzma/LzmaTools.h new file +31 -0
new file mode 100644
index 0000000..7c5eea1
@@ -0,0 +1,31 @@
+/*
+ * Fake include for LzmaTools.h
+ *
+ * Copyright (C) 2007-2008 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini (luigi.mantellini at idf-hit.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __LZMATOOLS_H__FAKE__
+#define __LZMATOOLS_H__FAKE__
+
+#include "../../lib_generic/lzma/LzmaTools.h"
+
+#endif
include/lzma/LzmaTypes.h new file +31 -0
new file mode 100644
index 0000000..02daa59
@@ -0,0 +1,31 @@
+/*
+ * Fake include for LzmaTypes.h
+ *
+ * Copyright (C) 2007-2008 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini (luigi.mantellini at idf-hit.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __LZMATYPES_H__FAKE__
+#define __LZMATYPES_H__FAKE__
+
+#include "../../lib_generic/lzma/LzmaTypes.h"
+
+#endif
lib_generic/lzma/LGPL.txt new file +504 -0

504 lines not on this page · raw message

lib_generic/lzma/LzmaDecode.c new file +584 -0

584 lines not on this page · raw message

lib_generic/lzma/LzmaDecode.h new file +113 -0

113 lines not on this page · raw message

lib_generic/lzma/LzmaTools.c new file +142 -0

142 lines not on this page · raw message

lib_generic/lzma/LzmaTools.h new file +35 -0
new file mode 100644
index 0000000..ea51eef
@@ -0,0 +1,35 @@
+/*
+ * Usefuls routines based on the LzmaTest.c file from LZMA SDK 4.57
+ *
+ * Copyright (C) 2007-2008 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini (luigi.mantellini at idf-hit.com)
+ *
+ * Copyright (C) 1999-2005 Igor Pavlov
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+ 
+#ifndef __LZMA_TOOL_H__
+#define __LZMA_TOOL_H__
+
+#include "LzmaTypes.h"
+
+extern int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize,
+			      unsigned char *inStream,  SizeT  length);
+#endif
lib_generic/lzma/LzmaTypes.h new file +45 -0

45 lines not on this page · raw message

lib_generic/lzma/README.txt new file +28 -0
new file mode 100644
index 0000000..8af698d
@@ -0,0 +1,28 @@
+The lib_lzma functionality was written by Igor Pavlov. 
+The original source cames from the LZMA SDK web page:
+
+URL: 		http://www.7-zip.org/sdk.html
+Author:         Igor Pavlov
+
+The import is made using the import_lzmasdk.sh script that:
+
+* untars the lzmaXYY.tar.bz2 file (from the download web page)
+* copies the files LzmaDecode.h, LzmaTypes.h, LzmaDecode.c, history.txt,
+  LGPL.txt, and lzma.txt from source archive into the lib_lzma directory (pwd).
+
+Example:
+
+ ./import_lzmasdk.sh ~/lzma457.tar.bz2
+
+Notice: The files from lzma sdk are not _modified_ by this script!
+
+The files LzmaTools.{c,h} are provided to export the lzmaBuffToBuffDecompress()
+function that wraps the complex LzmaDecode() function from the LZMA SDK. The
+do_bootm() function uses the lzmaBuffToBuffDecopress() function to expand the
+compressed image.
+
+The directory U-BOOT/include/lzma contains stubs files that permit to use the
+library directly from U-BOOT code without touching the original LZMA SDK's
+files.
+
+Luigi 'Comio' Mantellini <[email protected]>
lib_generic/lzma/history.txt new file +198 -0

198 lines not on this page · raw message

lib_generic/lzma/import_lzmasdk.sh new file +38 -0
new file mode 100644
index 0000000..3b4e232
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+usage() {
+	echo "Usage: $0 lzmaVERSION.tar.bz2" >&2
+	echo >&2
+	exit 1
+}
+
+if [ "$1" = "" ] ; then
+ 	 usage
+fi
+
+if [ ! -f $1 ] ; then
+	echo "$1 doesn't exist!" >&2
+	exit 1
+fi
+
+BASENAME=`basename $1 .tar.bz2`
+TMPDIR=/tmp/tmp_lib_$BASENAME
+FILES="C/Compress/Lzma/LzmaDecode.h
+      C/Compress/Lzma/LzmaTypes.h  
+      C/Compress/Lzma/LzmaDecode.c 
+      history.txt                  
+      LGPL.txt                     
+      lzma.txt"
+
+
+mkdir -p $TMPDIR
+echo "Untar $1 -> $TMPDIR"
+tar -jxf $1 -C $TMPDIR
+
+for i in $FILES; do
+	echo Copying  $TMPDIR/$i \-\> `basename $i`
+	cp $TMPDIR/$i .
+	chmod -x `basename $i`
+done
+
+echo "done!"
lib_generic/lzma/lzma.txt new file +663 -0

663 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#1 lore raw

PATCH v3 1/1 Add support for LZMA uncompression algorithm.

From: Luigi 'Comio' Mantellini <[email protected]>

---
Add missing lzma/Makefile

 Makefile                           |    1 +
 README                             |   23 ++
 common/cmd_bootm.c                 |   23 ++
 common/image.c                     |    1 +
 include/image.h                    |    1 +
 include/lzma/LzmaDecode.h          |   31 ++
 include/lzma/LzmaTools.h           |   31 ++
 include/lzma/LzmaTypes.h           |   31 ++
 lib_generic/lzma/LGPL.txt          |  504 +++++++++++++++++++++++++++
 lib_generic/lzma/LzmaDecode.c      |  584 +++++++++++++++++++++++++++++++
 lib_generic/lzma/LzmaDecode.h      |  113 ++++++
 lib_generic/lzma/LzmaTools.c       |  142 ++++++++
 lib_generic/lzma/LzmaTools.h       |   35 ++
 lib_generic/lzma/LzmaTypes.h       |   45 +++
 lib_generic/lzma/Makefile          |   50 +++
 lib_generic/lzma/README.txt        |   28 ++
 lib_generic/lzma/history.txt       |  198 +++++++++++
 lib_generic/lzma/import_lzmasdk.sh |   38 ++
 lib_generic/lzma/lzma.txt          |  663 ++++++++++++++++++++++++++++++++++++
 19 files changed, 2542 insertions(+), 0 deletions(-)
 create mode 100644 include/lzma/LzmaDecode.h
 create mode 100644 include/lzma/LzmaTools.h
 create mode 100644 include/lzma/LzmaTypes.h
 create mode 100644 lib_generic/lzma/LGPL.txt
 create mode 100644 lib_generic/lzma/LzmaDecode.c
 create mode 100644 lib_generic/lzma/LzmaDecode.h
 create mode 100644 lib_generic/lzma/LzmaTools.c
 create mode 100644 lib_generic/lzma/LzmaTools.h
 create mode 100644 lib_generic/lzma/LzmaTypes.h
 create mode 100644 lib_generic/lzma/Makefile
 create mode 100644 lib_generic/lzma/README.txt
 create mode 100644 lib_generic/lzma/history.txt
 create mode 100644 lib_generic/lzma/import_lzmasdk.sh
 create mode 100644 lib_generic/lzma/lzma.txt
Makefile +1 -0
index a5ff7b0..8f1c33b 100644
@@ -199,6 +199,7 @@ endif
 OBJS := $(addprefix $(obj),$(OBJS))
 
 LIBS  = lib_generic/libgeneric.a
+LIBS += lib_generic/lzma/liblzma.a
 LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \
 	"board/$(VENDOR)/common/lib$(VENDOR).a"; fi)
 LIBS += cpu/$(CPU)/lib$(CPU).a
README +23 -0
index 3e10233..6654226 100644
@@ -1044,6 +1044,29 @@ The following options need to be configured:
 		the malloc area (as defined by CFG_MALLOC_LEN) should
 		be at least 4MB.
 
+		CONFIG_LZMA
+
+		If this option is set, support for lzma compressed
+		images is included.
+
+		Note: The LZMA algorithm adds between 2 and 4KB of code and it
+		requires an amount of dynamic memory that is given by the
+		formula:
+
+			(1846 + 768 << (lc + lp)) * sizeof(uint16)
+
+		Where lc and lp stand for, respectively, Literal context bits
+		and Literal pos bits.
+
+		This value is upper-bounded by 14MB in the worst case. Anyway,
+		for a ~4MB large kernel image, we have lc=3 and lp=0 for a
+		total amount of (1846 + 768 << (3 + 0)) * 2 = ~41KB... that is
+		a very small buffer.
+
+		Use the lzmainfo tool to determinate the lc and lp values and
+		then calculate the amount of needed dynamic memory (ensuring
+		the appropriate CFG_MALLOC_LEN value).
+
 - MII/PHY support:
 		CONFIG_PHY_ADDR
 
common/cmd_bootm.c +23 -0
index 5cf0e3b..a4c6e6b 100644
@@ -50,6 +50,13 @@
 #include <fdt_support.h>
 #endif
 
+#ifdef CONFIG_LZMA
+#define _7ZIP_BYTE_DEFINED /* Byte already defined by zlib */
+#include <lzma/LzmaTypes.h>
+#include <lzma/LzmaDecode.h>
+#include <lzma/LzmaTools.h>
+#endif /* CONFIG_LZMA */
+
 DECLARE_GLOBAL_DATA_PTR;
 
 extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
@@ -332,6 +339,22 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 		*load_end = load + unc_len;
 		break;
 #endif /* CONFIG_BZIP2 */
+#ifdef CONFIG_LZMA
+	case IH_COMP_LZMA:
+		printf ("   Uncompressing %s ... ", type_name);
+
+		int ret = lzmaBuffToBuffDecompress(
+			(unsigned char *)load, &unc_len,
+			(unsigned char *)image_start, image_start);
+		if (ret != LZMA_RESULT_OK) {
+			printf ("LZMA: uncompress or overwrite error %d "
+				"- must RESET board to recover\n", ret);
+			show_boot_progress (-6);
+			return BOOTM_ERR_RESET;
+		}
+		*load_end = load + unc_len;
+		break;
+#endif /* CONFIG_LZMA */
 	default:
 		printf ("Unimplemented compression type %d\n", comp);
 		return BOOTM_ERR_UNIMPLEMENTED;
common/image.c +1 -0
index 55c4cce..604c0a9 100644
@@ -152,6 +152,7 @@ static table_entry_t uimage_comp[] = {
 	{	IH_COMP_NONE,	"none",		"uncompressed",		},
 	{	IH_COMP_BZIP2,	"bzip2",	"bzip2 compressed",	},
 	{	IH_COMP_GZIP,	"gzip",		"gzip compressed",	},
+	{	IH_COMP_LZMA,	"lzma",		"lzma compressed",	},
 	{	-1,		"",		"",			},
 };
 
include/image.h +1 -0
index 9be806e..7c884dd 100644
@@ -164,6 +164,7 @@
 #define IH_COMP_NONE		0	/*  No	 Compression Used	*/
 #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_MAGIC	0x27051956	/* Image Magic Number		*/
 #define IH_NMLEN		32	/* Image Name Length		*/
include/lzma/LzmaDecode.h new file +31 -0
new file mode 100644
index 0000000..8fdb2c0
@@ -0,0 +1,31 @@
+/*
+ * Fake include for LzmaDecode.h
+ *
+ * Copyright (C) 2007-2008 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini (luigi.mantellini at idf-hit.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __LZMADECODE_H__FAKE__
+#define __LZMADECODE_H__FAKE__
+
+#include "../../lib_generic/lzma/LzmaDecode.h"
+
+#endif
include/lzma/LzmaTools.h new file +31 -0
new file mode 100644
index 0000000..7c5eea1
@@ -0,0 +1,31 @@
+/*
+ * Fake include for LzmaTools.h
+ *
+ * Copyright (C) 2007-2008 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini (luigi.mantellini at idf-hit.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __LZMATOOLS_H__FAKE__
+#define __LZMATOOLS_H__FAKE__
+
+#include "../../lib_generic/lzma/LzmaTools.h"
+
+#endif
include/lzma/LzmaTypes.h new file +31 -0
new file mode 100644
index 0000000..02daa59
@@ -0,0 +1,31 @@
+/*
+ * Fake include for LzmaTypes.h
+ *
+ * Copyright (C) 2007-2008 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini (luigi.mantellini at idf-hit.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __LZMATYPES_H__FAKE__
+#define __LZMATYPES_H__FAKE__
+
+#include "../../lib_generic/lzma/LzmaTypes.h"
+
+#endif
lib_generic/lzma/LGPL.txt new file +504 -0

504 lines not on this page · raw message

lib_generic/lzma/LzmaDecode.c new file +584 -0

584 lines not on this page · raw message

lib_generic/lzma/LzmaDecode.h new file +113 -0

113 lines not on this page · raw message

lib_generic/lzma/LzmaTools.c new file +142 -0

142 lines not on this page · raw message

lib_generic/lzma/LzmaTools.h new file +35 -0
new file mode 100644
index 0000000..ea51eef
@@ -0,0 +1,35 @@
+/*
+ * Usefuls routines based on the LzmaTest.c file from LZMA SDK 4.57
+ *
+ * Copyright (C) 2007-2008 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini (luigi.mantellini at idf-hit.com)
+ *
+ * Copyright (C) 1999-2005 Igor Pavlov
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+ 
+#ifndef __LZMA_TOOL_H__
+#define __LZMA_TOOL_H__
+
+#include "LzmaTypes.h"
+
+extern int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize,
+			      unsigned char *inStream,  SizeT  length);
+#endif
lib_generic/lzma/LzmaTypes.h new file +45 -0

45 lines not on this page · raw message

lib_generic/lzma/Makefile new file +50 -0

50 lines not on this page · raw message

lib_generic/lzma/README.txt new file +28 -0
new file mode 100644
index 0000000..8af698d
@@ -0,0 +1,28 @@
+The lib_lzma functionality was written by Igor Pavlov. 
+The original source cames from the LZMA SDK web page:
+
+URL: 		http://www.7-zip.org/sdk.html
+Author:         Igor Pavlov
+
+The import is made using the import_lzmasdk.sh script that:
+
+* untars the lzmaXYY.tar.bz2 file (from the download web page)
+* copies the files LzmaDecode.h, LzmaTypes.h, LzmaDecode.c, history.txt,
+  LGPL.txt, and lzma.txt from source archive into the lib_lzma directory (pwd).
+
+Example:
+
+ ./import_lzmasdk.sh ~/lzma457.tar.bz2
+
+Notice: The files from lzma sdk are not _modified_ by this script!
+
+The files LzmaTools.{c,h} are provided to export the lzmaBuffToBuffDecompress()
+function that wraps the complex LzmaDecode() function from the LZMA SDK. The
+do_bootm() function uses the lzmaBuffToBuffDecopress() function to expand the
+compressed image.
+
+The directory U-BOOT/include/lzma contains stubs files that permit to use the
+library directly from U-BOOT code without touching the original LZMA SDK's
+files.
+
+Luigi 'Comio' Mantellini <[email protected]>
lib_generic/lzma/history.txt new file +198 -0

198 lines not on this page · raw message

lib_generic/lzma/import_lzmasdk.sh new file +38 -0
new file mode 100644
index 0000000..3b4e232
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+usage() {
+	echo "Usage: $0 lzmaVERSION.tar.bz2" >&2
+	echo >&2
+	exit 1
+}
+
+if [ "$1" = "" ] ; then
+ 	 usage
+fi
+
+if [ ! -f $1 ] ; then
+	echo "$1 doesn't exist!" >&2
+	exit 1
+fi
+
+BASENAME=`basename $1 .tar.bz2`
+TMPDIR=/tmp/tmp_lib_$BASENAME
+FILES="C/Compress/Lzma/LzmaDecode.h
+      C/Compress/Lzma/LzmaTypes.h  
+      C/Compress/Lzma/LzmaDecode.c 
+      history.txt                  
+      LGPL.txt                     
+      lzma.txt"
+
+
+mkdir -p $TMPDIR
+echo "Untar $1 -> $TMPDIR"
+tar -jxf $1 -C $TMPDIR
+
+for i in $FILES; do
+	echo Copying  $TMPDIR/$i \-\> `basename $i`
+	cp $TMPDIR/$i .
+	chmod -x `basename $i`
+done
+
+echo "done!"
lib_generic/lzma/lzma.txt new file +663 -0

663 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#2 lore raw

PATCH v3 1/1 Add support for LZMA uncompression algorithm.

Hi Jean-Christophe,
Hi U-boot ml,

thanks for the rebasing this patch.

best regards,

luigi

Il luned? 08 settembre 2008 02:46:13 Jean-Christophe PLAGNIOL-VILLARD ha scritto:

Quoted 6 lines

From: Luigi 'Comio' Mantellini <[email protected]>

---
Add missing lzma/Makefile

....

Signature · 8 lines
Luigi Mantellini
R&D - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantellini at idf-hit.com
#3 lore raw

PATCH v3 1/1 Add support for LZMA uncompression algorithm.

In reply to Jean-Christophe PLAGNIOL-VILLARD

Dear Jean-Christophe PLAGNIOL-VILLARD,

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

--===============0188417863==

From: Luigi 'Comio' Mantellini <[email protected]>

---
Add missing lzma/Makefile

 Makefile                           |    1 +
 README                             |   23 ++
 common/cmd_bootm.c                 |   23 ++
 common/image.c                     |    1 +
 include/image.h                    |    1 +
 include/lzma/LzmaDecode.h          |   31 ++
 include/lzma/LzmaTools.h           |   31 ++
 include/lzma/LzmaTypes.h           |   31 ++
 lib_generic/lzma/LGPL.txt          |  504 +++++++++++++++++++++++++++
 lib_generic/lzma/LzmaDecode.c      |  584 +++++++++++++++++++++++++++++++
 lib_generic/lzma/LzmaDecode.h      |  113 ++++++
 lib_generic/lzma/LzmaTools.c       |  142 ++++++++
 lib_generic/lzma/LzmaTools.h       |   35 ++
 lib_generic/lzma/LzmaTypes.h       |   45 +++
 lib_generic/lzma/Makefile          |   50 +++
 lib_generic/lzma/README.txt        |   28 ++
 lib_generic/lzma/history.txt       |  198 +++++++++++
 lib_generic/lzma/import_lzmasdk.sh |   38 ++
 lib_generic/lzma/lzma.txt          |  663 ++++++++++++++++++++++++++++++++++++
 19 files changed, 2542 insertions(+), 0 deletions(-)
 create mode 100644 include/lzma/LzmaDecode.h
 create mode 100644 include/lzma/LzmaTools.h
 create mode 100644 include/lzma/LzmaTypes.h
 create mode 100644 lib_generic/lzma/LGPL.txt
 create mode 100644 lib_generic/lzma/LzmaDecode.c
 create mode 100644 lib_generic/lzma/LzmaDecode.h
Quoted 8 lines
 create mode 100644 lib_generic/lzma/LzmaTools.c
 create mode 100644 lib_generic/lzma/LzmaTools.h
 create mode 100644 lib_generic/lzma/LzmaTypes.h
 create mode 100644 lib_generic/lzma/Makefile
 create mode 100644 lib_generic/lzma/README.txt
 create mode 100644 lib_generic/lzma/history.txt
 create mode 100644 lib_generic/lzma/import_lzmasdk.sh
 create mode 100644 lib_generic/lzma/lzma.txt

Applied, but please be abit more careful about Coding style requirements:

Applying Add support for LZMA uncompression algorithm. .dotest/patch:414: trailing whitespace.

.dotest/patch:779: trailing whitespace.

.dotest/patch:786: trailing whitespace.
It means that you can select one of these two licenses and
.dotest/patch:790: trailing whitespace.
Igor Pavlov, as the author of this Code, expressly permits you to
.dotest/patch:791: trailing whitespace.
statically or dynamically link your Code (or bind by name) to the
warning: squelched 171 whitespace errors
warning: 176 lines applied after fixing whitespace errors.

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
Space is big. You just won't believe how vastly, hugely, mind-
bogglingly big it is. I mean, you may think it's a long way down the
road to the drug store, but that's just peanuts to space.
                              -- The Hitchhiker's Guide to the Galaxy
#4 lore raw

PATCH v3 1/1 Add support for LZMA uncompression algorithm.

HI Wolfgang,

the lzma.txt file is from the original sources.

thanks for applying this patch.

luigi

2008/9/13 Wolfgang Denk <[email protected]>:

Quoted 81 lines

Dear Jean-Christophe PLAGNIOL-VILLARD,

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

--===============0188417863==

From: Luigi 'Comio' Mantellini <[email protected]>

---
Add missing lzma/Makefile

 Makefile                           |    1 +
 README                             |   23 ++
 common/cmd_bootm.c                 |   23 ++
 common/image.c                     |    1 +
 include/image.h                    |    1 +
 include/lzma/LzmaDecode.h          |   31 ++
 include/lzma/LzmaTools.h           |   31 ++
 include/lzma/LzmaTypes.h           |   31 ++
 lib_generic/lzma/LGPL.txt          |  504 +++++++++++++++++++++++++++
 lib_generic/lzma/LzmaDecode.c      |  584 +++++++++++++++++++++++++++++++
 lib_generic/lzma/LzmaDecode.h      |  113 ++++++
 lib_generic/lzma/LzmaTools.c       |  142 ++++++++
 lib_generic/lzma/LzmaTools.h       |   35 ++
 lib_generic/lzma/LzmaTypes.h       |   45 +++
 lib_generic/lzma/Makefile          |   50 +++
 lib_generic/lzma/README.txt        |   28 ++
 lib_generic/lzma/history.txt       |  198 +++++++++++
 lib_generic/lzma/import_lzmasdk.sh |   38 ++
 lib_generic/lzma/lzma.txt          |  663 ++++++++++++++++++++++++++++++++++++
 19 files changed, 2542 insertions(+), 0 deletions(-)
 create mode 100644 include/lzma/LzmaDecode.h
 create mode 100644 include/lzma/LzmaTools.h
 create mode 100644 include/lzma/LzmaTypes.h
 create mode 100644 lib_generic/lzma/LGPL.txt
 create mode 100644 lib_generic/lzma/LzmaDecode.c
 create mode 100644 lib_generic/lzma/LzmaDecode.h
Quoted 8 lines
 create mode 100644 lib_generic/lzma/LzmaTools.c
 create mode 100644 lib_generic/lzma/LzmaTools.h
 create mode 100644 lib_generic/lzma/LzmaTypes.h
 create mode 100644 lib_generic/lzma/Makefile
 create mode 100644 lib_generic/lzma/README.txt
 create mode 100644 lib_generic/lzma/history.txt
 create mode 100644 lib_generic/lzma/import_lzmasdk.sh
 create mode 100644 lib_generic/lzma/lzma.txt

Applied, but please be abit more careful about Coding style requirements:

Applying Add support for LZMA uncompression algorithm. .dotest/patch:414: trailing whitespace.

.dotest/patch:779: trailing whitespace.

.dotest/patch:786: trailing whitespace.
It means that you can select one of these two licenses and
.dotest/patch:790: trailing whitespace.
Igor Pavlov, as the author of this Code, expressly permits you to
.dotest/patch:791: trailing whitespace.
statically or dynamically link your Code (or bind by name) to the
warning: squelched 171 whitespace errors
warning: 176 lines applied after fixing whitespace errors.

Best regards,

Wolfgang Denk

--
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 Space is big. You just won't believe how vastly, hugely, mind- bogglingly big it is. I mean, you may think it's a long way down the road to the drug store, but that's just peanuts to space.
-- The Hitchhiker's Guide to the Galaxy
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 10 lines
Luigi 'Comio' Mantellini
R&D - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy

Tel.: +39 02 5167 2813
Fax: +39 02 5167 2459
web: www.idf-hit.com
mail: luigi.mantellini at idf-hit.com
#5 lore raw

PATCH v3 1/1 Add support for LZMA uncompression algorithm.

In reply to Jean-Christophe PLAGNIOL-VILLARD

I noticed a typo in the lzma uncompress invocation (image_start instead image_len).

This patch correct the mistake.

best regards.

luigi

(I'm sorry but I cannot use the git-send-email)

Il luned? 08 settembre 2008 02:46:13 Jean-Christophe PLAGNIOL-VILLARD ha scritto:

Quoted 33 lines

From: Luigi 'Comio' Mantellini <[email protected]>

---
Add missing lzma/Makefile

 Makefile                           |    1 +
 README                             |   23 ++
 common/cmd_bootm.c                 |   23 ++
 common/image.c                     |    1 +
 include/image.h                    |    1 +
 include/lzma/LzmaDecode.h          |   31 ++
 include/lzma/LzmaTools.h           |   31 ++
 include/lzma/LzmaTypes.h           |   31 ++
 lib_generic/lzma/LGPL.txt          |  504 +++++++++++++++++++++++++++
 lib_generic/lzma/LzmaDecode.c      |  584 +++++++++++++++++++++++++++++++
 lib_generic/lzma/LzmaDecode.h      |  113 ++++++
 lib_generic/lzma/LzmaTools.c       |  142 ++++++++
 lib_generic/lzma/LzmaTools.h       |   35 ++
 lib_generic/lzma/LzmaTypes.h       |   45 +++
 lib_generic/lzma/Makefile          |   50 +++
 lib_generic/lzma/README.txt        |   28 ++
 lib_generic/lzma/history.txt       |  198 +++++++++++
 lib_generic/lzma/import_lzmasdk.sh |   38 ++
 lib_generic/lzma/lzma.txt          |  663
++++++++++++++++++++++++++++++++++++ 19 files changed, 2542 insertions(+),
0 deletions(-)
 create mode 100644 include/lzma/LzmaDecode.h
 create mode 100644 include/lzma/LzmaTools.h
 create mode 100644 include/lzma/LzmaTypes.h
 create mode 100644 lib_generic/lzma/LGPL.txt
 create mode 100644 lib_generic/lzma/LzmaDecode.c
 create mode 100644 lib_generic/lzma/LzmaDecode.h
Quoted 9 lines
 create mode 100644 lib_generic/lzma/LzmaTools.c
 create mode 100644 lib_generic/lzma/LzmaTools.h
 create mode 100644 lib_generic/lzma/LzmaTypes.h
 create mode 100644 lib_generic/lzma/Makefile
 create mode 100644 lib_generic/lzma/README.txt
 create mode 100644 lib_generic/lzma/history.txt
 create mode 100644 lib_generic/lzma/import_lzmasdk.sh
 create mode 100644 lib_generic/lzma/lzma.txt

Luigi Mantellini
R&D - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy

Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantellini at idf-hit.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-lzma-uncompress-call-image_start-wrongly-used-i.patch
Type: text/x-patch
Size: 892 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080913/35df1166/attachment.bin

#6 lore raw

PATCH v3 1/1 Add support for LZMA uncompression algorithm.

Quoted 18 lines
Fax:   +39 02 5167 2459
Email: luigi.mantellini at idf-hit.com

From 565ecc8ff0a21a9a9f3381c0bfaea629598b7c00 Mon Sep 17 00:00:00 2001
From: Luigi 'Comio' Mantellini <[email protected]>
Date: Sat, 13 Sep 2008 10:04:32 +0200
Subject: [PATCH] Fix lzma uncompress call (image_start wrongly used instead image_len)

---
 common/cmd_bootm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bootm.c +0 -0
index 19257bb..897e9f6 100644

common/cmd_bootm.c static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress) · line 350

Quoted 5 lines
common/cmd_bootm.c +1 -1
@@ -347,7 +347,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 
 		int ret = lzmaBuffToBuffDecompress(
 			(unsigned char *)load, &unc_len,
-			(unsigned char *)image_start, image_start);
+			(unsigned char *)image_start, image_len);

It's work without this too

Best Regards,
J.

#7 lore raw

PATCH v3 1/1 Add support for LZMA uncompression algorithm.

In reply to Luigi 'Comio' Mantellini

Dear "Luigi 'Comio' Mantellini",

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

I noticed a typo in the lzma uncompress invocation (image_start instead=20 image_len).

This patch correct the mistake.

Please add your Signed-off-by: line...

Best regards,

Wolfgang Denk

Signature · 5 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
Quote from the Boss... "I didn't say it was your fault.  I said I was
going to blame it on you."
#8 lore raw

PATCH v3 1/1 Add support for LZMA uncompression algorithm.

Sorry again, but I cannot use git-send-email. This is the corrected patch.

Best regards,

luigi

Il domenica 14 settembre 2008 00:58:10 Wolfgang Denk ha scritto:

Quoted 13 lines

Dear "Luigi 'Comio' Mantellini",

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

I noticed a typo in the lzma uncompress invocation (image_start instead=20 image_len).

This patch correct the mistake.

Please add your Signed-off-by: line...

Best regards,

Wolfgang Denk

Signature · 16 lines
Luigi Mantellini
R&D - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantellini at idf-hit.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-lzma-uncompress-call-image_start-wrongly-used-i.patch
Type: text/x-patch
Size: 964 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080914/075e4205/attachment.bin 
#9 lore raw

PATCH v3 1/1 Add support for LZMA uncompression algorithm.

Dear "Luigi 'Comio' Mantellini",

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

Date: Sat, 13 Sep 2008 10:04:32 +0200
Subject: [PATCH] Fix lzma uncompress call (image_start wrongly used instead=
image_len)

---
 common/cmd_bootm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 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
Children begin by loving their parents. After a time they judge them.
Rarely, if ever, do they forgive them.                  - Oscar Wilde