Intel® FPGA RTE for OpenCL™ Pro Edition: Getting Started Guide

ID 683173
Date 12/19/2022
Public
Document Table of Contents

4.1.4. Recompiling the Linux Kernel Driver

Compile the OpenCL™ Linux kernel driver against the compiled kernel source. If you need to rebuild the Linux kernel driver, recompile the aclsoc Linux kernel driver to the exact version of the Linux kernel running on the SoC FPGA.

The driver source is available in the Intel® FPGA RTE for OpenCL™ installation directory. Compile the driver yourself on a host machine that has sudo and the most recent version of the SoC EDS.

  1. Copy the driver source from $INTELFPGAOCLSDKROOT/board/a10soc/arm32/driver/ to a new directory.
  2. Set the KDIR value in the driver Makefile to the directory containing the Linux kernel source files that you downloaded in Compiling the Linux Kernel for the Intel Arria 10 SoC Development Kit.
  3. In the new directory that contains the driver source files, run the make clean command.
  4. Run the make command to create the aclsoc_drv.ko file.

    This file is used later in Building the SD Card Image.

    You might need to update the driver to work with the newer version of the Linux kernel if you see the following message while building the kernel driver:
    aclsoc_cmd.c:165:14: error: too many arguments to function ‘get_user_pages_unlocked’ 
    In file included from aclsoc_cmd.c:50:0
    To update the driver, make the following changes to $INTELFPGAOCLSDKROOT/board/a10soc/arm32/driver/aclsoc_cmd.c:
    1. Find the following code in aclsoc_cmd.c:
      ret = get_user_pages_unlocked(target_task, target_task->mm,
                   start_page + got * PAGE_SIZE,
                   num_pages - got, write, 1,
                   p + got);
    2. Replace that code with the following code:
      ret = get_user_pages_remote(target_task, target_task->mm,
                   start_page + got * PAGE_SIZE,
                   num_pages - got, FOLL_WRITE|FOLL_FORCE,
                   p + got, vma);