Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aristocrates/ea579917adfcca5751c69b28d84bbae2 to your computer and use it in GitHub Desktop.
Save aristocrates/ea579917adfcca5751c69b28d84bbae2 to your computer and use it in GitHub Desktop.
Quartus Prime Light 17.1 and ModelSim 17.1 for (Gentoo) Linux

Quartus Prime Light 17.1 and ModelSim 17.1 (Starter / Free Edition) for (Gentoo) Linux

This is currently a work in progress translation of dries007's Arch install guide into a Gentoo install guide.

This guide provides an ebuild that you can use to install Quartus Prime (Lite Edition) and ModelSim 17.1 in Gentoo. This guide assumes you have created a local overlay; see this Gentoo guide on making your own overlay. Make sure that repoman is installed.

  • If you don't want to go through all of the formalities of installing through portage, you can just run the shell commands; in this case it might be simpler to refer to the original guide by dries007.
  • However, the advantage of installing this through portage is that the proprietary installation binary runs in portage's sandbox to install into a temporary directory, and then before the files are merged into your actual filesystem portage checks for file conflicts. This means that if the proprietary installation binary breaks something on your system, it will be much more likely to error out (or at least warn you and give you a chance to control-C) instead of silently finishing.
  • Don't use the attached ebuilds as references on how to write ebuilds. I did not attempt to follow best practices, I just needed something that would work quickly.

Quartus Prime 17.1

Download Quartus-lite-17.1.1.593-linux.tar. Note that this will be under "Updates -> Complete Download". Check that the md5sum matches, and then move it to your DISTDIR (i.e. /usr/portage/distfiles).

Ensure that the following permissions are set:

-rw-rw-r-- 1 portage portage 8.1G Apr 10 23:59 /usr/portage/distfiles/Quartus-lite-17.1.1.593-linux.tar

If you know how to add ebuilds to your overlay you can probably do that and then skip to the During Install instructions (you will need to interact with a GUI and disable some options or the install will not work).

In your local overlay make sure sci-electronics/quartus-prime-lite exists and put quartus-prime-lite-<version>.tar in that folder. Then run repoman manifest as root / portage (Quartus-lite-17.1.1.593-linux.tar needs to already be in your DISTDIR for this to work).

