Visible to Intel only — GUID: oek1521083396128
Ixiasoft
Visible to Intel only — GUID: oek1521083396128
Ixiasoft
6.2. Configuring the FPGA Fabric from Linux
The Linux* kernel for Stratix® 10 SoC FPGA allows you to enable the programming of FPGA from within the OS.
- 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
- 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.
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/
# 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