]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fpga: Add support for gzip images with bitstreams
authorMichal Simek <michal.simek@xilinx.com>
Fri, 4 Oct 2013 08:51:01 +0000 (10:51 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 6 Nov 2013 08:15:12 +0000 (09:15 +0100)
Here is the set of command which has been performed
to proof this feature.

gzip < fpga.bin > fpga.bin.gz
mkimage -A arm -O u-boot -T firmware -C gzip \
-a 20000000 -n "zc702_fpga_bin" -d fpga.bin.gz fpga.bin.gz.ub

tftp 100000 fpga.bin.gz.ub
fpga loadmk 0 100000

This flow should speedup loading bitstream data
from external memory and save image footprint in non volatile
memory.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
common/cmd_fpga.c

index c4b3c8fc56b8303ba7739bf7931b1fb38201afa4..010cd24e63dc21f86f0ae1910a4c4fac9d0e20e4 100644 (file)
@@ -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;