Project

General

Profile

Installation Guide

Operating system requirements

The only supported operating system is SLF6 (64-bit). Currently we are using "Scientific Linux Fermi release 6.7 (Ramsey)".

The following packages must be installed that are not always included in the default installation:

  • screen
  • gcc-c++
  • boost-devel
  • python-devel
  • PyQt4-devel
  • bzip2-devel
  • libzip-devel
  • zlib-devel
  • libxml2-devel
  • libxslt-devel
  • libcurl-devel
  • ncurses-devel
  • mysql-devel
  • mysql-server (if you want to host a local slow control database for testing)
  • tcsh
  • gtkterm (needs epel repo)
  • libX11-devel
  • libXpm-devel
  • libpng-devel
  • ipmitool
  • fftw-devel
  • readline-devel

Install packages on SLF6 as root using:

yum install <package name>

For those in non-standard repositories, use:

yum --enablerepo=<repo name> install <package name>

e.g. for gtkterm.

yum --enablerepo=epel install gtkterm

Also need the following python packages:

yum --enablerepo=epel install python-pip
pip install --upgrade pip
easy_install argparse
pip install 'pyserial==2.6'
pip install --upgrade nose
pip install 'numpy==1.4.1'
pip install 'matplotlib==1.4.1'
pip install Flask
pip install lxml
pip install --upgrade pyflakes
pip install MySQL-python
pip install -U https://github.com/google/google-visualization-python/zipball/master
wget http://www.decalage.info/files/HTML.py-0.04.zip
unzip HTML.py-0.04.zip
cd HTML.py-0.04
python setup.py install
pip install beautifulsoup4

If you don't have easy_install, get it with:

wget https://bootstrap.pypa.io/ez_setup.py
python ez_setup.py

If this fails with "certificate common name ... doesn't natch requested host name" errors (on older systems, including SLF6.5), instead use:

wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
python ez_setup.py --insecure

Note that we are using python 2.6.

Dependency installation

The following is a list of dependencies of gm2trackerdaq that must be installed.

By the time you're done the contents of your installation directory should look something like this:

amc13
gm2daq
gm2daq-gm2ipbus
gm2midas
gm2trackerdaq
root_v5.34.14_gcc_v4.4.7
fc7_4.7.0

Note that you need a FNAL kerberos principal set up for any git clone commands.

ROOT

Example configure:

./configure linuxx8664gcc --enable-mysql --enable-qt --enable-python --enable-fftw3

IPBus

Example (uses tag uhal_2_4_0):

cd <your install directory>
git clone ssh://p-gm2daq@cdcvs.fnal.gov/cvs/projects/gm2daq-gm2ipbus
cd gm2daq-gm2ipbus
sh scripts/user/install_tag.sh . uhal_2_4_0

Note that this is slow. Currently a few errors appear towards the end related to link file for some of the binaries. These don't seem to cause a problem, but will be fixed soon.

MIDAS

Example (assumes 64 bit system):

cd <your install directory>
git clone ssh://p-gm2midas@cdcvs.fnal.gov/cvs/projects/gm2midas
cd gm2midas/midas
export MIDASSYS=`pwd`
make
ln -s linux/ linux64

AMC13 code

gm2daq

Example:

cd <your install directory>
git clone ssh://p-gm2daq@cdcvs.fnal.gov/cvs/projects/gm2daq
cd gm2daq
git checkout develop

fc7

Install the FC7 package from svn :

svn co https://svn.cern.ch/reps/ph-ese/be/fc7/tags/fc7_4.7.0 --username=username --password=password

gm2trackerdaq installation

Checkout the repository

Information on getting the repo gm2trackerdaq can be found here .

Setting the gm2trackerdaq environment

The script that sets up the environment for compiling and running the DAQ code is gm2trackerdaq/software/setup.sh. It parses a particular .env file that contains a list of environment variables specific to your host, so you must create this file for your host.

To do so follow the steps below:

