diff options
author | Luigi 'Comio' Mantellini <luigi.mantellini@idf-hit.com> | 2008-09-08 02:46:13 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-09-13 01:59:07 +0200 |
commit | fc9c1727b5b3483ce49c3cb668e8332fb001b8a7 (patch) | |
tree | 4225e1899157c007aebc19d150f62be9f04d11de /common/cmd_bootm.c | |
parent | 508eb85db7065e34948c189c83f7e348c1cfd61e (diff) | |
download | u-boot-imx-fc9c1727b5b3483ce49c3cb668e8332fb001b8a7.zip u-boot-imx-fc9c1727b5b3483ce49c3cb668e8332fb001b8a7.tar.gz u-boot-imx-fc9c1727b5b3483ce49c3cb668e8332fb001b8a7.tar.bz2 |
Add support for LZMA uncompression algorithm.
Signed-off-by: Luigi 'Comio' Mantellini <luigi.mantellini@idf-hit.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'common/cmd_bootm.c')
-rw-r--r-- | common/cmd_bootm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 9c63e04..19257bb 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -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); @@ -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; |