Quartus for Linux

From Altera Wiki
Jump to: navigation, search


Altera Design Software

Altera removed 64-bit support in the 11.0 version of Quartus II. This is not a problem, but they did not check to make sure that Quartus worked correctly. If you get errors about 64-bit support not working because the "linux64" version of Quartus was not installed, the fix is simple. Navigate to the location you installed Quartus (for me, it was ~/altera/11.0/quartus) and execute the following command:

ln -s linux linux64

This creates a symbolic link for the "linux" directory called "linux64". Once this is done, everything seems to work again.

Quartus 9.1 SP1 will work on the following operating systems and versions:

  • Red Hat Enterprise Linux 5 (32 bit & 64 bit)
  • Red Hat Enterprise Linux 4 (32 bit & 64 bit)
  • SUSE 9 Enterprise Linux
  • CentOS 5

You may find step by step guide on Linux installation and usage from Redhat document.

If you are new to Linux, it is suggested that you start with Centos5 i386 32bit distro. It is possible to use other Linux distros, though it might take some effort. The procedures described here work with Ubuntu 8.04, Fedora 10, CentOS 5 and Suse 10.3. (see fix below)

Setup Dependencies / Hardware

Make sure you have tcsh isntalled, otherwise install it, as root or via sudo

On Fedora,RHEL/Centos, yum install tcsh

On Suse, zypper install tcsh

