}
 #endif /* CONFIG_LZMA */
 #ifdef CONFIG_LZO
-       case IH_COMP_LZO:
+       case IH_COMP_LZO: {
+               size_t size;
+
                printf("   Uncompressing %s ... ", type_name);
 
-               ret = lzop_decompress(image_buf, image_len, load_buf,
-                                     &unc_len);
+               ret = lzop_decompress(image_buf, image_len, load_buf, &size);
                if (ret != LZO_E_OK) {
                        printf("LZO: uncompress or overwrite error %d "
                              "- must RESET board to recover\n", ret);
                        return BOOTM_ERR_RESET;
                }
 
-               *load_end = load + unc_len;
+               *load_end = load + size;
                break;
+       }
 #endif /* CONFIG_LZO */
        default:
                printf("Unimplemented compression type %d\n", comp);
 
 #include <bzlib.h>
 #endif
 #include <asm/byteorder.h>
+#include <asm/io.h>
 
 #ifndef CONFIG_SYS_XIMG_LEN
 /* use 8MByte as default max gunzip size */
        ulong           data, len, count;
        int             verify;
        int             part = 0;
-       image_header_t  *hdr;
+       image_header_t  *hdr = NULL;
 #if defined(CONFIG_FIT)
        const char      *uname = NULL;
        const void*     fit_hdr;
                                 * which requires at most 2300 KB of memory.
                                 */
                                i = BZ2_bzBuffToBuffDecompress(
-                                       (char *)ntohl(hdr->ih_load),
+                                       map_sysmem(ntohl(hdr->ih_load), 0),
                                        &unc_len, (char *)data, len,
                                        CONFIG_SYS_MALLOC_LEN < (4096 * 1024),
                                        0);