Notes on setup a system to run the IARC software on CentOS 6.x i386

Notes on setting up a CentOS 6.3 i386 computer with the IARC controller tools and software.

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 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 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

   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 /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

----------------------------------------------------------------------------------
INSTALLING THE IARC SOFTWARE, PER CL's INSTRUCTIONS, but with limited modifications.
----------------------------------------------------------------------------------

2. ARC66 Device Driver

Using a modified 3.0 files from  AstroPCIe3.0_E60_x32.tar (archived by iarc)
Per CL 2013/05, plans to take out custom modificaition - he only added ARC commands in .h file.

IARC version of driver is at: /home/iarc/src/DRIVER/astropci/3.0/PCIe/E6.0_x32

Copy and compile IARC 3.0 device driver

Copy
   install -d /home/s2/src/drivers/astropci/3.0/PCIe/E6.0_x32
   cd         /home/s2/src/drivers/astropci/3.0/PCIe/E6.0_x32
   cp -pr     /home/iarc/src/DRIVER/astropci/3.0/PCIe/E6.0_x32/* .

Make
   cd /home/s2/src/drivers/astropci/3.0/PCIe/E6.0_x32
   make
   (ASK CL ABOUT WARNING MESSAGES)

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)

Loading Driver

   Ran Load_Arc64PCI
      cd /home/s2/src/drivers/astropci/3.0/PCIe/E6.0_x32
      Load_AstroPCIe

ARC API

source for ARC_API is in: /home/iarc/src/IARC/ARC_API/src/ARC_API/3.0/CArcDevice
This has be modified by CL, but CL can make changes to go back to unmodified  vendor libs.

   COPY:
   install -d /home/s2/src/IARC/ARC_API/src/ARC_API/3.0/
   cd         /home/s2/src/IARC/ARC_API/src/ARC_API/3.0/

   cp -pr     /home/iarc/src/IARC/ARC_API/src/ARC_API/3.0/* .

   make:
    cd         /home/s2/src/IARC/ARC_API/src/ARC_API/3.0/
    make

   NOTE TO CL:
   CArcPCIe.cpp: line 907, printf with " %x " , but no argument.
   Did not do a make, modified iarc server's makefile so that .so are not needed.

DSP CODE

H2RG DSP code is located in /home/iarc/src/H2RG/MKMAC.DSP/H2RG.DSP

   COPY:
   install -d /home/s2/src/H2RG/MKMAC.DSP/H2RG.DSP
   cd         /home/s2/src/H2RG/MKMAC.DSP/H2RG.DSP
   cp -p      /home/iarc/src/H2RG/MKMAC.DSP/H2RG.DSP/* .

  NOTE TO CL:
  tim script replaced "/home/iarc/" with "$HOME/"
  I commented out copy to ~/bin, would rather load from src directory.

   MAKC:
   run the 'tim' script.

IARC Server

Needs CFITSIO. gocam has version 3.31
Downloaded lastest (V3.340) to src/IARC/cfirtsio,  installed:

   cd /home/s2/src/IARC/cfitsio
   tar xzvf cfitsio_3340.tar.gz
   cd cfitsio
   ./configure
   make
   make install  (installed itself in /home/s2/src/IARC/cfitsio/cfitsio/include/  & lib/).

IARC source code is located in: /home/iarc/src/IARC/iarc

   COPY:
   install -d /home/s2/src/IARC/iarc
   cd         /home/s2/src/IARC/iarc
   cp -p      /home/iarc/src/IARC/iarc/* .

NOTES TO CL:
   1. don't need ir1.h if you add these function to iarc_help.c/.h (I did in my copy).
       expand_pathname, exist_path create_path (plus a few other functions).
   2. Change makefiles so that you don't install thing in /usr
         link CArcDevices and fitsio from $HOME/src/....
   3. Still TODO: remove /home/iarc/... with $HOME/...
     ./iarc_commands.c:102:   sprintf(filename, "%s", "/home/iarc/bin/tim.lod");
     ./iarc_controller.c:192:   sprintf(iarc_setup.datapath, "%s", "/home/iarc/data/");
     ./iarc_controller.c:305:      printl("updating DSP with /home/iarc/bin/tim.lod\n");
     ./iarc_controller.c:306:      printf("updating DSP with /home/iarc/bin/tim.lod\n");
     ./iarc_controller.c:307:      pArcDev->LoadControllerFile("/home/iarc/bin/tim.lod", true);
     ./iarc_server.c:109:   if ( open_log( "/home/iarc/tmp/iarc_server.log" ) < 0 )
     

     I suggest:
        expand_pathname( iarc_setup.datapath, sizeof(iarc_setup.datapath), "$HOME/data/" );

WEBGUI

Copied web gui to /home/s2/src/WEBGUI. Run via run.sh. 
Just using stock Java from centos 6.x DVD, seems to compile/run OK.

  install -d /home/s2/src/WEBGUI
  cd         /home/s2/src/WEBGUI
  cp -r /home/iarc/src/WEBGUI/* .

Other Suggestions

1. Maybe orgainization the code as a single directly tree, that contains all
   sources, files need to to run.

   ~/IARC/dsp/              // DSP Files.
             clas563/       // assembler
             h2rg/          // h2rg dsp code
             alladin/       // aladdin dsp code
             other_arrays/
         /drivers/          // Device Device Drivers
             astropci/
             parint/
         /ARC_API           // CAPI lib needed for IARC Server
         /cfitsio           // FITS lib needed for IARC Server
         /iarc/             // IARC Server
         /webgui/           // JAVA Web gui.
         /docs/             // Any documentation