If your setup is the same as mine (local overlay at /usr/local/portage, have sudo installed), then the following commands should accomplish this (don't just copy and paste them, execute them one at a time after understanding what they do and changing them according to your own situation):

sudo -u portage -s
mkdir -p /usr/local/portage/sci-electronics/quartus-prime-lite
cp <wherever you put quartus-prime-lite-17.1.1.593.ebuild> \
   /usr/local/portage/sci-electronics/quartus-prime-lite-17.1.1.593.ebuild
# now go back to your user
exit
sudo repoman manifest

Then

sudo emerge -a =sci-electronics/quartus-prime-lite-17.1.1.593

During Install

A GUI window will pop up after it unpacks and starts running.

You need to accept the license to install. Keep the install path the same (should be something like /var/tmp/portage/<package>/otherstuff). If you change it, the ebuild will not work.

When you see the prompt for the components to install, you must disable the following components:

  • Help (near the top)
  • ModelSim (near the bottom)

If you do not disable these components, the installer will hang. ModelSim will be installed separately later.

You can also pick and choose which FPGA boards to install support for at this step.

If you followed the above instructions, the installer should finish successfully and the emerge command will finish. Quartus Lite will now be installed in /opt/quartus-lite-17.1.1.593.

ModelSim 17.1

Also note that there is a bug with the installer that causes the installation to hang at the end; there is no way to work around this other than killing the program manually, whether you manually install or use the ebuild.

You need to download the setup file yourself Easy DL link. I recommend checking the md5sum after it finished downloading. Place it in your DISTDIR (i.e. /usr/portage/distfiles).

Then, download dries007's libfreetype tarfile and put it in your DISTDIR.

Ensure that the following permissions are set:

-rw-rw-r-- 1 portage portage 1.2G Apr 17 23:16 /usr/portage/distfiles/ModelSimSetup-17.1.0.590-linux.run
-rw-rw-r-- 1 portage portage 460K Apr 18 08:30 /usr/portage/distfiles/lib32-freetype2-2.5.0.1.tar.xz

Then follow more or less the same instructions as for Quartus to make sci-electronics/quartus-prime-lite-modelsim and add quartus-prime-lite-modelsim-17.1.0.590.ebuild to your local overlay.

Run emerge:

emerge -a =sci-electronics/quartus-prime-lite-modelsim-17.1.0.590

During install

You will need to manually kill the ModelSim installer or emerge will never finish. To do this, wait for your computer fan / CPU usage to abruptly die down, then run ps aux | grep ModelSim (or in some other way get the PID of the installer process), and then run kill <the PID number you found> as root (don't kill the emerge process, just the ModelSim installer). The emerge command should then finish and you should be able to run ModelSim with /opt/quartus-prime-lite-modelsim-17.1.0.590/modelsim_ase/bin/vsim. Or, if you want to use ModelSim in Quartus, proceed to Setting ModelSim path in Quartus near the bottom.

Manual installation into your home directory (~/intelFPGA/17.1 in this guide, replace this with whatever you want)

  1. Install dependencies (both 32 and 64 bit is required, the use flag is abi_x86_32 in package.use)
    • Note that unless otherwise stated, these might be named something different in Gentoo, since these are just the names taken from the Arch guide
    • 64 bit: expat fontconfig freetype2 xorg-fonts-type1 glibc gtk2 libcanberra libpng libpng12 libice libsm util-linux ncurses tcl tcllib zlib libx11 libxau libxdmcp libxext libxft libxrender libxt libxtst
    • 32 bit lib32-expat lib32-fontconfig lib32-freetype2 lib32-glibc lib32-gtk2 lib32-libcanberra lib32-libpng lib32-libpng12 lib32-libice lib32-libsm lib32-util-linux lib32-ncurses lib32-zlib lib32-libx11 lib32-libxau lib32-libxdmcp lib32-libxext lib32-libxft lib32-libxrender lib32-libxt lib32-libxtst
    • ncurses 5 must be installed: in Gentoo this means install /usr/portage/sys-libs/ncurses/ncurses-5.<INSERT CURRENT VERSION>
  2. Run setup file, from console, install in default location (~/intelFPGA/17.1) The setup hangs after completing. To kill it, wait until you are pretty sure it is done (your computer's fan will probably abruptly calm down / your CPU usage will go down), and then do something like this: run ps aux | grep ModelSim and you should find one process (the hanging installer). Run kill <the PID number you found> as root.
  3. Get lib32-freetype2-2.5.0.1 and unpack libs to ~/intelFPGA/17.1/modelsim_ase/lib32
  4. Modify the startup script (~/intelFPGA/17.1/modelsim_ase/vco)
    • Replace linux_rh60 with linux
    • Add LD_LIBRARY_PATH=${dir}/lib32 after $dir is set

Setting ModelSim path in Quartus

Open Quartus and click on Tools --> Options, and then in the window that pops up go to EDA Tool Options. In ModelSim-Altera put /opt/quartus-prime-lite-modelsim-17.1.0.590/modelsim_ase/bin and click OK.

# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit eutils
DESCRIPTION="Full-featured EDA product for altera devices"
HOMEPAGE="https://www.altera.com/products/design-software/fpga-design/quartus-prime/overview.html"
SRC_URI="Quartus-lite-${PV}-linux.tar"
# variable to store the download URLS
DOWNLOADPAGE="http://dl.altera.com/?edition=lite"
LICENSE="Quartus-prime-megacore"
SLOT="0"
KEYWORDS="~amd64"
RDEPEND="media-libs/libpng:1.2[abi_x86_32]
x11-libs/libXft[abi_x86_32]
app-arch/bzip2[abi_x86_32]
sys-libs/zlib[abi_x86_32]
sys-libs/glibc[multilib]"
RESTRICT="fetch bindist"
S=${WORKDIR}
pkg_nofetch() {
elog "Due to licensing restrictions, and old libary versions."
elog "You need to download the distfiles manually."
elog "-------------------------------------------------------"
elog "For Quartus :"
elog "Please navigate to ${DOWNLOADPAGE}"
elog "Sign in with your Altera account (you need to register)"
elog "Download Quartus-lite-${PV}-linux.tar and place it into ${DISTDIR}"
elog "-------------------------------------------------------"
elog "And restart the installation."
}
pkg_pretend() {
einfo "The checksum and unpack will take quite some time to run"
}
src_install() {
einfo "The Quartus install does not run in unattended mode"
einfo "so you will need to interact with a GUI window that pops up"
einfo "You must disable the 'Help' and 'ModelSim' options"
einfo "when picking components to install."
einfo "Otherwise the installer will hang and never finish"
./setup.sh --installdir "${D}/opt/quartus-lite-${PV}"
}
pkg_postinst() {
elog "To launch Quartus, run /opt/quartus-lite-${PV}/quartus/bin/quartus"
}
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit eutils
DESCRIPTION="FPGA Model Simulator"
HOMEPAGE="https://www.altera.com/products/design-software/fpga-design/quartus-prime/overview.html"
SRC_URI="ModelSimSetup-${PV}-linux.run
https://dl.dries007.net/lib32-freetype2-2.5.0.1.tar.xz"
# variable to store the download URLS
DOWNLOADPAGE="http://dl.altera.com/?edition=lite"
DOWNLOADFT="https://dl.dries007.net/lib32-freetype2-2.5.0.1.tar.xz"
LICENSE="Quartus-prime-megacore"
SLOT="0"
KEYWORDS="~amd64"
RDEPEND="media-libs/libpng:1.2[abi_x86_32]
x11-libs/libXft[abi_x86_32]
app-arch/bzip2[abi_x86_32]
sys-libs/zlib[abi_x86_32]
sys-libs/glibc[multilib]
sys-libs/ncurses:5[abi_x86_32]"
RESTRICT="fetch bindist"
S=${WORKDIR}
pkg_nofetch() {
elog "Due to licensing restrictions, and old libary versions."
elog "You need to download the distfiles manually."
elog "-------------------------------------------------------"
elog "For Quartus :"
elog "Please navigate to ${DOWNLOADPAGE}"
elog "Sign in with your Altera account (you need to register)"
elog "Download ModelSimSetup-${PV}-linux.run and place it into ${DISTDIR}"
elog "-------------------------------------------------------"
elog "For Freetype libary :"
elog "Please download the following file :"
elog "${DOWNLOADFT}"
elog "Please place this into ${DISTDIR}"
elog "-------------------------------------------------------"
elog "And restart the installation."
}
src_unpack() {
# just copy the file to work
cp ${DISTDIR}/ModelSimSetup-${PV}-linux.run ${WORKDIR}/ModelSimSetup-${PV}-linux.run
# need to set executable permissions
chmod +x ${WORKDIR}/ModelSimSetup-${PV}-linux.run
# now copy the old libfree type
cp ${DISTDIR}/lib32-freetype2-2.5.0.1.tar.xz ${WORKDIR}/lib32-freetype2-2.5.0.1.tar.xz
}
src_install() {
einfo "The ModelSim installer has a bug that prevents"
einfo "the installer from finishing"
einfo "To work around this, there is no || die in the ebuild"
einfo "so you should wait until things stop happening in the"
einfo "install directory, then run ps aux | grep ModelSim"
einfo "and run 'kill <PID number>' as root"
einfo "The install will continue normally after that"
# https://gist.github.com/dries007/36c31fb8b2d712dfb41c6709f16e6e66
./ModelSimSetup-${PV}-linux.run --installdir "${D}/opt/${PF}" \
--modelsim_edition modelsim_ase --accept_eula 1 --mode unattended
sed -i 's/linux_rh60/linux/' ${D}/opt/${PF}/modelsim_ase/vco || die
sed -i 's/dir=`dirname "$arg0"`/dir=`dirname "$arg0"`\nexport LD_LIBRARY_PATH=${dir}\/lib32/' ${D}/opt/${PF}/modelsim_ase/vco || die
tar xf lib32-freetype2-2.5.0.1.tar.xz -C ${D}/opt/${PF}/modelsim_ase/ || die
}
pkg_postinst() {
elog "To launch ModelSim, run /opt/${PN}/modelsim_ase/bin/vsim"
ewarn "This ebuild bundles a vulnerable and old freetype library"
ewarn "Sadly this is needed for vsim. You have been warned"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment