Fpga loadmk for A10 QSPI boot - ** Unknown image type

Has anyone had any luck using fpga loadmk to load the FPGA core image from the U-boot command line? I have turned on debug prints in the fpga.c cmd file, and booted from QSPI flash and I am trying to load the FPGA - here is the output:

fpga loadmk 0 300000:fpga-core-1
do_fpga_get_device: device = 0
fpga: argc 2, dev 0, datastr
fpga: Full command with two args

  • fpga: subimage ‘fpga-core-1’ from FIT image at 0x00300000
    do_fpga_loadmk: fpga_data = 0x300000
    ** Unknown image type
    Command ‘loadmk’ failed: Error 1

I had figured this out a while back and thought I would add my solution in case it helps someone. I had a really hard time finding any documentation on how fpga loadmk works and what the errors mean, so I ended up using debug prints in the C code, and poking around using memory display etc, to figure it out.

The process requires 2 steps.

As an example, step 1, to read 0x2000000 bytes of an FIT image stored at offset 0x400000 in serial flash, moving it to DDR SDRAM at 0x1200000:
sf read 1200000 400000 2000000

Step 2, issue the command to load the image called fpga-core-1 from the FIT at 1200000 of DDR (transferred from the previous step) to FPGA device 0:
fpga loadmk 0 1200000:fpga-core-1

And it works…