summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2009-11-19 11:37:51 +0100
committerWolfgang Denk <wd@denx.de>2009-12-05 01:30:23 +0100
commit20dde48bcadd856c86a91d5463831a10be46db83 (patch)
tree0fd8ab398d563f05aa1eec30fae6e4493af91928 /common
parent3eb90bad651fab39cffba750ec4421a9c01d60e7 (diff)
downloadu-boot-imx-20dde48bcadd856c86a91d5463831a10be46db83.zip
u-boot-imx-20dde48bcadd856c86a91d5463831a10be46db83.tar.gz
u-boot-imx-20dde48bcadd856c86a91d5463831a10be46db83.tar.bz2
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@free-electrons.com Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bootm.c22
-rw-r--r--common/image.c1
2 files changed, 23 insertions, 0 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 8f83598..aa85faf 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -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;
diff --git a/common/image.c b/common/image.c
index 6eaf41e..5cc3ab4 100644
--- a/common/image.c
+++ b/common/image.c
@@ -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, "", "", },
};