This document describes the Buildroot support for the following
Xilinx Versal boards:

******************************************
Supported Versal Boards:
Xilinx VCK190 board
Xilinx VEK280 board
Xilinx VPK180 board
******************************************

Evaluation board features can be found here with the links below.

VCK190:
https://www.xilinx.com/products/boards-and-kits/vck190.html

VEK280:
https://www.xilinx.com/products/boards-and-kits/vek280.html

VPK180:
https://www.xilinx.com/products/boards-and-kits/vpk180.html


How to build it
===============

Configure Buildroot:

    $ make versal_vck190_defconfig

Compile everything and build the rootfs image:

    $ make

Result of the build
-------------------

After building, you should get a tree like this:

    output/images/
    +-- boot.bin
    +-- boot.vfat
    +-- Image
    +-- rootfs.ext2
    +-- rootfs.ext4 -> rootfs.ext2
    +-- sdcard.img
    +-- system.dtb -> versal-vck190-rev1.1.dtb
    `-- versal-vck190-rev1.1.dtb

How to write the SD card
========================

WARNING! This will destroy all the card content. Use with care!

The sdcard.img file is a complete bootable image ready to be written
on the boot medium. To install it, simply copy the image to an SD
card:

    # dd if=output/images/sdcard.img of=/dev/sdX

Where 'sdX' is the device node of the SD.

Eject the SD card, insert it in the board, and power it up.

Support for other boards:
=========================

If you want to build a system for other boards based on the same SoC, and the
board is already supported by the upstream kernel, U-Boot, and
xilinx-prebuilt, you simply need to change the following Buildroot options:

 - Kernel Device Tree file name (BR2_LINUX_KERNEL_INTREE_DTS_NAME)
 - U-Boot (BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="DEVICE_TREE=<dts file name>")
 - xilinx-prebuilt (BR2_TARGET_XILINX_PREBUILT_BOARD)

Custom versal board support:

To generate a boot.bin image, Versal boards require a PDI (Programmable Device
Image) generated by Xilinx Vivado which contains all the hardware specific
boot information, such as clock, MIO and DDR initializations as well as any
customizations in the programmable logic. Since this PDI can only be generated
by Xilinx Vivado, Buildroot needs access to the prebuilt image. The Buildroot
xilinx-prebuilt package has support for Versal XSA files exported from Xilinx
Vivado.

Using the option BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA, Buildroot can obtain
the prebuilt PDI from the XSA file.

1) Start with a defconfig supported by Buildroot (e.g. VCK190)
    make versal_vck190_defconfig

2) make menuconfig
    Visit the following menu and enable BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA

    Bootloaders  --->
        xilinx-prebuilt  --->
            [*] download a prebuilt Versal XSA

3) Within the same menuconfig, configure location of XSA. It can be in the
   local file system or downloadable from an https:// location.

    Bootloaders  --->
        xilinx-prebuilt  --->
            (<path to XSA>) URL of custom XSA

4) make

The resulting output/images will contain a boot.bin that includes the custom
PDI file extracted from the Xilinx Vivado exported XSA file.
