Intel® FPGA SDK for OpenCL™: Intel® Cyclone® V SoC Development Kit Reference Platform Porting Guide

ID 683435
Date 11/06/2017
Public
Document Table of Contents

1.6.1. Recompiling the Linux Kernel

To enable the CMA, you must first recompile the Linux kernel.
  1. Click the GSRD v14.0 - Compiling Linux link on the Resources page of the RocketBoards.org website to access instructions on downloading and rebuilding the Linux kernel source code.
    For use with the ™ Intel® FPGA SDK for OpenCL™ , specify socfpga-3.13-rel14.0 as the <test_branch_name>.
  2. Note: The building process creates the arch/arm/configs/socfpga_defconfig file. This file specifies the settings for the socfpga default configuration.
    Add the following lines to the bottom of the arch/arm/configs/socfpga_defconfig file.
    CONFIG_MEMORY_ISOLATION=y
    CONFIG_CMA=y
    CONFIG_DMA_CMA=y
    CONFIG_CMA_DEBUG=y
    CONFIG_CMA_SIZE_MBYTES=512
    CONFIG_CMA_SIZE_SEL_MBYTES=y
    CONFIG_CMA_ALIGNMENT=8
    CONFIG_CMA_AREAS=7
    The CONFIG_CMA_SIZE_MBYTES configuration value sets the upper limit on the total number of physically contiguous memory available. You may increase this value if you require more memory.
    Attention: The total amount of physical memory available to the ARM® processor on the SoC FPGA board is 1 GB. Intel® does not recommend that you set the CMA manager close to 1 GB.
  3. Run the make mrproper command to clean the current configuration.
  4. Run the make ARCH=arm socfpga_deconfig command.
    ARCH=arm indicates that you want to configure the ARM architecture. socfpga_defconfig indicates that you want to use the default socfpga configuration.
  5. Run the export CROSS_COMPILE=arm-linux-gnueabihf- command.
    This command sets the CROSS_COMPILE environment variable to specify the prefix of the desired tool chain.
  6. Run the make ARCH=arm zImage command. The resulting image is available in the arch/arm/boot/zImage file.
  7. Place the zImage file into the fat32 partition of the flash card image. For detailed instructions, refer to the Cyclone V SoC FPGA-specific GSRD User Manual on Rocketboards.org.
  8. Note: To correctly insert the OpenCL Linux kernel driver, first load an SDK-generated .rbf file onto the FPGA.
    To create the .rbf file, compile an SDK design example with the Cyclone® V SoC Development Kit Reference Platform as the targeted Custom Platform.
  9. Place the .rbf file into the fat32 partition of the flash card image.
    Attention: The fat32 partition must contain both the zImage file and the .rbf file. Without a .rbf file, a fatal error will occur when you insert the driver.
  10. Insert the programmed micro SD card, which contains the SD card image you modified or created earlier, into the Cyclone V SoC Development Kit and then power up the SoC FPGA board.
  11. Verify the version of the installed Linux kernel by running the uname -r command.
  12. To verify that you enable the CMA successfully in the kernel, with the SoC FPGA board powered up, run the grep init_cma /proc/kallsyms command.
    CMA is enabled if the output is non-empty.
  13. To use the recompiled Linux kernel with the SDK, compile and install the Linux kernel driver.