Nios2 Linux on Altera FPGA Development Boards

Warning

Support for the A10GX carrier is discontinued and will not be supported in future releases. The last supported HDL release is hdl_2021_r1.

Pre-built images

Pre-built Linux images are available for the following hardware configurations:

On Windows with Quartus II installed, run the provided program.bat script to program the board. This will flash the FPGA bitfile and Linux ELF image, then launch a Nios2 terminal displaying the Linux console output.

IIO Oscilloscope remote

Install IIO Oscilloscope on a host PC and connect remotely to the target platform:

  1. Open Settings > Connect

  2. Select Manual and enter the URI: ip:<board-ip>

  3. Press Refresh then Connect

To determine the board IP, log in on the Nios2 terminal with user root and password analog, then run ifconfig.

Building Linux

Using a script

~$
wget https://raw.githubusercontent.com/analogdevicesinc/wiki-scripts/main/linux/build_nios2_kernel_image.sh && \
chmod +x build_nios2_kernel_image.sh && \
./build_nios2_kernel_image.sh

The script will:

  • Clone the ADI kernel repository

  • Download the Nios2 GCC toolchain

  • Compile the kernel

  • Export the zImage and device tree files

Step-by-step

Clone the ADI Linux kernel:

~$
git clone https://github.com/analogdevicesinc/linux.git \
            --no-single-branch --depth=10 \
            -- linux

Checkout the release branch:

~/linux$
git checkout origin/2021_R1 -b 2021_R1

Download the root filesystem:

~/linux$
wget https://swdownloads.analog.com/cse/nios2/rootfs/rootfs.cpio.gz

Set up the cross-compile environment:

~$
export ARCH=nios2
~$
export CROSS_COMPILE=/path/to/nios2-toolchain/bin/nios2-linux-gnu-

Important

Replace /path/to/nios2-toolchain with the actual path to your Nios2 GNU toolchain installation.

Configure and build:

~/linux$
make adi_nios2_defconfig

Copy the appropriate device tree for your hardware:

Carrier + FMC

Device Tree

A10GX + DAQ2

a10gx_daq2.dts

A10GX + DAQ3

a10gx_daq3.dts

A5GT + FMCJESDADC1

a5gt_fmcjesdadc1.dts

Build the kernel:

~/linux$
make zImage