Setup notes to run the IARC Server, H2RG, and Aladdin software on bigdogh, guidedog, CentOS 6.x i386

by Tony Denault

Notes on setting up a CentOS 6.4 i386 computer "bigdog" and "guidedog" with 
the IARC controller tools and software.
This was updated from the previous notes when I relocated IARC/ under the bigdog
and guidedog direcotoies in 2014-04-09.

1. Wine and DSP Tools

The DSP tools are needed compile .asm files for iarc. To run these on a
centos computer, you need to install wine.  Wine for is available from EPEL.

Install the EPEL Repository

   Ref: http://www.howtoforge.com/perfect-server-centos-6.3-x86_64-nginx-dovecot-ispconfig-3
        section 7 talked about additional repositories,  I just did the EPEL.

   Download and Install:

      rpm --import https://fedoraproject.org/static/0608B895.txt
      wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
      rpm -ivh epel-release-6-8.noarch.rpm

   install yum priorites:
      yum install yum-priorities

   Edit /etc/yum.repos.d/epel.repo...

      vi /etc/yum.repos.d/epel.repo

      ... and add the line priority=10 to the [epel] section:

      [epel]
      name=Extra Packages for Enterprise Linux 6 - $basearch
      #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
      mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
      failovermethod=priority
      enabled=1
      priority=10
      gpgcheck=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
      [...]

Install Wine

      # yum install wine

   A quick test of wine would be: "wine cmd". This should get you athe DOS prompt. Then exit.

Install DSP Tools in User Account

   From http://www.astro-cam.com/ you will need the Window 56300 Assemblers.
   This is used to compile software on the ARC-22 Timing board. This file
   has  been archived on ~s2/public_html/vendors/arc/software
   We will install the dsp tool to ~/tools/DSP in the s2 user account.

      install -d ~/tools/DSP
		cd ~/tools/DSP
      cp /home/s2/public_html/vendor_info/arc/software/clas563.zip .
      unzip clas563.zip

  For a quick test, this should run the aassembler:
   > wine /home/s2/tools/DSP/clas563/bin/asm56300

2. IARC Source Code

