Stratix® 10 SoC FPGA Boot User Guide

ID 683847
Date 8/23/2024
Public
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 Stratix® 10 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/altera/Makefile , add a second .dtb file. For example:
    dtb-$(CONFIG_ARCH_STRATIX10) += socfpga_stratix10_socdk.dtb
    dtb-$(CONFIG_ARCH_STRATIX10) += 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.rbf";
    			config-complete-timeout-us = <30000000>;
    		};
    	};
    };
    

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

Table 15.  Resultant Files
Device Tree File Description
socfpga_stratix10_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