+ switch (comp) {
+ case IH_COMP_NONE:
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+ {
+ size_t l = len;
+ size_t tail;
+ void *to = (void *) dest;
+ void *from = (void *)data;
+
+ printf(" Loading part %d ... ", part);
+
+ while (l > 0) {
+ tail = (l > CHUNKSZ) ? CHUNKSZ : l;
+ WATCHDOG_RESET();
+ memmove(to, from, tail);
+ to += tail;
+ from += tail;
+ l -= tail;
+ }
+ }
+#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
+ printf(" Loading part %d ... ", part);
+ memmove((char *) dest, (char *)data, len);
+#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
+ break;
+#ifdef CONFIG_GZIP
+ case IH_COMP_GZIP:
+ printf(" Uncompressing part %d ... ", part);
+ if (gunzip((void *) dest, unc_len,
+ (uchar *) data, &len) != 0) {
+ puts("GUNZIP ERROR - image not loaded\n");
+ return 1;
+ }
+ break;
+#endif
+#if defined(CONFIG_BZIP2)
+ case IH_COMP_BZIP2:
+ {
+ int i;
+
+ printf(" Uncompressing part %d ... ", part);
+ /*
+ * If we've got less than 4 MB of malloc()
+ * space, use slower decompression algorithm
+ * which requires at most 2300 KB of memory.
+ */
+ i = BZ2_bzBuffToBuffDecompress(
+ map_sysmem(ntohl(hdr->ih_load), 0),
+ &unc_len, (char *)data, len,
+ CONFIG_SYS_MALLOC_LEN < (4096 * 1024),
+ 0);
+ if (i != BZ_OK) {
+ printf("BUNZIP2 ERROR %d - "
+ "image not loaded\n", i);
+ return 1;
+ }
+ }
+ break;
+#endif /* CONFIG_BZIP2 */
+ default:
+ printf("Unimplemented compression type %d\n", comp);
+ return 1;
+ }
+ puts("OK\n");