diff options
-rw-r--r-- | common/cmd_fpga.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c index c4b3c8f..010cd24 100644 --- a/common/cmd_fpga.c +++ b/common/cmd_fpga.c @@ -160,9 +160,25 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) image_header_t *hdr = (image_header_t *)fpga_data; ulong data; - - data = (ulong)image_get_data(hdr); - data_size = image_get_data_size(hdr); + uint8_t comp; + + comp = image_get_comp(hdr); + if (comp == IH_COMP_GZIP) { + ulong image_buf = image_get_data(hdr); + data = image_get_load(hdr); + ulong image_size = ~0UL; + + if (gunzip((void *)data, ~0UL, + (void *)image_buf, + &image_size) != 0) { + puts("GUNZIP: error\n"); + return 1; + } + data_size = image_size; + } else { + data = (ulong)image_get_data(hdr); + data_size = image_get_data_size(hdr); + } rc = fpga_load(dev, (void *)data, data_size); } break; |