.. _build:


Build 
==================

Using Vitis
-----------------
Refer `this <https://ohwr.org/project/spec7/wikis/uploads/ca8f150af87f5119faa94b84539f0ea0/SPEC7.pdf>`_


Using Command line
------------------------
1. Create ``.bif`` file eg: ``output.bif``
   
.. code-block::
   
   $ vi output.bif

Contents of .bif file:

 .. code-block:: 
   
    /* Linux */
    the_ROM_image:
    {
     [bootloader] <xsct_ws/zynq_fsbl/Release/-path>zynq_fsbl.elf
     <xsct_ws/spec7_custom/hw/-path to bitstream>/spec7_custom.bit
     <path-to-u-boot>/u-boot.elf
    }

2. Build using bootgen command:
   
Setup environment

.. code-block::
  
    $ source /tools/Xilinx/Vitis/2019.2/settings64.sh

Run bootgen

.. code-block::
   
    bootgen -image output.bif -arch zynq -w -o BOOT.bin

Use this image to load in QSPI from command line

.. code-block::
  
    program_flash -f BOOT.bin -fsbl </path/to/fsbl>/zynq_fsbl.elf  -flash_type qspi-x8-dual_parallel  -blank_check -url tcp:localhost:3121

Using Script
--------------------

BOOT.bin can be generated by automating above steps.
Refer `../scripts` ``Build.sh`` script in `spec7 ohwr repo <https://ohwr.org/project/spec7/tree/spec7_golden/scripts>`_ , run:

.. code-block::
   
    $ ./Build.sh


It will generate all require components i.e FSBL, U-boot, Boot.bin in `../output` directory


