Linux Build Environment Configuration

Linux Distribution Selection

Intel SoCs require us to use Quartus Prime.  Quartus Prime is currently supported by Ubuntu 16.04 LTS, so that’s the flavor of Linux that will be used for the purposes of this class.

Using the TerminaL

Before we get into installing the required software packages required to compile the Linux kernel and build a file system, you will need to access the Terminal application provided by Ubuntu.  The Terminal is a command line interface used to issue commands in Linux.  You can access the Terminal by clicking on the Ubuntu Launcher and typing “Terminal”.

terminal_launch

 I would suggest right clicking on the terminal and Locking it to the Launcher.

Linux Kernel Development Setup

Building the Linux kernel requires several multiple software utilities.  We will install these utilities using the apt package managerapt is the command line interface for installing software in Ubuntu.  When installing software, we will need to use the sudo (Super User Do) command.  sudo allows you to run a command with super user privileges.  

From the Terminal, issue the following commands:

sudo apt install lib32ncurses5 -y
sudo apt install qemu-user-static -y
sudo apt install git pv -y
sudo apt install libncurses5-dev -y
sudo apt-get install -y chrpath gawk texinfo libsdl1.2-dev whiptail diffstat cpio libssl-dev bison flex

ARM Cross Compiler Installation

Most Linux build environments run on an x86 based CPU.  The C compiler supplied by your Linux distribution compiles C code into x86 machine level instructions.  The Intel SoC is based off of an ARM core, so x86 machine instructions are not going to do us a whole lot of good.  We need a compiler that runs on an x86 platform, but converts C code into ARM machine level instructions.  A compiler that runs on one processor architecture (x86) but produces machine code for a different architecture is called a cross compiler.  Luckily for us, we can easily download a compiler that does just that for us.

The following commands download an ARM cross compiler and place it in the /opt directory

cd /opt
sudo wget https://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/arm-linux-gnueabihf/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf.tar.xz
sudo tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf.tar.xz

Once you have run these commands, you can use the following command to confirm that the cross compiler was installed correctly.  The compiler version number should be listed at the end of the output : gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11) 

/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -v

After you have installed the ARM cross compiler, we are going to set up a symbolic link to make accessing the cross compiler a bit easier.

cd /opt
sudo ln -s gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf arm-linux-gnueabihf

 Modifying .bashrc

Lets modify our BASH profile so that our Linux build environment can access the cross compiler.  Using your favorite editor, add the following lines to the end of your .bashrc file.

export PATH=$PATH:/opt/arm-linux-gnueabihf/bin

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export BR2_TOOLCHAIN_EXTERNAL=/opt/arm-linux-gnueabihf

bind '"e[A": history-search-backward'
bind '"e[B": history-search-forward'

The first export directive will allow you to access the cross compiler from the command line without having to fully qualify the path.

The second and third export commands are common arguments that are required to compile the Linux kernel.  If we do not set these, then you will have to supply them every time that you build the kernel.

The bind commands are not required to build the Linux kernel, but they allow you to quickly search the command line history.  If you type ln on the command line, and then press the up arrow, it will cycle through only commands that start with an ln.

Quartus Prime Install

You will now need to install Quartus Prime.  To do this, download the Quartus Prime Lite Edition.  We are going to use the newest version, 18.0.  If you do not have an Intel account, you will need to create one before you can download the installer.

Once the installer has been downloaded, use the following commands to install Quartus Prime.

cd ~/Downloads
tar -xf Quartus-lite-18.0.0.614-linux.tar
./setup.sh

Use the default location for the installation.  When it comes to selecting which devices to install, install only the Cyclone 5.  Be sure to keep ModelSim Starter Edition selected as well.

quartusinstall_cyclone5

 

Installing Intel SoC FPGA Embedded Design Suite

In addition to Quartus, we will also need to install the Intel SoC EDSBe sure to install the standard version, not the Pro!

You can run the following commands to install the Intel SoC EDS

cd ~/Downloads
chmod +x SoCEDSSetup-18.0.0.614-linux.run
./SoCEDSSetup-18.0.0.614-linux.run

Be sure to change the installation path to match the location where you installed Quartus.

eds_install

 

After a while, the installer will open a terminal window and ask you if you want to continue with the installation of the There will be an additional pop up window that will ask you if you want to continue the installation of EDS.  You can select the default (Abort the installation).

You will also want to add the following line to your .bashrc

export QSYS_ROOTDIR=/home/ece453/intelFPGA_lite/18.0/quartus/sopc_builder/bin/

Installing Missing Dependencies

We now need to install some missing dependencies for Ubuntu.

cd ~/Downloads
wget http://infocenter.arm.com/help/topic/com.arm.doc.faqs/attached/14522/ds-deps-ubuntu_64.sh
chmod +x ds-deps-ubuntu_64.sh
sudo ./ds-deps-ubuntu_64.sh