Intel® Agilex™ SoC FPGA Boot User Guide

ID 683389
Date 11/10/2021
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

6.2. Configuring the FPGA Fabric from Linux

Note: This feature is supported with Linux* kernel v4.9 LTSI and onwards. Refer to RocketBoards.org and the Intel® public git repository for the latest information regarding this feature.

The Linux* kernel for Intel® Agilex™ SoC FPGA allows you to enable the programming of FPGA from within the OS.

If you want to test the FPGA reconfiguration at kernel level, make the following changes to the kernel source code:
  1. In the file arch/arm64/boot/dts/intel/Makefile, add a second .dtb file. For example:
    dtb-$(CONFIG_ARCH_AGILEX) += socfpga_agilex_socdk.dtb
    dtb-$(CONFIG_ARCH_AGILEX) += overlay.dtb
  2. Create the new overlay.dts file and add the overlay information of the RBF file into the file as shown below:
    /dts-v1/;
    /plugin/;
    / {
    	fragment@0 {
    		target-path = "/soc/base_fpga_region";
    		#address-cells = <1>;
    		#size-cells = <1>;
    		__overlay__ {
    			#address-cells = <1>;
    			#size-cells = <1>;
    
    			firmware-name = "overlay.dtb";
    			config-complete-timeout-us = <30000000>;
    		};
    	};
    };
    

When you build the Linux* kernel for this feature, the build generates two *.dtb files.

Table 19.  Resultant Files
Device Tree File Description
socfpga_agilex_socdk.dtb The default *.dtb file used with the kernel image to boot the system.
overlay.dtb The *.dtb file used to trigger FPGA configuration in OS.

In your compilation output folder, rename the FPGA configuration file (*.rbf) to the following name: overlay.rbf. Then, copy both the FPGA configuration file (*.rbf) and the overlay.dtb file to the following location in your Root File System:

$ mkdir <your_ROOTFS>/lib/firmware

$ cp overlay.dtb <your_ROOTFS>/lib/firmware/

$ cp overlay.rbf <your_ROOTFS>/lib/firmware/

The changes above allow you to program the FPGA in Linux* by applying an overlay on the system. After you boot to Linux* and log in with root privilege, use the following command to begin FPGA configuration:

# mkdir /sys/kernel/config/device-tree/overlays/0

# echo overlay.dtb >

/sys/kernel/config/device-tree/overlays/0/path/
If you want to re-apply the overlay, you have to first remove the existing overlay, and then re-run the previous steps:
# rmdir /sys/kernel/config/device-tree/overlays/0

# mkdir /sys/kernel/config/device-tree/overlays/0

# echo overlay.dtb >/sys/kernel/config/device-tree/overlays/0/path

The following design example demonstrates using Linux device tree overlays to configure the FPGA fabric: Intel® Agilex™ SoC HPS First Single QSPI Flash Boot.