Intel® FPGA SDK for OpenCL™: Intel® Arria® 10 SoC Development Kit Reference Platform Porting Guide

ID 683788
Date 10/08/2019
Public
Document Table of Contents

3.3. Compiling the OpenCL Linux Kernel Driver

Compile the OpenCL™ Linux kernel driver against the compiled kernel source.

The driver source is available in the Intel® FPGA SDK 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.

    The driver might need to be updated to work with 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);