Per CL's email 2013-09-12, the source for iarc is located in  /home/iarc/src/IARC-1.0/
You will need to following from /home/iarc/src/IARC-1.0/
(updated 11-19-2013 - added ALBL_DSP/

  _____APPLICATION___  _________SOURCE_CODE_LOCATION____________________________  _COPY_METHOD__
  ARC66 Device driver  - located in /home/iarc/src/IARC-1.0/DRIVER/astropci       copy
  DSP code for H2RG    - located in /home/iarc/src/IARC-1.0/H2RG/H2RG.DSP.SpeX    hg clone
  DSP code for Aladdin - located in /home/iarc/src/IARC-1.0/ALBL_DSP              hg clone
  IARC Server          - located in /home/iarc/src/IARC-1.0/iarc                  hg clone
                             needs /home/iarc/src/IARC-1.0/cfitsio                copy
                             needs /home/iarc/src/IARC-1.0/ARC_API                hg clone
  WEBGUI               - located in /home/iarc/src/IARC-1.0/WEBGUI                hg clone

  parint device driver - located in /home/iarc/src/IARC-1.0/DRIVER/parint         copy

3. ARC66 Device Driver - BIGDOG and GUIDEDOG

Using vendor driver AstroPCIe3.0_E60_x32.tar.bz2 (archived by iarc)
Installed as user s2

Copy the driver from iarc
   cd ~/current/ic/IARC                          // create the directory if necessary
   cp -Rp /home/iarc/src/IARC-1.0/DRIVER .       // copie device driver code.

Make
   cd ~/current/ic/IARC/DRIVER/astropci/3.0/PCIe/E6.0_x32/
   make clean
   make

Allocating Image Buffer Memory

   You need to block out some RAM from the linux kernal so the driver can use it for image
   memory. Bigdog has 8GB, and on a normal boot 'free -m' reports total 7860.
   I want to block out 128MB.

   I did "dmesg | grep BIOS-e820" to look for usable RAM, and this line:
     BIOS-e820: 0000000020200000 - 0000000040000000 (usable)     start=514M end=1024M   size=510M
   show a big block of RAM at 512M. I put this in /boot/grub/menu.lst:
   "memmap=128M$514M" to block out 128M at 514M.
   After a reboot, free -m total is now 7487 (that's 128M free'ed)

   Notes:
      CL did:  mem=3072M                      on nsf2pc     P45/Q9550CPU/4GB RAM.
               memmap=128M$0x0000000100000000 on nsf2pcbu   B75/i5-2400/8GB RAM      ???
               memmap=320M$0x0000000100000000 on armitag    DELL T5600 (C600/E5-2603/4GB)

   Later had trouble with iarc version 1.0 (only worked when loading iarc_server after
	a fresh reboot), so I took away everything above 3GB on bigdogh (B75/i5-2400/8GB RAM):

      free -m = 7540
      memmap=5606M$3072M           // take away everything above 3GB....
      free -m = 2905

    This worked VERY WELL - computer was stable.

Install driver

   UnLoad_AstroPCIe     // unloaded current driver
   Load_AstroPCIe


4. H2RG DSP Code - BIGDOG only

DSP code for H2RG   - located in /home/iarc/src/IARC-1.0/H2RG/H2RG.DSP.SpeX 
This H2RG.DSP uses hg for source code management.

Clone:
   install -d ~/current/ic/IARC/H2RG                         // create dest dir
   cd         ~/current/ic/IARC/H2RG           
   hg clone ssh://iarc@iarc.ifa.hawaii.edu/src/IARC-1.0/H2RG/H2RG.DSP.SpeX     
Make
   cd ~/current/ic/IARC/H2RG/H2RG.DSP.SpeX 
	tim

Update:
   hg pull      // pull changes from iarc repository to the local repository.
	hg update    // update the local working copy
   
5. Aladdin DSP Code - Guidedog only

DSP code for Aladdin- located in /home/iarc/src/IARC-1.0/ALBL_DSP/
This ALBL_DSP uses hg for source code management.

Clone:
   install -d  ~/current/ic/IARC/                         // create dest dir
   cd          ~/current/ic/IARC/       
   hg clone ssh://iarc@iarc.ifa.hawaii.edu/src/IARC-1.0/ALBL_DSP

Make
   cd  ~/current/ic/IARC/ 
	tim

Update:
   hg pull      // pull changes from iarc repository to the local repository.
	hg update    // update the local working copy

6. IARC Server  - BIGDOG and GUIDEDOG

cfitsio

iarc needs CFITSIO from the IARC tree:

   cd ~/current/ic/IARC/
   cp -Rp /home/iarc/src/IARC-1.0/cfitsio .       // copies cfitsio library (local copy)

   cd ~/current/ic/IARC/cfitsio
   make clean; make

CArcDevice 

iarc needs CArcDevice source from the iarc tree This is a modifed version,
and CArcDev is managed by hg. To clone

   install -d  ~/current/ic/IARC/ARC_API/src/ARC_API/3.0/CArcDevice/
   cd  ~/current/ic/IARC/ARC_API/src/ARC_API/3.0
   hg clone ssh://iarc@iarc.ifa.hawaii.edu/src/IARC-1.0/ARC_API/src/ARC_API/3.0/CArcDevice

iarc_server 

Clone:
   install -d ~/current/ic/IARC/             // create dest dir
   cd         ~/current/ic/IARC/
	hg clone ssh://iarc@iarc.ifa.hawaii.edu/src/IARC-1.0/iarc

Compile:
   cd iarc
   make [iarc_server | al]            // include this in the ic/makefile

HG hints:

   (MAKE CHANGES - now push changes back to iarc)
   hg commit -u bigdog - commit change to your working directory.
   hg push             - upload changes to iarc's repository.

   TO UPDATE YOU COPY WITH NEW IARC CODE:
   hg pull         - pull changes from iarc repository 
   hg update       - to update your local working copy.

7. WebGUI - BIGDOG and GUIDEDOG

WebGUI source is managed by hg. To clone

   install -d ~/current/ic/IARC/
   cd ~/current/ic/IARC/
	hg clone ssh://iarc@iarc.ifa.hawaii.edu/src/IARC-1.0/WEBGUI

8. Parint Device Driver 

Parint is a IRTF written driver for the PC parallel port to timestamp data.
Original code copied from /home/s2/src/drivers/parint.

Copy the driver from iarc
   cd ~/current/ic/IARC/                         // create the directory if necessary
   cp -Rp /home/iarc/src/IARC-1.0/DRIVER .       // copie device driver code.

Make - see the README.html file, or do this:

   cd ~/current/ic/IARC/DRIVER/parint
   make -f makefile.apps clean         // cleans all files
   make                                // makes the driver
   make -f makefile.apps               // makes the test applications

Install

   See the 'manual installation' instruction in the README.html file.