Agilex™ 7 Device Configuration via Protocol (CvP) Implementation User Guide

ID 683763
Date 10/02/2024
Public
Document Table of Contents

6.1.5.1. Installing the Upstream Open Source CvP Driver in Linux Systems

The installation of CvP driver only needs to be done once for the same kernel version.

  1. Install these tools to build the kernel if you are using Ubuntu.
    sudo apt-get install bison
    sudo apt-get install libncurses5-dev 
    sudo apt-get install libssl-dev
    sudo apt-get install libncursesw5-dev
    sudo apt-get install -y libelf-dev
    sudo apt-get install git
    sudo apt-get install flex
    sudo apt-get install -y xz-utils
    
  2. Download the kernel source. Intel recommends you use the default kernel version from altera-opensource in github4. The following command obtains the kernel source code from altera-opensource in github.
    Example Command:
    git clone https://github.com/altera-opensource/linux-socfpga
  3. Save the kernel code folder to /usr/src.
  4. Checkout the branch using:
    cd linux-socfpga
    git checkout socfpga-v5.15.30-lts
    
  5. (This step is necessary only if you have downloaded v5.9 or below from kernel.org5.) You must install the following patches.
    1. Download Patch1 and Patch2 and save them into the kernel source folder.
    2. In the kernel source directory (for example: /usr/src/linux-5.9-tt), install the patches using the commands below.
      • Run:
        patch -p1 < 2-2-fpga-add-FPGA-manager-debugfs.patch
      • Run:
        patch -p1 < 1-2-fpga-doc-documentation-for-FPGA-debugfs.patch
  6. Build and install the kernel modules.
    1. Go into the kernel source folder. Run: cd /usr/src/linux-socfpga.
    2. Copy the existing config over to a new kernel. Run: cp -v /boot/config-$(uname -r) .config
    3. Enable Altera CvP FPGA Manager as kernel module with the command and steps below.
      • Run: make menuconfig
      • In the GUI, navigate to Device Drivers > FPGA Configuration Framework. Set Altera CvP FPGA Manager and FPGA Manager DebugFS to *. Save the config setting to .config file.
      • You may check the .config file, the 3 line items below should be enabled.
        • CONFIG_FPGA=y
        • CONFIG_FPGA_MGR_DEBUG_FS=y
        • CONFIG_FPGA_MGR_ALTERA_CVP=y
    4. Compile the kernel. Run: Make -j 12.
    5. Install the kernel modules.
      • Run: export INSTALL_MOD_PATH=/usr/src/linux-socfpga
      • Run: MODPATH="INSTALL_MOD_PATH=/usr/src/linux-socfpga"
      • Run: ARGS="$MODPATH"
      • Run: make $ARGS modules
      • Run: sudo make modules_install. Check the module version in the last line printed in the Console window. The name might be different based on Kernel build version and .config file.
      • Run "sudo make install". Ensure the Linux image and initrd image are created according to the module version.
    6. (This step is necessary only if you are using Ubuntu.) Modify the Grand Unified Bootloader (Grub) Boot Loader settings. This step is mandatory for first-time kernel installations for Linux to boot up with the appropriate kernel version.
      1. Identify the kernel module version to point to.
        1. Run: grub-mkconfig
        2. Run: cat /boot/grub/grub.cfg
        3. Search for submenu and menuentry to identify the Linux image and initrd image created during kernel installation. In the example shown below, the submenu 'Advanced options for Ubuntu' and menuentry 'Ubuntu, with Linux 5.15.30+' indicate that the kernel version to point to is Advanced options for Ubuntu>Ubuntu, with Linux 5.15.30+
      2. Backup the Grub file in case reverting is needed.
        • Run: sudo cp /etc/default/grub /etc/default/grub.bak
      3. View the Grub file.
        • Run: cat /etc/default/grub
      4. Update the Grub file.
        1. Run: gedit/etc/default/grub
        2. Change the GRUB_DEFAULT to point to the desired kernel module version as previously identified.
          • Example: GRUB_DEFAULT = "Advanced options for Ubuntu>Ubuntu, with Linux 5.15.30+"
        3. Save the changes
      5. Ensure the Grub changes take effect.
        • Run: sudo update-grub
    7. Reboot the system and ensure the system reboots to the installed kernel:
      • Run : reboot. Allow the PC to reboot successfully.
      • Run : uname -mrs. The system should be rebooted with the installed kernel version as shown below.
4 The socfpga-v5.15.30-lts and socfpga-v5.10.110-lts are the versions tested on Intel hardware as of Quartus® Prime version 22.2.
5 Intel recommends you use the default kernel version from altera-opensource in github.