Notes on setup a system to run the IARC software on bigdog/guidedog (CentOS 6.x x64)

Notes on setting up a CentOS 6.3 x86_64 computer with the IARC controller tools and software.
The following software is needed:

   wine - to execute DOS asm compilers.
   DSP Tools - from ARC to compile controller .asm files. (ARC-22 board)
   AstroPCI - PCI board device drivers for ARC-66 PCIe card.
   ARC API - application interface between IRTF code and the PCI device driver.

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 x86_64 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 repositiroies, 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

   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.

      cd
      mkdir tools
      mkdir tools/DSP
      cd    tools/DSP
      cp  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

ARC66 Device Driver

Compile Astro PCIe - PCI card device driver

   You will need to build the device driver for your ARC-66
   From http://www.astro-cam.com/ you will need the AsroPCIe Board Device Drive.
   We use the version 3.5 for Centos 6.x 64 bits archived to
      /home/s2/public_html/vendor_info/arc/software/Arc66PCIe3.5_E6_x64.tar.bz2
   Driver was installed to /home/s2/src/driver

   As 's2', untar it into ~/src/drivers:
      cd
      mkdir src/drivers
      cd    src/drivers
      bzcat /home/s2/public_html/vendor_info/arc/software/Arc66PCIe3.5_E6_x64.tar.bz2 |  tar xvf -
      cd cd astropci/3.5/PCIe/Arc66/src/

   Compile the driver:
      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 7615.
   I want to block out 128MB.

   The driver's READ_ME file has various thing to try, this is what I did. (Oh yeah,  the
   3.5 soruce did not have a READ_ME file, so I used the 3.0 READ_ME).
   Since I have a machine with 8GB of RAM (8192M), It tested the following:
   The READ_ME samples, vs stuff I tried:
      Example                    Tested                      Results
      -------------------        -------------------         ---------------------------
      na                                                     free -m total is 7615
      mem=500M                   mem=8000                    Did not boot: Error 28:Selected item cannot fit into memory
      mem=500M memmap=12M$500M   mem=8000M memmap=128M$8000M Did not boot: Error 28
      mem=500M memmap=12M@500M   mem=8000M memmap=128M@8000M Did not boot: Erorr 28

   Also tried the above exercise with 7000M ... same result: Error 28.

   I did some work with moris and memmap: ref: http://irtfweb/~moris/irtf/OS-setup/1210_andor_linux_sdk.html
   So  here I did used the BIOS-e820 data. 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)

Loading Driver

   Ran Load_Arc64PCI

   It did copy the module to: /lib/modules/`uname -r`/extra
   Said "ls: cannot access /dev/Arc66PCIe*: No such file or directory"
   Module seem to load, but /dev/ nodes were not created, rebooted PC.
   /dev/Arc66PCIe0,1  nodes still not present.

   So I make a simple script called load_arc66 to load the driver and create the device nodes.
      # cp /home/s2/src/drivers/astropci/3.5/PCIe/Arc66/src/load_arc66 /etc/load_arc66
      # vi /etc/rc.local and add:
         /etc/load_arc66
      
   After a reboot, the driver is loaded and /dev/Arc66PCIe0,1 nodes exits.

ARC API

Install the ARC Device Driver Application Interface (API) for Linux 64-bits.
I archived the downloaded ARCAPI3.5_x64src_linux.tar.bz2 file in
/home/s2/public_html/vendor_info/arc/software. The source was untar'ed  to ~/src

   cd ~/src
   bzcat /home/s2/public_html/vendor_info/arc/software/ARCAPI3.5_x64src_linux.tar.bz2 |  tar xvf -

This  ~/src/ARC_API was left untouch. The Makefile for spex just references this source
tree for headers, and compiles the necessary libraries. Spex only uses a small subset of
what is needed.