1) Copy an existing .env file (I recommend environment-gm2straw6.fnal.gov.env) to create your own one, calling it environment-<your host>.env (where <your host> must match the output of "uname -n". See example below:

cd gm2trackerdaq/software/cfg
cp environment-gm2straw6.fnal.gov.env environment-`uname -n`.env

You can see the example file here: https://cdcvs.fnal.gov/redmine/projects/gm2trackerdaq/repository/changes/software/cfg/environment-gm2straw6.fnal.gov.env?rev=productionDAQ

2) Edit your new .env file so that the paths match your system (in particular where you have installed all dependencies).

Some of the more important variables:

  • TODO

Once this is all configured, you can set your environment using:

cd gm2trackerdaq/software
source setup.sh

This should be done after each new login.

An example output is:

Project top-level: /unix/muons/g-2/scratch/tom/proddaq/online/gm2trackerdaq
OS type: linux64
Using env file /unix/muons/g-2/scratch/tom/proddaq/online/gm2trackerdaq/software/cfg/environment-daq1.hep.ucl.ac.uk.env
Setting environment on daq1.hep.ucl.ac.uk...
ROOT environment set
uHAL (IPBus) environment set
AMC13 environment set
MIDAS environment set
gm2trackerdaq setup complete

If you see >>ERROR<< in the output you have a serious problem and you won't be able to build/run gm2trackerdaq.

If you see >>WARNING<< in the output you will be able to build/run some of gm2trackerdaq. The output should indicate what you can and can't do, and you can decide if this is an issue for you.

Building gm2trackerdaq

Build gm2trackerdaq according to these instructions:

source gm2trackerdaq/software/setup.sh (if not done already)
cd $GM2TRACKERDAQ_DIR/software
make clean
make

Everything should now be built and ready to go. See gm2trackerdaq user guide for more info.

Slow control SQL database

This section is not mandatory, skip unless you know you want to run a mySQL server.

Presently we are using mySQL and accessing the database via the ROOT TSQLServer class. To setup the mySQL database locally for testing do the following:

As root (i.e. after "ksu" on FNAL machines)

service mysqld start
/usr/bin/mysql_secure_installation
Hit return for the mysql root (note not su root) password and then set the mysql root password as: gm2_t1042
- Remove anonymous users? [Y]
- Disallow root login remotely? [Y]
- Remove test database and access to it? [Y]
- Reload privilege tables now? [Y]

mysql -u root -p 
mysql> create database gm2sc;
mysql> use gm2sc;
mysql> grant usage on *.* to gm2user@localhost identified by 'alpha_2pi';
mysql> grant usage on *.* to gm2user@192.168.0.1 identified by 'alpha_2pi';
mysql> grant usage on *.* to gm2user@127.0.0.1 identified by 'alpha_2pi';
mysql> use mysql
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE ON gm2sc.* to gm2user@localhost;
mysql> quit

cd /home/nfs/gm2/mtest/daq/gm2trackerdaq/software/bin
# Create the schema (blank tables)
mysql --user=gm2user --password=alpha_2pi gm2sc < setup-slow-control-dbSchema.sql
# Test the ROOT interface
cd /home/nfs/gm2/mtest/daq/gm2trackerdaq/software
source setup.sh 
root -l
 root> .x test_db.C
 root> quit

This will setup the database with the required tables and the test_db.C will populate a couple of the tables with dummy data in order
to check the client connection (via ROOT) is OK.

USB setup for the LV ardiuno and USB slow control (FTDI chip) cable

