From fc9c1727b5b3483ce49c3cb668e8332fb001b8a7 Mon Sep 17 00:00:00 2001 From: Luigi 'Comio' Mantellini Date: Mon, 8 Sep 2008 02:46:13 +0200 Subject: Add support for LZMA uncompression algorithm. Signed-off-by: Luigi 'Comio' Mantellini Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- common/cmd_bootm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'common/cmd_bootm.c') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 9c63e04f279..19257bbd4cd 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -50,6 +50,13 @@ #include #endif +#ifdef CONFIG_LZMA +#define _7ZIP_BYTE_DEFINED /* Byte already defined by zlib */ +#include +#include +#include +#endif /* CONFIG_LZMA */ + DECLARE_GLOBAL_DATA_PTR; extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp); @@ -334,6 +341,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; -- cgit v1.2.3