diff options
author | wdenk <wdenk> | 2003-08-29 20:57:53 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2003-08-29 20:57:53 +0000 |
commit | c29fdfc1d8cbefd2d85a354b95486a6d2b3f4a88 (patch) | |
tree | efce72aecde2b26e3e7be7e3ef550b022732f705 /common/cmd_bootm.c | |
parent | ca75added10524a1f8e439e904ba72cb74c917a4 (diff) | |
download | u-boot-imx-c29fdfc1d8cbefd2d85a354b95486a6d2b3f4a88.zip u-boot-imx-c29fdfc1d8cbefd2d85a354b95486a6d2b3f4a88.tar.gz u-boot-imx-c29fdfc1d8cbefd2d85a354b95486a6d2b3f4a88.tar.bz2 |
Patch by Yuli Barcohen, 14 Aug 2003:
add support for bzip2 uncompression
Diffstat (limited to 'common/cmd_bootm.c')
-rw-r--r-- | common/cmd_bootm.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 44331ab..45c4f33 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -30,6 +30,7 @@ #include <image.h> #include <malloc.h> #include <zlib.h> +#include <bzlib.h> #include <environment.h> #include <asm/byteorder.h> @@ -142,6 +143,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) ulong addr; ulong data, len, checksum; ulong *len_ptr; + uint unc_len = 0x400000; int i, verify; char *name, *s; int (*appl)(cmd_tbl_t *, int, int, char *[]); @@ -307,13 +309,26 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) break; case IH_COMP_GZIP: printf (" Uncompressing %s ... ", name); - if (gunzip ((void *)ntohl(hdr->ih_load), 0x400000, + if (gunzip ((void *)ntohl(hdr->ih_load), unc_len, (uchar *)data, (int *)&len) != 0) { printf ("GUNZIP ERROR - must RESET board to recover\n"); SHOW_BOOT_PROGRESS (-6); do_reset (cmdtp, flag, argc, argv); } break; +#ifdef CONFIG_BZIP2 + case IH_COMP_BZIP2: + printf (" Uncompressing %s ... ", name); + i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load), + &unc_len, (char *)data, len, 0, 0); + if (i != BZ_OK) { + printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i); + SHOW_BOOT_PROGRESS (-6); + udelay(100000); + do_reset (cmdtp, flag, argc, argv); + } + break; +#endif /* CONFIG_BZIP2 */ default: if (iflag) enable_interrupts(); @@ -1206,6 +1221,13 @@ int gunzip(void *dst, int dstlen, unsigned char *src, int *lenp) return (0); } +#ifdef CONFIG_BZIP2 +void bz_internal_error(int errcode) +{ + printf ("BZIP2 internal error %d\n", errcode); +} +#endif /* CONFIG_BZIP2 */ + static void do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ulong addr, ulong *len_ptr, int verify) |