As root you need to install/modify the following files:
  • /etc/udev/rules.d/99-arduino.rules
    # Arduino Micro
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="8037", ATTRS{idVendor}=="2341", MODE:="0666" 
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="8037", ATTRS{idVendor}=="2341", RUN+="/sbin/modprobe cdc_acm
    " 
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="8037", ATTRS{idVendor}=="2341", RUN+="/bin/sh -c 'echo 0x234
    1 0x8037 > /sys/bus/usb/drivers/cdc_acm/new_id'" 
    
    # Arduino Uno for old LV
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="0043", ATTRS{idVendor}=="2341", MODE:="0666" 
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="0043", ATTRS{idVendor}=="2341", RUN+="/sbin/modprobe cdc_acm
    " 
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="0043", ATTRS{idVendor}=="2341", RUN+="/bin/sh -c 'echo 0x234
    1 0x0043 > /sys/bus/usb/drivers/cdc_acm/new_id'" 
    
    # Arduino Uno for Humidity/Temperature sensor
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="0043", ATTRS{idVendor}=="2a03", MODE:="0666" 
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="0043", ATTRS{idVendor}=="2a03", RUN+="/sbin/modprobe cdc_acm" 
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="0043", ATTRS{idVendor}=="2a03", RUN+="/bin/sh -c 'echo 0x2341 0x0043 > /sys/bus/usb
    /drivers/cdc_acm/new_id'" 
    
  • /etc/udev/rules.d/99-libftdi.rules
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0664", GROUP="plugdev" 
    
  • /etc/udev/rules.d/99-usbtty.rules
    ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="666" 
    ATTRS{idVendor}=="103e", ATTRS{idProduct}=="0460", MODE="666" 
    

Then trigger these with

udevadm trigger

or simply unplug and plug the USB cable.

Xilinx setup

Xilinx_LabTools_14.6_P.68d_3.tar is in /unix/muons/g-2. Unpack this to your machine.

tar -xvf Xilinx_LabTools_14.6_P.68d_3.tar
cd Xilinx_LabTools_14.6_P.68d_3
./xsetup

—> only tick-box for the install onf “USB Cable Drivers” (ie not the license management/webpack)

Get fxload.rpm. As root

scp ucl:/etc/yum.repos.d/atrpms.repo /etc/yum.repos.d/.
scp ucl:/etc/pki/rpm-gpg/RPM-GPG-KEY-atrpms /etc/pki/rpm-gpg/.
yum --enablerepo atrpms-stable install fxload

Update /etc/udev/rules.d/xusbdfwu.rules to be

ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0008", MODE="666" 
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0007", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusbdfwu.hex -D $tempnode" 
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0009", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xup.hex -D $tempnode" 
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="000d", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D $tempnode" 
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="000f", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xlp.hex -D $tempnode" 
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0013", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D $tempnode" 
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0015", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xse.hex -D $tempnode" 

Plug in jtag, you should see upon issuing "lsusb"

Bus 001 Device 010: ID 0403:6014 Future Technology Devices International, Ltd FT232H Single HS USB-UART/FIFO IC

To load a bitfile, make sure you have XILINX_INIT_SH set in your environment script to point to /home/nfs/gm2/mtest/daq/xilinx-tools/14.6/LabTools/settings64.sh.

Then run ./software/bin/bitfile_load.sh <name of .mcs file>

At UCL, Xilinx labtools are installed in /unix/local.

Arduino setup

Requires two additional RPMs to be installed (as root):

yum --enablerepo=epel install avrdude
yum --enablerepo=epel install arduino

Trouble-shooting

There is some incompatibility between the system version of zlib (used by MIDAS) and the version packaged with IPBus. This can cause link errors like this (e.g. missing symbols in one relative to the other):

/unix/muons/g-2/gm2daq-gm2ipbus/install//tags/uhal_2_4_0//lib/libz.a(zutil.o): In function `zcalloc':
zutil.c:(.text+0x72): undefined reference to `sys_alloc'
/unix/muons/g-2/gm2daq-gm2ipbus/install//tags/uhal_2_4_0//lib/libz.a(zutil.o): In function `zcfree':
zutil.c:(.text+0x98): undefined reference to `sys_free'
collect2: ld returned 1 exit status
make1: *** [/unix/muons/g-2/scratch/tom/productionDAQ/online/gm2trackerdaq/software/bin/StrawTrackerDAQ_frontend.exe] Error 1

We seem to be able to remove this by ensuring that the MIDAS include libs are the first thing in the LIB path, but this needs fixing properly at some point.