ID 683788
Date 10/08/2019
Public

## 3.2. Compiling the Linux Kernel for the Intel Arria 10 SoC Development Kit

Before running OpenCL™ applications on an Intel Arria 10 SoC board, compile the Linux kernel with the contiguous memory allocator (CMA) feature enabled. Before enabling CMA, recompile the Linux kernel.
1. Review the GSRD Compiling Linux instructions at the RocketBoards.org website for instructions on downloading and rebuilding the Linux kernel source code.
For use with the Intel® FPGA SDK for OpenCL™ , determine which branch to download based on the release notes for the sdimage.img file that you download. For example, if the GSRD 18.1 sdimage.img file was created using Linux kernel v4.9.78 LTSi, look for branch socfpga-4.9.78-ltsi.

Specify your downloaded branch as the test branch name (test_branch). You can find the commands you need to run under Building Kernel & U-Boot Separately From Git Tree on the GSRD Compiling Linux page.

2. 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
Note: The building process creates the arch/arm/configs/socfpga_defconfig file. This file specifies the settings for the socfpga default configuration.

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.

3. Run the make mrproper command to clean the current configuration.
4. Run the make ARCH=arm socfpga_defconfig 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.

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