On Debian/Ubuntu, check if the default shell is "bash" , (the default might be "dash", which won't work with install scripts). To check:

 sudo dpkg-reconfigure dash

and make sure that dash is NOT the default shell.

(old info: On Debian/Ubuntu, (via sudo) apt-get install tcsh -- why?)

Download Quartus

Visit the Altera website and the embeded design suites. An Altera account is needed in order to download the files.

Download the linux versions and you should end up with the following files

  • 91sp1_quartus_free_linux.tar
  • 91sp1_modelsim_ase_linux.tar
  • 91_nios2eds_linux.tar
  • 91sp1_nios2eds_linux.tar

all in one directory. Be sure to grab the service pack files as well. The modelsim service pack is standalone so you don't need to download the modelsim 9.1 file just the service pack.

Now extract these files as follows:

tar xvf 91sp1_quartus_free_linux.tar
tar xvf 91sp1_modelsim_ase_linux.tar
tar xvf 91_nios2eds_linux.tar
mkdir nios2eds_sp1
tar -C nios2eds_sp1 -xvf 91sp1_nios2eds_linux.tar

Install Quartus

For Debian Wheezy see: www.alterawiki.com/wiki/Quartus_for_Debian_Wheezy

Next install these programs all to the same base directory. Quartus and modelsim have the sp1 service pack built in while nios2eds doesn't so for that you need to override the default directory and instead install to /opt/alter9.1sp1. Run the commands using sudo or as root.


This will install the programs in the following default directories :

Quartus       = /opt/altera9.1sp1/quartus
IP Megacore   = /opt/altera9.1sp1/ip
Nios II EDS   = /opt/altera9.1sp1/nios2eds
Modelsim      = /opt/altera9.1sp1/modelsim

(Ed., we don't need "9.1sp1" numbered for each subdir when the parent dir already spelled it. while "nios2eds" and "ip" are more officially used by Altera.)

Setup Licence

If you have a valid license file, it should be /opt/licenses/license.dat, and begin with

SERVER localhost <your nic> 1800
VENDOR alterad "/opt/altera9.1sp1/quartus/linux/alterad"
VENDOR mgcld "/opt/altera9.1sp1/modelsim/modeltech/linuxaloem/mgls/lib/mgcld"

The license server will only recognize the NIC ID (MAC address) of interfaces named "ethn", i.e., "eth0", "eth1", and so on. You can change the name of your interface by modifying the file: "/etc/udev/rules.d/70-persistent-net.rules" and reboot. In "/etc/udev/rules.d/70-persistent-net.rules" add the following line:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Replace "xx:xx:xx:xx:xx:xx" with MAC address for the interface. To work around this problem for Centos7, the following site is more comprehensive: Change interface names back to eth0, eth1 on Centos7.

Even if you don't have the license to run quartus, you can still use other tools (such as jtag download and jtag debugger) for software development. Just ignore the license manager.

Setup JTAG

The jtag port USB Blaster needs usbfs to work. On Ubuntu/Suse, add/edit the following line in the file /etc/fstab.

usbfs /proc/bus/usb usbfs devmode=0666 0 0

This will automatically mount the usbfs to the location /proc/bus/usb on startup. The mode will be set to 0666 which means that everyone can read/write the files that are created there. Once the line has been added to /etc/fstab, you can mount the file system by entering the command

sudo mount /proc/bus/usb

You could also restart your system if that's easier.

Then prepare data for jtag server. As root or via sudo. mkdir /etc/jtagd cp /opt/altera9.1sp1/quartus/linux/pgm_parts.txt /etc/jtagd/jtagd.pgm_parts

Add these lines to /etc/rc.local to start license manager and jtag server. As root or via sudo.

echo 356 40000 32 32000 > /proc/sys/kernel/sem
/opt/altera9.1sp1/quartus/linux/lmgrd -c /opt/licenses/license.dat

(You may need to reboot, or you can run these command lines to start these servers)

Next, create an empty file in your home directory named “.jtag.conf ”.

touch ~/.jtag.conf

Setup NIOS Shell

Find out your system perl path. This is because the Altera perl lib didn't have all the modules reuqired to process PTF file. eg,

/usr/lib/perl5/5.10.0 on Fedora10, /usr/lib/perl5/5.8.8 on Centos5.

Login as a user. Put these lines in a script file , say "n2sdk", in ~/bin dir. Remember "chmod +x n2sdk".

#!/bin/bash<br style="color: rgb(0, 0, 0);" /># Run this for a Nios II SDK bash shell<br style="color: rgb(0, 0, 0);" />export LM_LICENSE_FILE=1800@localhost<br style="color: rgb(0, 0, 0);" />SOPC_KIT_NIOS2=/opt/altera9.1sp1/nios2eds<br style="color: rgb(0, 0, 0);" />export SOPC_KIT_NIOS2<br style="color: rgb(0, 0, 0);" />SOPC_BUILDER_PATH_91=/opt/altera9.1sp1/nios2eds<br style="color: rgb(0, 0, 0);" />export SOPC_BUILDER_PATH_91<br style="color: rgb(0, 0, 0);" />unset GCC_EXEC_PREFIX<br style="color: rgb(0, 0, 0);" />QUARTUS_ROOTDIR=/opt/altera9.1sp1/quartus<br style="color: rgb(0, 0, 0);" />export QUARTUS_ROOTDIR<br style="color: rgb(0, 0, 0);" />export PERL5LIB=/usr/lib/perl5/5.8.8
bash --rcfile $QUARTUS_ROOTDIR/sopc_builder/bin/nios_bash

Run Software

Open a shell terminal, enter "n2sdk". This will open a Bourne-again shell (bash) with a pre-configured environment.


Welcome To Altera SOPC Builder

Version 9.1sp1, Built Tue Oct 28 11:01:00 PDT 2008

Welcome to the Nios II Embedded Design Suite
Version 9.1sp1, Built Tue Oct 28 11:27:40 PDT 2008

Example designs can be found in

(You may add a startup script: /opt/altera9.1sp1/nios2eds/user.bashrc)

[NiosII EDS]$

Now you can run quartus, just enter "quartus" in this command shell.

[NiosII EDS]$ quartus

If quartus ask you the license file for the first run, enter "1800@localhost" .

You can find more usage of command line tools on section 2-4 of <a name="edh_ed_handbook.pdf" href="http://altera.com/literature/hb/nios2/edh_ed_handbook.pdf">Embedded Design Handbook (highly recommended reading).

Now, you can install nios2gcc tools and uClinux-dist. Build the uClinux kernel image.

Then plug in your USB Blaster, connect to your dev board (2C35 here). You can try out the jtag port.

[NiosII EDS]$ jtagconfig

1) USB-Blaster [USB 5-1.2]
  020B40DD   EP2C35
[NiosII EDS]$ nios2-configure-sof
Info: *******************************************************************
Info: Running Quartus II Programmer
Command: quartus_pgm --no_banner --mode=jtag -o
Info: Using programming cable "USB-Blaster [USB 5-1.2]"
Info: Started Programmer operation at Fri Dec  8 11:35:01 2006
Info: Configuring device index 1
Info: Device 1 contains JTAG ID code 0x020B40DD
Info: Configuration succeeded -- 1 device(s) configured
Info: Successfully performed operation(s)
Info: Ended Programmer operation at Fri Dec  8 11:35:04 2006
Info: Quartus II Programmer was successful. 0 errors, 0 warnings
    Info: Processing ended: Fri Dec  8 11:35:04 2006
    Info: Elapsed time: 00:00:22
[NiosII EDS$ nios2-download -g ~/uClinux-dist/images/zImage
Using cable "USB-Blaster [USB 5-1.2]", device 1, instance 0x00
Pausing target processor: OK<br style="color: rgb(0, 0, 0);" />Initializing CPU cache (if present)<br style="color: rgb(0, 0, 0);" />OK<br style="color: rgb(0, 0, 0);" />Downloaded 1016KB in 16.2s (62.7KB/s)<br style="color: rgb(0, 0, 0);" />Verified OK
Starting processor at address 0x04500000
[NiosII EDS$ nios2-terminal
nios2-terminal: connected to hardware target using JTAG UART on cable
nios2-terminal: "USB-Blaster [USB 5-1.2]", device 1, instance 0
nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)
Uncompressing Linux... Ok, booting the kernel.
Linux version 2.6.Uncompressing Linux... Ok, booting the kernel.<br style="color: rgb(0, 0, 0);" />Linux version 2.6.17-uc1 (hippo@darkstar) (gcc version 3.4.6) #46 

PREEMPT Thu Dec 7 15:22:06 CST 2006

You can try out flash programmer, or add flash file conversion to your build script. Or run GDB debugger.

Happy hacking.

Miscellaneous Fixes

  1. If the Nios II EDS installer does not work, edit the install script at line 143 :
    From : x=${x/~/$HOME}
    To  : ##x=${x/~/$HOME}
  2. If the modelsim installer doesnt work, edit the install.ms script :
    At line 172 :
    From  : tar xfo {$script_path}/modeltech_altera_unix.tar
    To  : tar xfo {$script_path}/modeltech_altera_unix.tar --no-same-permissions
    At line 174 :
    From  : tar xfo {$script_path}/modeltech_altera_unix.tar $file1.Z $file2.Z $file3.Z
    To  : tar xfo {$script_path}/modeltech_altera_unix.tar $file1.Z $file2.Z $file3.Z --no-same-permissions
  3. If the SOPC builder keeps giving language error (minor problem). This is an issue with Perl. To fix it, type this in a terminal :
    cd /usr/lib/locale
    cp -r en_US.utf8 en_US
  4. To fix the “Unknown Linux Processor” issue, download the file '<a href="/@api/deki/files/44/=arch">arch' and put it in /bin. You will need administrator access to do this.
  5. Sometimes the Licences in Quartus menu will not open. This can be solved by copying the provided file '<a href="/@api/deki/files/46/=libX11.so.6.2">libX11.so.6.2' into/opt/altera7.2/quartus/linux. You will need administrator privileges. Then type this in a terminal:
    cd /opt/altera7.2/quartus/linux
    sudo ln -s libX11.so.6.2 libX11.so.6
  6. Sometimes the compilation may hang at the completion of one step in Quartus , (which might be caused by RPC bug). You can use command lines, in a shell script or Makefile.
    quartus_map $*
    quartus_fit $*
    quartus_asm $*
    quartus_sta $*

Old Info (Outdated)

To Install Quartus 8.1 look here: Quartus 8 for Linux

The version of Linux distro is important. Some latest distro use udev, and need extra hacking, see [on unsupported distributions]. Though it is possible to use other Linux disto or version, it might be difficult for newbies.

To install Altera Design Software 7.2 in Ubuntu Linux, follow this step by step tutorial : Media:Altera_Software_Installation_Tutorial_for_Ubuntu.pdf_document Altera Software Installation Tutorial for Ubuntu

This tutorial show how to install all the tools including setting up usbfs for USB blaster. It might also apply for other Linux distros based on Debian.


Personal tools