Differences between revisions 102 and 135 (spanning 33 versions)
Revision 102 as of 2010-03-02 10:39:31
Size: 31965
Editor: hih-kn-2301-01
Comment:
Revision 135 as of 2013-06-21 08:47:03
Size: 23630
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#acl FriedemannBunjes:read,write,delete,revert All:read #acl FriedemannBunjes:read,write,delete,revert YuminZhou:read,write,delete,revert All:read,write
Line 6: Line 6:
= HowTo setup an nrec development system = = HowTo setup a new nrec development system =
Line 15: Line 15:
  * If the installer is not able to detect your network hardware, insert an old standard PCI network card and use this one.
Line 19: Line 20:
 4. Get the nvidia driver here: [[attachment:NVIDIA-Linux-x86-173.14.12-pkg1.run]].
 5. Install the gcc compiler and libraries:
 {{{
 # aptitude install make gcc libc6 libc6-dev
 }}}
 6. Find out the running kernel version:
 {{{
 # uname -a
 }}}
 7. Install the corresponding kernel headers:
 {{{
 # aptitude install linux-headers-$(uname -r)
 }}}
 If you are unsure what to install, check the available packages:
 {{{
 # apt-cache search linux-headers
 }}}
 8. You have to use the gcc version 4.1 instead of the installed 4.3. Install it, if not already installed
 {{{
 # aptitude install gcc-4.1
 }}}
 and set the gcc link
 {{{
 # rm /usr/bin/gcc && ln -s /usr/bin/gcc-4.1 /usr/bin/gcc
 }}}
 8. For the impatient people here the previous commands in two lines:
 {{{
 aptitude -y install sux make gcc libc6 libc6-dev linux-headers-$(uname -r) gcc-4.1 kde
 rm /usr/bin/gcc && ln -s /usr/bin/gcc-4.1 /usr/bin/gcc
 
 }}}
 9. Now you can install the nvidia-driver:
 {{{
 # sh NVIDIA-Linux-x86-173.14.12-pkg1.run
 }}}
 And tell the installation program to build a new kernel module.

 9. When your X11 ist running, you can install sux:
 {{{
 # aptitude install sux
 }}}
 10. Adjust your display settings:
 {{{
 # nvidia-settings
 }}}
 Set the appropriate resolutions for your screens and set up a separate screen for the second monitor (if you have one). In the OpenGL Settings of the stimulus X Screen make sure, that the "Sync to VBlank" option is '''enabled''' and the "Allow Flipping" option is '''disabled'''.
 11. After restarting the x-server and enjoying the good resolution, you can install kde:
 {{{
 # aptitude install kde
 }}}
 4. Install sux, kde and openssh, if you want to access the machine from remote:
 {{{
aptitude -y install sux kde openssh-server
 }}}
Line 73: Line 27:
 1. Get latest stable linux kernel source from http://www.kernel.org/pub/linux/kernel/ (e.g. http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.23.17.tar.gz)

 2. get rtai from https://www.rtai.org/RTAI/ (e.g.: https://www.rtai.org/RTAI/rtai-3.7.1.tar.bz2)
 1. Get latest stable linux kernel source from http://www.kernel.org/pub/linux/kernel/ (e.g. http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.8.tar.gz)
 {{{
cd /usr/local/src && wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.8.tar.gz
 }}}


 2. get rtai from https://www.rtai.org/RTAI/ (e.g.: https://www.rtai.org/RTAI/rtai-3.9.tar.bz2)
 {{{
wget --no-check-certificate https://www.rtai.org/RTAI/rtai-3.9.tar.bz2
 }}}
Line 80: Line 40:
 # cd /usr/local/src && tar xzvf linux-2.6.23.17.tar.gz && tar xjvf rtai-3.7.1.tar.bz2 cd /usr/local/src && tar xzvf linux-2.6.38.8.tar.gz && tar xjvf rtai-3.9.tar.bz2
Line 85: Line 45:
 # cd linux-2.6.23.17 cd linux-2.6.38.8
Line 90: Line 50:
 # cp /boot/config-2.6.x .config cp /boot/config-2.6.32-5-686 .config
Line 95: Line 55:
 # aptitude -y install kernel-package libncurses5-dev aptitude -y install kernel-package libncurses5-dev
Line 100: Line 60:
 # patch -p1 --dry-run < ../rtai-3.7.1/base/arch/i386/patches/hal-linux-2.6.23-i386-1.12-03.patch
 # patch -p1 < ../rtai-3.7.1/base/arch/i386/patches/hal-linux-2.6.23-i386-1.12-03.patch
patch -p1 --dry-run < ../rtai-3.9/base/arch/x86/patches/hal-linux-2.6.38.8-x86-2.11-02.patch
patch -p1 < ../rtai-3.9/base/arch/x86/patches/hal-linux-2.6.38.8-x86-2.11-02.patch
Line 106: Line 66:
 # make-kpkg --initrd --append-to-version rtai --config menuconfig kernel-image make-kpkg --initrd --append-to-version rtai --config menuconfig kernel-image
Line 114: Line 74:
    * Device Drivers --->
   * Serial ATA (prod) and Parallel ATA (experimental) drivers --->
    * AHCI SATA support is enabled
    * Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support is enabled
   * SCSI device supplort --->
    * SCSI disk support is enabled
    * SCSI CDROM support is enabled
    * SCSI generic support is enabled
Line 127: Line 78:
 # cat /proc/cpuinfo cat /proc/cpuinfo
Line 131: Line 82:
   * Preemption Model ---> Preemptible Kernel (Low-Latency Desktop) is enabled
   * Enable kernel irq balancing is '''disabled'''
   * Preemption Model ---> Voluntary Kernel Preemtion (Desktop) is enabled

  * Virtualization is '''disabled'''

 Important for rtai compatibility (see http://wiki.linuxcnc.org/emcinfo.pl?Ubuntu10.04Notes):

  * Processor type and features ---> HPET Timer Support ---> disabled
  * Processor type and features ---> Interrupt pipeline ---> enabled [*]
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> enabled [*]
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated /proc/acpi files ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated power /proc/acpi directories ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Future power /sys interface ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated /proc/acpi/event support ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> AC Adapter ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Battery ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Button ---> enabled[*]
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Video ---> module [M]
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Fan ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Dock ---> enabled [*]
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Processor ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Disable ACPI for systems before Jan 1st this year ---> 0
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Debug Statements ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> PCI slot detection driver ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Container and Module Devices ---> disabled
  * Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Smart Battery System ---> disabled
  * Power management and ACPI options ---> APM (Advanced Power Management) BIOS support ---> disabled
  * Power management and ACPI options ---> CPU Frequency scaling ---> disabled

  * If you are using an older RTAI patch you may get the following error:
        include/linux/ipipe.h:76:2: error: #error "CONFIG_NR_CPUS is too large, please lower it."
        To fix this disable sparse irq numbering (CONFIG_SPARSE_IRQ=n):
            Processor type and features ---> Support sparse irq numbering ---> disabled
  * If you have a multi cores CPU or SMP system, don't choose a processor family which has no TSC (time stamp counter).
        This means that for example you can not choose 586/K5/5x86/6x86/6x86MX as Processor family if you have a dual cores CPU.
        In conclusion, choose the most suitable processor family for your machine.
  * NOTE: No need to disable High Memory Support for RTAI 3.7.1 and newer
  * NOTE: No need to disable Symmetric multi-processing support for the uniproccesor machine for RTAI 3.7.1 and newer.
              But if you don't have a multi cores CPU or SMP system, you can disable it to improve the performance
  * NOTE: There was supposedly no need to disable Module Versioning Support for RTAI 3.7.1, but it seems to be needed for the latest RTAI (3.8.1 or magma).
              I don't know if this is an RTAI problem or emc2, since I could run the RTAI latency test but not the emc2 stuff.
  * NOTE: No need to turn off debugging if building packages with the ubuntu debian/rules system.
              Otherwise remember to turn off debugging info to vastly reduce kernel size!
Line 139: Line 130:
 # cd /usr/local/src && dpkg -i linux-image-2.6.23.17rtai_2.6.23.17rtai-10.00.Custom_i386.deb cd /usr/local/src && dpkg -i linux-image-2.6.38.8rtai_2.6.38.8rtai-10.00.Custom_i386.deb
Line 142: Line 133:
 10. If you want to be sure, check grub boot manager entry:
 {{{
 # less /boot/grub/menu.lst
 10. If you want, check and update "GRUB_DEFAULT" value for grub boot manager entry:
 {{{
less /boot/grub/grub.cfg
nano /
etc/default/grub
update-grub
Line 149: Line 142:
 # reboot reboot
Line 152: Line 145:
 12. Known issues:
  * If you get lots of IRQ-related messages after rebooting, insert the parameters noirqdebug and pci=noacpi to the kernel-command of your boot-manager (lilo or grub).
    
 12. After booting the new Kernel, you might have to rebuild the graphic card driver module:
 {{{
sh NVIDIA-Linux-x86-173.14.12-pkg1.run
 }}}
 and verify the display settings:
 {{{
nvidia-settings
 }}}

 13. It might also be necessary to reinstall your network card driver.
Line 160: Line 160:
 # cd /usr/local/src/rtai-3.7.1  # cd /usr/local/src/rtai-3.8.1
Line 167: Line 167:
  * In the menu "General" set the rtai-path (/usr/lib/realtime) and the path to the kernel sources (/usr/local/src/linux-2.6.23.17).
  * Choose "Exit" and "Yes".
  * In the menu "General" set the rtai-path (/usr/lib/realtime) and the path to the kernel sources (/usr/local/src/linux-2.6.38.8).
  * Choose "Exit", "Exit" and "Yes".
Line 181: Line 181:
export PATH=/usr/lib/realtime/bin:$PATH && /
cd /usr/lib/realtime/testsuite/kern/latency && /
export PATH=/usr/lib/realtime/bin:$PATH &&
cd /usr/lib/realtime/testsuite/kern/latency &&
Line 189: Line 189:
 # ln -s /usr/lib/realtime/modules /lib/modules/2.6.23.17rtai/rtai
 # depmod -a
 }}}
ln -s /usr/lib/realtime/modules /lib/modules/2.6.38.8rtai/rtai
depmod -a
 }}}

== Installing the graphic card driver ==

Here are the instructions for nVidia cards. For ATI cards the process is similar. Please check for instructions on the web.

 1. Check what graphic card you have. If {{{lspci}}} does not help you, you will have to open the case and have a look.
 2. For nvidia cards you might want to get your driver here: http://www.nvidia.de/Download/index.aspx
 3. Save it to e.g. /usr/local/src.
 7. Install the packages necessary for the graphics kernel module build:
 {{{
aptitude install binutils gcc make linux-headers-$(uname -r)
 }}}
 4. Now you have to shut down X11 by switching to a console (Alt-Ctrl-F1), logging in as root and executing
 {{{
/etc/init.d/gdm3 stop
 }}}
 5. Go to the directory, where you stored the installer into:
 {{{
cd /usr/local/src
sh NVIDIA...
 }}}
 6. When an error message about the Nouveau kernel driver appears, let the installer create a file in modprobe.d to disable it and reboot, switch to the shell, stop gdm3 and restart the installer
 12. Ignore messages about the gcc version (e.g. let the installer use the installed gcc 4.4. instead of 4.3) and let the installer do all modifications it wants to.
 13. restart gdm3:
 {{{
/etc/init.d/gdm3 start
 }}}
 15. Adjust your display settings:
 {{{
nvidia-settings
 }}}
 Set the appropriate resolutions for your screens and set up a separate screen for the second monitor (if you have one). In the OpenGL Settings of the stimulus X Screen make sure, that the "Sync to VBlank" option is '''enabled''' and the "Allow Flipping" option is '''disabled'''.
 
 If you are using a high speed (e.g. 120 Hz) screen, you may have to '''disable''' (uncheck) the option "GPU 0 - DFP-0 - Information - Flat Panel Scaling - Force Full GPU Scaling" to enable the correct hight framerate for your screen.
Line 195: Line 230:
 1. Download comedi from http://www.comedi.org/download/ (e.g. http://www.comedi.org/download/comedi-0.7.76.tar.gz), move it to /usr/local/src and unpack it:  0. Install the autoconf package:
 {{{
aptitude -y install autoconf
 }}}

 1. Download current comedi git snapshot from http://www.comedi.org/download.html, move it to /usr/local/src and unpack it:
Line 198: Line 238:
wget http://www.comedi.org/download/comedi-0.7.76.tar.gz
tar -xvzf comedi-0.7.76.tar.gz
tar -xvzf comedi-HEAD-6f425c7.tar.gz
Line 204: Line 243:
cd comedi-0.7.76 cd comedi-HEAD-6f425c7
./autogen.sh
Line 214: Line 254:
make && /
make install && /
depmod -a && /
make &&
make install &&
depmod -a &&
Line 238: Line 278:
  If not (especially, if comedy_config produces the error "comedi.o not loaded"), a modification in /etc/modprobe.d will be necessary (http://groups.google.com/group/comedi_list/browse_thread/thread/c24e52bb196abe61):

  If you are using the current CVS version of comedi, then by default, all comedi devices are reserved for autoconfigured PCI and USB devices, so if you want to configure ISA or PCMCIA devices you need to tell Comedi to reserve some or all comedi devices with a module option when the comedi.ko module is loaded. The easiest way to do that is to create and edit /etc/modprobe.d/comedi.conf and add one of the following lines:
  {{{
options comedi comedi_num_legacy_minors=4
  }}}
  (you can change the number 4 if you want), or:
  {{{
options comedi comedi_autoconfig=0
  }}}
  The first option, {{{comedi_num_legacy_minors=4}}} reserves 4 comedi devices for use by non-autoconfigured devices. The second option {{{comedi_autoconfig=0}}} disables auto-configuration completely. Take your pick!

  You'll have to run 'sudo depmod -a' and reload all the comedi modules for the change to take effect, or just reboot.

 7. We need some packages for comedilib:
 {{{
aptitude install libtool flex bison
 }}}
Line 241: Line 299:
wget http://www.comedi.org/download/comedilib-0.8.1.tar.gz
tar -xvzf comedilib-0.8.1.tar.gz
cd comedilib-0.8.1
wget http://www.comedi.org/download/comedilib-HEAD-54712cb.tar.gz
tar -xvzf comedilib-HEAD-54712cb.tar.gz
cd comedilib-HEAD-54712cb
./autogen.sh
Line 250: Line 309:
   {{{  {{{
Line 252: Line 311:
   }}}
   The file should look similar to this:
   {{{
 }}}
 The file should look similar to this:
 {{{
Line 259: Line 318:
   }}}

7. Run ldconfig to make the new libraries visible:
   {{{
 }}}

 7. Run ldconfig to make the new libraries visible:
 {{{
Line 264: Line 323:
   }}}  }}}
Line 331: Line 390:
 11. comedi_config can be called in a startup-script for automation.
 Put the following code into /etc/init.d/comedi-device (don't forget to uncomment the line for your card):
 {{{
 #! /bin/sh
 #
 # comedi-device Associate Comedi driver with device file
 #
 # Friedemann Bunjes <friedemann.bunjes@uni-tuebingen.de>
 #

 case "$1" in
   start)
         echo -n "Associating Comedi driver with device file."
 # comedi_config /dev/comedi0 ni_pcimio
 # comedi_config /dev/comedi0 ni_mio_cs
         comedi_config /dev/comedi0 cb_pcidas64
        ;;
   stop)
         ;;
   restart|force-reload)
         ;;
   *)
         ;;
 esac

 exit 0
 }}}

 make it executable

 {{{
chmod a+x /etc/init.d/comedi-device
 }}}

 and link to startup script directories:

 {{{
ln -s /etc/init.d/comedi-device /etc/rc4.d/S30comedi-device
ln -s /etc/init.d/comedi-device /etc/rc5.d/S30comedi-device
 }}}
Line 385: Line 403:
 1. Make sure you have qt3 and the g++ compiler installed:
 {{{
aptitude -y install qt3-dev-tools qt3-designer qt3-apps-dev qt3-assistant qt3-doc build-essential
 }}}

 3. Download the latest Qwt 5 from
        http://sourceforge.net/projects/qwt -> "Download" -> "Download" -> "qwt-5.2.0.zip"
        (currently: http://downloads.sourceforge.net/project/qwt/qwt/5.2.0/qwt-5.2.0.zip?use_mirror=dfn)
 {{{
cd /usr/local/src && wget http://downloads.sourceforge.net/project/qwt/qwt/5.2.0/qwt-5.2.0.zip?use_mirror=dfn
 1. Make sure you have qt4 and the g++ compiler installed:
 {{{
aptitude -y install qt4-dev-tools qt4-designer qt4-doc build-essential
 }}}

 3. Download the latest Qwt from
        http://sourceforge.net/projects/qwt -> "Download" -> "Download" -> "qwt-6.1.zip"
        (currently: http://downloads.sourceforge.net/project/qwt/qwt-beta/6.1.0-rc3/qwt-6.1-rc3.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fqwt%2F&ts=1362123587&use_mirror=netcologne)
 {{{
cd /usr/local/src && wget http://downloads.sourceforge.net/project/qwt/qwt-beta/6.1.0-rc3/qwt-6.1-rc3.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fqwt%2F&ts=1362123587&use_mirror=netcologne
Line 399: Line 417:
unzip qwt-5.2.0.zip tar -xvjf qwt-6.1-rc3.tar.bz2
Line 404: Line 422:
cd qwt-5.2.0 && qmake && make && make install cd qwt-6.1-rc3/src/ && qmake && make && make install
Line 416: Line 434:
cd lib && tar -cf l.tar * cd /usr/local/src/qwt-6.1-rc3/lib && tar -cf l.tar *
Line 425: Line 443:
 cp src/*.h /usr/local/include
 cd lib && tar -cf l.tar * && mv l.tar /usr/local/lib && cd /usr/local/lib && tar xf l.tar && rm l.tar
 cd /usr/local/src/qwt-5.2.0
 cp /usr/local/src/qwt-6.1-rc3/src/*.h /usr/local/include
 cd /usr/local/src/qwt-6.1-rc3/lib && tar -cf l.tar * && mv l.tar /usr/local/lib && cd /usr/local/lib && tar xf l.tar && rm l.tar
 cd /usr/local/src/qwt-6.1-rc3
Line 455: Line 473:
cd examples && qmake && make cd examples && qmake && make && bin/radio
Line 460: Line 478:
 1. Install subversion client, kdevelop, the HDF5 library (required) and tools (optional), the movie libraries, the gnu scientific library and the debugger ddd:
 {{{
aptitude -y install subversion kdesvn kompare kdevelop libhdf5-serial-1.6.6-0 libhdf5-serial-dev hdf5-tools libavformat-dev libavcodec-dev libpostproc-dev libswscale-dev libswscale0 gsl-bin libgsl0ldbl libgsl0-dev ddd
 1. Install subversion client, kdevelop, the HDF5 library (required) and tools (optional), the movie libraries, the gnu scientific library, the debugger ddd and the ssh server (if needed):
 {{{
aptitude -y install subversion kdesvn kompare kdevelop libhdf5-serial-1.8.4 libhdf5-serial-dev hdf5-tools libpng12-0 libpng12-dev libfreetype6 libfreetype6-dev libavformat-dev libavcodec-dev libpostproc-dev libswscale-dev libswscale0 gsl-bin libgsl0ldbl libgsl0-dev ddd openssh-server
Line 472: Line 490:
 2. Generate Makefile from qmake project file
 {{{
 cd nrec/src && qmake -o Makefile nrec.pro
 2. Install the vicon library:
 {{{
 cp nrec/src/test/vicon/libViconDataStreamSDK_CPP.so /usr/local/lib
 ldconfig
 }}}

 3.
Generate Makefile from qmake project file
 {{{
 cd nrec/branches/squeeze-qt3/src && qmake-qt3 -o Makefile nrec.pro
Line 481: Line 505:
 3. Import nrec project into KDevelop (optional)  4. Import nrec project into KDevelop (optional)
Line 484: Line 508:
   * Directory: Browse to nrec/src you have just checked out.    * Directory: Browse to nrec/branches/squeeze-qt3/src you have just checked out.
Line 491: Line 515:
 4. Compile nrec: Either in KDevelop "Build" -> "Build Project" or on the command line type  5. Compile nrec: Either in KDevelop "Build" -> "Build Project" or on the command line type
Line 501: Line 525:
To compile it, you need to install gtk version 2:
 {{{
 aptitude install libgtk2.0-dev
 }}}

Get the xoscope sources here: http://prdownloads.sourceforge.net/xoscope/xoscope-2.0.tgz
 {{{
 tar xvzf xoscope-2.0.tgz && /
 cd xoscope-2.0
 }}}
Replace comedi.c by this one: [[attachment:comedi.c]]
 {{{
 ./configure && /
 make && /
 make install
 }}}
To install it, type
 {{{
aptitude install xoscope
 }}}

<<Anchor(nrec_multiuser)>>
Line 528: Line 541:
echo "sudo /home/devel/nrec/run/nrec.sh $1" > /usr/local/bin/nr echo -e "sudo /usr/bin/nvidia-settings -l\nsudo /home/devel/nrec/run/nrec.sh $1" > /usr/local/bin/nr
Line 553: Line 566:
ALLE ALL=NOPASSWD: /home/devel/nrec/run/nrec.sh, /usr/local/bin/nr, /home/devel/nrec/src/nrec

 }}}
ALLE ALL=NOPASSWD: /home/devel/nrec/run/nrec.sh, /usr/local/bin/nr, /home/devel/nrec/src/nrec, /home/devel/nrec/branches/squeeze-qt3/src/nrec, /usr/bin/nvidia-settings
 }}}

 5. Add xhost command to kde Autostart folder:
 {{{
echo "xhost localhost" > ~/.kde/Autostart/xhost_localhost && chmod a+x ~/.kde/Autostart/xhost_localhost
 }}}
Line 561: Line 579:

== Older setup informations ==

Here is the content of the !NrecSetupHowto.txt which has been used in former times:

{{{
Contents
========
1. Hardware requirements
2. Linux kernel
3. RTAI Modules
4. Comedi
5. Qwt
6. Development tools and libraries
7. NREC
8. Known issues


1. Hardware requirements
=======================
- Modern x86 PC
- Dual head graphics adapter
- For Data Acquisition and Digital I/O development: A Comedi (see www.comedi.org) compatible DAQ card, e.g. a Measurement Computing PCI-DAS6025.
- For the Trigger/Clipping the following connections must be established:
 DOut Channel 0 (trigger subdevice) - AIn Channel 2 (analog in subdevice)
 If subdevice for spike recording is available:
 DOut Channel 0 (trigger subdevice) - DIn Channel 0 (digital in/spikes subdevice)


2. Linux Kernel
===============
- Recent stable 2.6 kernel. Either from kernel.org or from your distribution, e.g. Debian packaged kernel.
- Make sure the following configuration options are selected. (Current Debian Sarge kernel-images have all these options set, so there is probably no need to build a custom kernel.):
 - CONFIG_PREEMPT: Preemptible kernel gives better latencies for realtime tasks.
 
2.1 Linux Kernel with RTAI realtime extensions
==============================================
- Install latest stable kernel sources
 Get latest stable linux kernel source from
 http://kernel.org/
 e.g.:
 $ wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.6.tar.bz2
        or:
        $ wget http://www.eu.kernel.org/pub/linux/kernel/v2.6/linux-2.6.19.7.tar.gz

- Install RTAI extensions

 # get rtai from https://www.rtai.org/RTAI/
        e.g.: rtai-3.6.1.tar.bz2
  
- Unpack kernel-sources and rtai-sources to /usr/local/src
  (after downloading or moving the packages to /tmp):
 $ cd /usr/local/src && tar xzvf /tmp/linux-2.6.19.7.tar.gz && tar xjvf /tmp/rtai-3.6.1.tar.bz2
- Change into the build dir
 $ cd linux-2.6.19.7
- Copy config file of your running kernel into the build dir (for a reasonable default config)
 $ cp /boot/config-2.6.x .config
 
- Get packages for kernel-compilation:
 # aptitude install kernel-package
 # aptitude install libncurses5-dev

- Apply rtai patch suitable for your kernel version:
  # patch -p1 --dry-run <
 ../rtai/vulcano/base/arch/i386/patches/hal-linux-2.6.19-i386-1.7-01.patch
   # patch -p1 < ../rtai/vulcano/base/arch/i386/patches/hal-linux-2.6.19-i386-1.7-01.patch
  
- Configure and build kernel
 $ fakeroot make-kpkg --initrd --append-to-version rtai --config menuconfig kernel-image
  
 When the kernel menuconfig menu pops up, make sure
 (a) The right processor type for your system is selected (Processor type and features -> Processor family).
 (b) "Loadable module support -> Module versioning support" is disabled.
 (c) Processor Type and Features > Symmetric multi-processing support is enabled.
        (d) SATA supoort is enabled if you have a SATA HD.
 (e) See above (2. Linux Kernel) for additional required config options.
 Then "Exit", Answer question "Save kernel config?" with "Yes" and wait for the kernel to compile (Take a break).
 
- Leave kernel source dir
 $ cd ..

- Install the built kernel
 $ su -c "dpkg -i linux-image-2.6.19.7rtai_2.6.19.7rtai-10.00.Custom_i386.deb"

- check grub boot manager entry:
  $ less /boot/grub/menu.lst

- If you get lots of IRQ-related messages after rebooting, insert the parameters noirqdebug and pci=noacpi to the kernel-command of your boot-manager (lilo or grub).

3. RTAI Modules
===============

- Get rtai from https://www.rtai.org/RTAI/
- or check out stable branch (vulcano) via cvs to /usr/local/src/rtai/vulcano:
 $ cvs -d:pserver:anonymous@cvs.gna.org:/cvs/rtai co vulcano
- Install like written in /usr/local/src/rtai/vulcano/README.INSTALL:

 # cd /usr/local/src/rtai/
 # mkdir build && cd build/
 # make -f ../vulcano/makefile menuconfig

- In the menu "General" set the rtai-path (/usr/lib/realtime)
  and the path to the kernel sources (/usr/local/src/linux-2.6.19.7).

- Make it:
 # make -f ../vulcano/makefile
 # make install

- If you would like to test rtai, do:
 # export PATH=/usr/lib/realtime/bin:$PATH
 # cd /usr/lib/realtime/testsuite/kern/latency
 # ./run
 
- It is useful to link the rtai modules to /lib/modules/$(uname -a)/
  because they can then be loaded automatically if e.g. a comedi module needs them:
 # ln -s /usr/lib/realtime/modules /lib/modules/2.6.19.7rtai/rtai
 # depmod -a


4. Comedi
=========
- The official comedi-source package in the Debian repository which
  provides the source for Comedi kernel modules (DAQ drivers) is
  outdated and lacks support for newer kernels or hardware.
  More recent versions can be obtained from [http://www.comedi.org/download.html]
  but not in Debian package (.deb) format; so they are not as easy installable and
  removable as the Debian ones.
  This is why this document explains how to create a Debian package from Comedi CVS
  (with the tarballs released on [http://www.comedi.org/download/] this is even
  simpler as there is no need to run autgen.sh).
  
- You will need some Debian administration and development tools.
 # aptitude install build-essential dpkg-dev devscripts debhelper fakeroot \
   linda apt-src module-assistant

- Get original debian comedi package source:
 $ cd /usr/local/src
 $ mkdir comedi-debian && cd comedi-debian
 $ su -c "apt-src update"
 $ apt-src install comedi-source
 $ cd ..

- Get current comedi release:
 # wget http://www.comedi.org/download/comedi-0.7.74.tar.gz
- Unpack:
 # tar xzf comedi-0.7.74.tar.gz
- Merge with debian source:
 # cp -r comedi-debian/comedi-0.7.70/debian comedi-0.7.74/
 # cd comedi-0.7.74
- Now, we have to generate a list of files which are to be included in the package:
 $ find . -path ./debian -prune -o -type f -print > debian/driver.files
- and add a changelog entry at the top of debian/changelog:
 $ vim debian/changelog
 
 The changelog has to obey a strict format, so copy an existing entry and
 carefully apply your changes without changing the amount of whitespace
 in the header and footer lines.

 An example:
 -------------------------------------------------------------------------------
 comedi (0.7.74-1) unstable; urgency=low

   * Debianizing the comedi-0.7.74 release tarball.

  -- Jan Gukelberger <g.u.g.i@gmx.de> Wed, 19 Sep 2007 19:16:22 +0100

 -------------------------------------------------------------------------------

 The term in parentheses defines the version of the created package.
 You should choose the format [upstream.version]-[your.version] where
 [upstream.version] is the last version number released by the
 Comedi project (can be checked at http://www.comedi.org/download/).

- NOTE1: Currently (Feb 2007) Comedi PCMCIA drivers are broken with kernels >= 2.6.17.
 Therefore you have to edit debian/rules to not build those drivers or the last
 installation step (module-assistant) will fail. Add the option '--disable-pcmcia'
 to the './configure' line. See below [A.2] for a patch.

- NOTE2: If you are using debian/rules from an old debian package (i.e. 0.7.70 or earlier)
 you also have to add the right rtai path to the ./configure line:
 ./configure [...] --with-rtaidir=/usr/lib/realtime --disable-pcmcia

- Now we can finally build the Debian package:
 $ debuild --linda -us -uc --linda-opts -i
 [Say 'y' if you are asked whether to continue despite a missing original tar file.]
- If everything went well you now have a debian package in the parent directory.
 $ cd ..

- NOTE3: This .deb package is system independent. I.e. having created it once
 you can copy the package to any Debian system and need only execute
 the following two "Modules install" commands to install Comedi drivers
 on this system.

- Install your created Debian package:
 $ su -c "dpkg -i comedi-source_[version]_all.deb"
 e.g. # dpkg -i comedi-source_0.7.74-1_all.deb
 
- Build and install the comedi-modules for your running kernel using module-assistant (m-a):
 $ su -c "m-a a-i -t comedi"

- Make comedilib package:

- Download comedilib-x.x.x.tar.gz from http://www.comedi.org/download

- Unpack:
 # cd /usr/local/src
 # tar xjf comedilib-0.8.0.tar.bz2
 # cd comedilib-0.8.0

- Make package:
 # debuild --linda -us -uc --linda-opts -i
 # cd ..

- Install package:
 # dpkg -i libcomedi-0.8.0_0.8.0-1_i386.deb libcomedi-dev_0.8.0-1_i386.deb
 #

- Load modules and associate comedi-driver of your card to comedi-device:
 (find appropriate driver at http://www.comedi.org/hardware.html)
 
 # RTAI modules
 modprobe rtai_hal
 modprobe rtai_fifos

 # Comedi modules
 modprobe ni_pcimio
 #modprobe cb_pcidas64
 modprobe comedi_rt_timer
 modprobe kcomedilib

- Configure comedi with the comedi-driver of your card
  (find appropriate driver at http://www.comedi.org/hardware.html):
  Measurement Computing:
 # comedi_config /dev/comedi0 cb_pcidas64
  National Instruments:
 # comedi_config /dev/comedi0 ni_pcimio
 
- Test comedi installation:
 # comedi_test

- Modules can be specified in /etc/modules,

- comedi_config can be called in a startup-script for automation
  (put A.3 into /etc/init.d/comedi-device):
 # ln -s /etc/init.d/comedi-device /etc/rc4.d/S30comedi-device
 # ln -s /etc/init.d/comedi-device /etc/rc5.d/S30comedi-device


5. Qwt
==========
- Make sure you have qt3 installed:
 # aptitude install qt3-dev-tools qt3-designer qt3-apps-dev qt3-assistant qt3-doc

- Make sure you have the g++ compiler installed:
        # aptitude install build-essential

- Download the latest Qwt 5.0 from
 http://sourceforge.net/projects/qwt -> "Download qwt" -> "qwt"
 (currently: qwt-5.0.2.tar.bz2)
- Unpack the archive:
 $ tar xjf qwt-5.0.2.tar.bz2
- Build the library:
 $ cd qwt-5.0.2
 $ qmake qwt.pro
 $ make
- To use the library you have to
 o EITHER install Qwt by
  (a) copying the files in src/ to /usr/local/include/.
  (b) copying those in lib/ to /usr/local/lib/.
                (c) adding /usr/local/lib to the ldconfig config file /etc/ld.so.conf.d/i486-linux-gnu.conf
  (c) running ldconfig as root.
 o OR make sure the Qwt files are found by
  (a) adding the path to include/ to the INCLUDEPATH line in the nrec *.pro file.
  (b) adding the path to lib/ to the LIBS line in the nrec *.pro file (prefixed with '-L').
  (c) adding the path to lib/ to the LD_LIBRARY_PATH environment variable.


6. Development tools and libraries
==================================
- Install subversion client
 # aptitude install subversion
- Install kdevelop (optional)
 # aptitude install kdevelop
- Install the HDF5 library (required) and tools (optional)
 # aptitude install 'libhdf5-serial*' hdf5-tools
- Install the movie libraries
 # aptitude install libavformat-dev libavcodec-dev libpostproc-dev
- Install the gnu scientific library
 # aptitude install gsl-bin libgsl0 libgsl0-dev


7. NREC
=======

- Checkout module "nrec" from the subversion server
 $ svn co https://jan@134.2.114.11/nrec
- Generate Makefile from qmake project file
 $ cd branches/src-xstimulus && qmake -o Makefile CTestExperiment.pro
- Import NREC project into KDevelop (optional)
 1) Run kdevelop
 2) "Project" -> "Import Existing Project"
  * Directory: Browse to nrec/branches/src-xstimulus you have just checked out.
  * Fetch from: Ignore this.
  * Project Name: "nrec"
  * Project Type: "QT C++ Application (QMake based)"
  * Author: Your Name
  * Email: Your Email address
- Compile NREC. Either in KDevelop "Build" -> "Build Project" or on the command line type
 $ make



8. Known issues
===============

8.1 Frame length is 100ms too large:
Symptoms: When NREC is started from X running on a second graphics adapter the first time, syslog says "Disbling IRQ X" and from now until reboot all frames are 100ms too long.
Cause: For some reason, a flood of unhandled interrupts from the Matrox graphics card occurs and this IRQ is disabled by kernel interrupt debugging routines.
Solution: Append the bootparam 'noirqdebug' to the kernel command line. (lilo.conf: Insert an append = "irqdebug" in the section of your kernel image; run lilo. See 'man 7 bootparam' and 'man 5 lilo.conf')

8.2 RealTime graphics thread runs away:
Symptoms: Matrox graphics and MC DAQ card share the same IRQ (see 'lspci -v'). When a trial is started, the RT graphics thread takes all CPU time and {renders the system unusable | is killed by the watchdog}.
Cause: matroxfb and Comedi cb_pcidas64 drivers interfere the IRQ management of each other. (Bad implementation in Comedi driver?) matroxfb can't enable the VSYNC interrupt so the ioctl( WAITFORVSYNC ) fails. Hence, DirectFB does a busy wait for the IRQ so the thread never sleeps.
Solution: Put the DAQ card into another PCI slot that doesn't share interrupts with the AGP slot. Consult the motherboard manual or try it out. A good guess is a slot physically far away from the AGP slot.

8.3 dfb hangs at startup/initialization (dfbinfo hangs already)
dfb init has problems, if the module has been loaded before X.
Solution: Load matroxfb after X has been started.
Reload dfb modules:
# rmmod matroxfb_base matroxfb_DAC1064 matroxfb_accel cfbcopyarea cfbimgblt cfbfillrect matroxfb_Ti3026 matroxfb_g450 g450_pll matroxfb_misc mga
# modprobe matroxfb_base
# modprobe mga


==============
|| APPENDIX ||
==============

A.1 RTAI device nodes creation script
=====================================
-----------------8<-----------------------------
#!/bin/bash
mkdir /dev/rtf
for n in `seq 0 9`
do
 f=/dev/rtf/$n
 mknod -m 666 $f c 150 $n
done
for n in `seq 0 9`
do
 f=/dev/rtf$n
 mknod -m 666 $f c 150 $n
done
-----------------8<-----------------------------

A.2 Patch to disable PCMCIA drivers:
=====================================
-------------------------------------------------------------------------------
--- comedi-debian/comedi-0.7.70/debian/rules 2007-02-25 18:12:38.000000000 +0100
+++ comedi-build/debian/rules 2007-02-25 18:56:10.000000000 +0100
@@ -34,7 +34,7 @@
 config.status: configure
        dh_testdir
        # Add here commands to configure the package.
- CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --with-rtaidir=/usr/lib/realtime
+ CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --with-rtaidir=/usr/lib/realtime --disable-pcmcia


 build-arch: build-arch-stamp
-------------------------------------------------------------------------------

A.3 Startscript for automatically configuring comedi device:
=============================================================

#! /bin/sh
#
# comedi-device Associate Comedi driver with device file
#
# Friedemann Bunjes <friedemann.bunjes@uni-tuebingen.de>
#

case "$1" in
  start)
        echo -n "Associating Comedi driver with device file."
# comedi_config /dev/comedi0 ni_pcimio
        comedi_config /dev/comedi0 cb_pcidas64
       ;;
  stop)
        ;;
  restart|force-reload)
        ;;
  *)
        ;;
esac

exit 0
}}}
<<Anchor(screencasting)>>
== Creating screencasts ==

Install recordmydesktop and the frontend gtk-recordmydesktop:
 {{{
aptitude install recordmydesktop gtk-recordmydesktop
 }}}

RECORDMYDESKTOP(1): RECORDMYDESKTOP(1)

NAME
       recordMyDesktop - record desktop sessions to an Ogg-Theora-Vorbis file.

SYNOPSIS
       recordmydesktop [ Options ]^ filename

DESCRIPTION
               recordMyDesktop produces a file(default out.ogv) that contains a video and audio recording
       of a linux desktop session. The default behavior of recording is to mark areas that have changed(through libxdamage)
       and update the frame. This behavior can be changed (option --full-shots ) to produce a more accurate result
       or capture windows that do not generate events on change(windows with accelerated 3d context)
       but this will notably increase the workload.

GTK-RECORDMYDESKTOP(1): GTK-RECORDMYDESKTOP(1)

NAME
       gtk-recordMyDesktop - graphical gtk frontend for recordMyDestkop

SYNOPSIS
       recordmydesktop [ Options ]^ filename

DESCRIPTION
              gtk-recordMyDesktop is a graphical frontend for recordMyDesktop
       There are no options for the program, just execute it and use it from the Desktop panel

HowTo setup a new nrec development system

1. Installing the operating system

  1. Make sure, that you have got linux compatible hardware.
  2. Get a current debian netinst iso from debian.org and burn it on a CD.

  3. Boot from this CD and install debian (desktop system).
    • If the installer is not able to detect your network hardware, insert an old standard PCI network card and use this one.
    • Choosing one partition for all data is fine. If you feel expertic, you can create different partitions.
    • Type in the administrator password and login data for your first default user (e.g. devel).
    • Use a network mirror from your country (e.g. ftp://ftp.de.debian.org/).

    • Choose the "Desktop environment" and "Standard system" software installation profiles.
  4. Install sux, kde and openssh, if you want to access the machine from remote:
    aptitude -y install sux kde openssh-server

2. Building a Linux Kernel with RTAI realtime extensions

  1. Get latest stable linux kernel source from http://www.kernel.org/pub/linux/kernel/ (e.g. http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.8.tar.gz)

    cd /usr/local/src && wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.8.tar.gz
  2. get rtai from https://www.rtai.org/RTAI/ (e.g.: https://www.rtai.org/RTAI/rtai-3.9.tar.bz2)

    wget --no-check-certificate https://www.rtai.org/RTAI/rtai-3.9.tar.bz2
  3. Unpack kernel-sources and rtai-sources to /usr/local/src
    • (after downloading or moving the packages to /tmp):
    cd /usr/local/src && tar xzvf linux-2.6.38.8.tar.gz  && tar xjvf rtai-3.9.tar.bz2
  4. Change into the build dir
    cd linux-2.6.38.8
  5. Copy config file of your running kernel into the build dir (for a reasonable default config)
    cp /boot/config-2.6.32-5-686 .config
  6. Get packages for kernel-compilation:
    aptitude -y install kernel-package libncurses5-dev
  7. Apply rtai patch suitable for your kernel version:
    patch -p1 --dry-run < ../rtai-3.9/base/arch/x86/patches/hal-linux-2.6.38.8-x86-2.11-02.patch
    patch -p1 < ../rtai-3.9/base/arch/x86/patches/hal-linux-2.6.38.8-x86-2.11-02.patch
  8. Configure and build kernel:
    make-kpkg --initrd --append-to-version rtai --config menuconfig kernel-image 
    When the kernel menuconfig menu pops up, make sure
    • Loadable module support ---> Module versioning support is disabled

    • Bus options (PCI etc.) --->

      • PCI support ---> PCI Express support is enabled

    • Processor type and features --->

      • Processor family: Set to right processor type for your system. You might want to find it out by
        cat /proc/cpuinfo
      • Symmetric multi-processing support is enabled
      • Multi-core scheduler support is enabled
      • Preemption Model ---> Voluntary Kernel Preemtion (Desktop) is enabled

    • Virtualization is disabled

    Important for rtai compatibility (see http://wiki.linuxcnc.org/emcinfo.pl?Ubuntu10.04Notes):

    • Processor type and features ---> HPET Timer Support ---> disabled

    • Processor type and features ---> Interrupt pipeline ---> enabled [*]

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> enabled [*]

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated /proc/acpi files ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated power /proc/acpi directories ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Future power /sys interface ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated /proc/acpi/event support ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> AC Adapter ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Battery ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Button ---> enabled[*]

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Video ---> module [M]

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Fan ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Dock ---> enabled [*]

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Processor ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Disable ACPI for systems before Jan 1st this year ---> 0

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Debug Statements ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> PCI slot detection driver ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Container and Module Devices ---> disabled

    • Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Smart Battery System ---> disabled

    • Power management and ACPI options ---> APM (Advanced Power Management) BIOS support ---> disabled

    • Power management and ACPI options ---> CPU Frequency scaling ---> disabled

    • If you are using an older RTAI patch you may get the following error:
      • include/linux/ipipe.h:76:2: error: #error "CONFIG_NR_CPUS is too large, please lower it." To fix this disable sparse irq numbering (CONFIG_SPARSE_IRQ=n):
        • Processor type and features ---> Support sparse irq numbering ---> disabled

    • If you have a multi cores CPU or SMP system, don't choose a processor family which has no TSC (time stamp counter).
      • This means that for example you can not choose 586/K5/5x86/6x86/6x86MX as Processor family if you have a dual cores CPU. In conclusion, choose the most suitable processor family for your machine.
    • NOTE: No need to disable High Memory Support for RTAI 3.7.1 and newer
    • NOTE: No need to disable Symmetric multi-processing support for the uniproccesor machine for RTAI 3.7.1 and newer.
      • But if you don't have a multi cores CPU or SMP system, you can disable it to improve the performance
    • NOTE: There was supposedly no need to disable Module Versioning Support for RTAI 3.7.1, but it seems to be needed for the latest RTAI (3.8.1 or magma).
      • I don't know if this is an RTAI problem or emc2, since I could run the RTAI latency test but not the emc2 stuff.
    • NOTE: No need to turn off debugging if building packages with the ubuntu debian/rules system.
      • Otherwise remember to turn off debugging info to vastly reduce kernel size!
    Then "Exit", Answer question "Save kernel config?" with "Yes" and wait for the kernel to compile (Take a break).
  9. Leave kernel source dir and install the built kernel
    cd /usr/local/src && dpkg -i linux-image-2.6.38.8rtai_2.6.38.8rtai-10.00.Custom_i386.deb
  10. If you want, check and update "GRUB_DEFAULT" value for grub boot manager entry:
    less /boot/grub/grub.cfg
    nano /etc/default/grub
    update-grub
  11. Reboot:
    reboot
  12. After booting the new Kernel, you might have to rebuild the graphic card driver module:
    sh NVIDIA-Linux-x86-173.14.12-pkg1.run
    and verify the display settings:
    nvidia-settings
  13. It might also be necessary to reinstall your network card driver.

3. Building the RTAI modules

  1. Go to the rtai source directory:
     # cd /usr/local/src/rtai-3.8.1
  2. Make it:
     # make menuconfig
    • In the menu "General" set the rtai-path (/usr/lib/realtime) and the path to the kernel sources (/usr/local/src/linux-2.6.38.8).
    • Choose "Exit", "Exit" and "Yes".
     # make install
  3. If you want to test rtai, do:
     # export PATH=/usr/lib/realtime/bin:$PATH
     # cd /usr/lib/realtime/testsuite/kern/latency
     # ./run
    In short:
    export PATH=/usr/lib/realtime/bin:$PATH && 
    cd /usr/lib/realtime/testsuite/kern/latency && 
    ./run
    cd /usr/local/src
  4. It is useful to link the rtai modules to /lib/modules/$(uname -a)/ because they can then be loaded automatically if e.g. a comedi module needs them:
    ln -s /usr/lib/realtime/modules /lib/modules/2.6.38.8rtai/rtai
    depmod -a

4. Installing the graphic card driver

Here are the instructions for nVidia cards. For ATI cards the process is similar. Please check for instructions on the web.

  1. Check what graphic card you have. If lspci does not help you, you will have to open the case and have a look.

  2. For nvidia cards you might want to get your driver here: http://www.nvidia.de/Download/index.aspx

  3. Save it to e.g. /usr/local/src.
  4. Install the packages necessary for the graphics kernel module build:
    aptitude install binutils gcc make linux-headers-$(uname -r)
  5. Now you have to shut down X11 by switching to a console (Alt-Ctrl-F1), logging in as root and executing
    /etc/init.d/gdm3 stop
  6. Go to the directory, where you stored the installer into:
    cd /usr/local/src
    sh NVIDIA...
  7. When an error message about the Nouveau kernel driver appears, let the installer create a file in modprobe.d to disable it and reboot, switch to the shell, stop gdm3 and restart the installer
  8. Ignore messages about the gcc version (e.g. let the installer use the installed gcc 4.4. instead of 4.3) and let the installer do all modifications it wants to.
  9. restart gdm3:
    /etc/init.d/gdm3 start
  10. Adjust your display settings:
    nvidia-settings

    Set the appropriate resolutions for your screens and set up a separate screen for the second monitor (if you have one). In the OpenGL Settings of the stimulus X Screen make sure, that the "Sync to VBlank" option is enabled and the "Allow Flipping" option is disabled.

    If you are using a high speed (e.g. 120 Hz) screen, you may have to disable (uncheck) the option "GPU 0 - DFP-0 - Information - Flat Panel Scaling - Force Full GPU Scaling" to enable the correct hight framerate for your screen.

5. Comedi

  1. Install the autoconf package:
    aptitude -y install autoconf
  2. Download current comedi git snapshot from http://www.comedi.org/download.html, move it to /usr/local/src and unpack it:

    cd /usr/local/src
    tar -xvzf comedi-HEAD-6f425c7.tar.gz 
  3. Configure it with the rtai package:
    cd comedi-HEAD-6f425c7
    ./autogen.sh
    ./configure --with-rtaidir=/usr/lib/realtime
    If you want to use a PCMCIA card in a notebook, add the PCMCIA drivers:
    ./configure --enable-pcmcia --with-rtaidir=/usr/lib/realtime 
  4. Make and install it and create the devices:
    make &&
    make install &&
    depmod -a &&
    make dev
  5. If you want to use a PCMCIA card in a notebook, some more steps are necessary (do this after installing comedilib):

    • Assuming you installed comedilib into /usr/local - this is true if you didn't 'configure' it with a prefix other than that:
      cd /etc/pcmcia
      ln -s /usr/local/etc/pcmcia/* .
      These steps install (link) the comedi-specific pcmcia scripts into the system's standard location for pcmcia scripts. After this the PCMCIA service of your laptop should attempt to load the needed modules for your card and configure it with comedi_configure as soon as you insert the card. To quickly check if it worked then:
      cat /proc/comedi
      When the modules have been loaded and comedi_config has been executed, a line containing '0: ni_mio_cs' should appear (among others). If that's the case your DAQCard is properly configured.

      If not (especially, if comedy_config produces the error "comedi.o not loaded"), a modification in /etc/modprobe.d will be necessary (http://groups.google.com/group/comedi_list/browse_thread/thread/c24e52bb196abe61): If you are using the current CVS version of comedi, then by default, all comedi devices are reserved for autoconfigured PCI and USB devices, so if you want to configure ISA or PCMCIA devices you need to tell Comedi to reserve some or all comedi devices with a module option when the comedi.ko module is loaded. The easiest way to do that is to create and edit /etc/modprobe.d/comedi.conf and add one of the following lines:

      options comedi comedi_num_legacy_minors=4 
      (you can change the number 4 if you want), or:
      options comedi comedi_autoconfig=0 

      The first option, comedi_num_legacy_minors=4 reserves 4 comedi devices for use by non-autoconfigured devices. The second option comedi_autoconfig=0 disables auto-configuration completely. Take your pick! You'll have to run 'sudo depmod -a' and reload all the comedi modules for the change to take effect, or just reboot.

  6. We need some packages for comedilib:
    aptitude install libtool flex bison
  7. Now is a good time to download (http://www.comedi.org/download/, e.g. http://www.comedi.org/download/comedilib-0.8.1.tar.gz), compile and install comedilib:

    cd /usr/local/src
    wget http://www.comedi.org/download/comedilib-HEAD-54712cb.tar.gz
    tar -xvzf comedilib-HEAD-54712cb.tar.gz
    cd comedilib-HEAD-54712cb
    ./autogen.sh
    ./configure
    make
    make install
  8. Add /usr/local/lib to the ldconfig config file /etc/ld.so.conf.d/i486-linux-gnu.conf:
    pico /etc/ld.so.conf.d/i486-linux-gnu.conf
    The file should look similar to this:
    # Multiarch support
    /lib/i486-linux-gnu
    /usr/lib/i486-linux-gnu
    /usr/local/lib
  9. Run ldconfig to make the new libraries visible:
    ldconfig
  10. Load modules and associate comedi-driver of your card to comedi-device (find appropriate driver at http://www.comedi.org/hardware.html):

    # RTAI modules
    modprobe rtai_hal
    modprobe rtai_fifos
    
    # Comedi modules
    # For National Instruments cards:
    # modprobe ni_pcimio
    # modprobe ni_mio_cs
    # For measurement computing cards:
    # modprobe cb_pcidas64
    
    modprobe comedi_rt_timer
    modprobe kcomedilib
    Modules can be specified in /etc/modules (don't forget to uncomment the line for your card):
    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    
    loop
    
    # RTAI modules
    rtai_hal
    rtai_fifos
    
    # Comedi modules
    # For National Instruments cards:
    ni_pcimio
    # ni_mio_cs
    # For measurement computing cards:
    # cb_pcidas64
    
    comedi_rt_timer
    kcomedilib
  11. Configure comedi with the comedi-driver of your card

    (find appropriate driver at http://www.comedi.org/hardware.html):

    # Measurement Computing:
    comedi_config /dev/comedi0 cb_pcidas64
    # National Instruments:
    comedi_config /dev/comedi0 ni_pcimio
    # National Instruments DaqCard:
    comedi_config /dev/comedi0 ni_mio_cs
  12. Test comedi installation:
    comedi_test
  13. After calling comedi_config it is time, to check for interrupt conflicts. The nvidia card or a SATA controller should not share the same interrupt with the daq card. Use these commands to find out:
    dmesg
    cat /proc/interrupts
    lspci -v
    lspci -vb
    If a conflict occurs, you can try to put the daq card into a different PCI slot. A conflict with the SATA controller might be solved by setting the SATA mode from "Enhanced" to "Compatible" in the BIOS.

6. Qwt

  1. Make sure you have qt4 and the g++ compiler installed:
    aptitude -y install qt4-dev-tools qt4-designer qt4-doc build-essential
  2. Download the latest Qwt from
    cd /usr/local/src && wget http://downloads.sourceforge.net/project/qwt/qwt-beta/6.1.0-rc3/qwt-6.1-rc3.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fqwt%2F&ts=1362123587&use_mirror=netcologne
  3. Unpack the archive:
    tar -xvjf qwt-6.1-rc3.tar.bz2  
  4. Build the library:
    cd qwt-6.1-rc3/src/ && qmake && make && make install
  5. To use the library you have to
    • EITHER install Qwt by
      • copying the *.h files in src/ to /usr/local/include/:
        cp src/*.h /usr/local/include
      • copying those in lib/ to /usr/local/lib/.
        cd /usr/local/src/qwt-6.1-rc3/lib && tar -cf l.tar *
        mv l.tar /usr/local/lib
        cd /usr/local/lib
        tar xf l.tar
        rm l.tar
      • For the impatient people: All the above to copy & paste:

         cp /usr/local/src/qwt-6.1-rc3/src/*.h /usr/local/include
         cd /usr/local/src/qwt-6.1-rc3/lib && tar -cf l.tar * && mv l.tar /usr/local/lib && cd /usr/local/lib && tar xf l.tar && rm l.tar
         cd /usr/local/src/qwt-6.1-rc3
      • verifying, that /usr/local/lib is in the ldconfig config file /etc/ld.so.conf.d/i486-linux-gnu.conf:
        cat /etc/ld.so.conf.d/i486-linux-gnu.conf
        should show something like:
        # Multiarch support
        /lib/i486-linux-gnu
        /usr/lib/i486-linux-gnu
        /usr/local/lib
      • running ldconfig:
        ldconfig
    • OR make sure the Qwt files are found by
      • adding the path to include/ to the INCLUDEPATH line in the nrec *.pro file.
      • adding the path to lib/ to the LIBS line in the nrec *.pro file (prefixed with '-L').
      • adding the path to lib/ to the LD_LIBRARY_PATH environment variable.
  6. If you want to test qwt by taking a look at the examples, build them:
    cd examples && qmake && make && bin/radio

7. Development tools and libraries

  1. Install subversion client, kdevelop, the HDF5 library (required) and tools (optional), the movie libraries, the gnu scientific library, the debugger ddd and the ssh server (if needed):
    aptitude -y install subversion kdesvn kompare kdevelop libhdf5-serial-1.8.4 libhdf5-serial-dev hdf5-tools libpng12-0 libpng12-dev libfreetype6 libfreetype6-dev libavformat-dev libavcodec-dev libpostproc-dev libswscale-dev libswscale0 gsl-bin libgsl0ldbl libgsl0-dev ddd openssh-server

8. nrec

  1. Checkout module "nrec" from the subversion server
     svn co https://user@134.2.114.126/nrec
  2. Install the vicon library:
     cp nrec/src/test/vicon/libViconDataStreamSDK_CPP.so /usr/local/lib
     ldconfig
  3. Generate Makefile from qmake project file
     cd nrec/branches/squeeze-qt3/src && qmake-qt3 -o Makefile nrec.pro
    To generate the debug binary nrec_debug that contains the debug information that e.g. ddd needs:
     qmake CONFIG+="debug" nrec.pro && make clean && make
  4. Import nrec project into KDevelop (optional)
    • Run kdevelop
    • "Project" -> "Import Existing Project"

      • Directory: Browse to nrec/branches/squeeze-qt3/src you have just checked out.
      • Fetch from: Ignore this.
      • Project Name: "nrec"
      • Project Type: "QT C++ Application (QMake based)"
      • Author: Your Name
      • Email: Your Email address
  5. Compile nrec: Either in KDevelop "Build" -> "Build Project" or on the command line type

    make

9. xoscope

The xoscope (http://xoscope.sourceforge.net/) is a nice little oscilloscope program that can be used to check analog inputs of the daq card via the comedi interface.

To install it, type

  • aptitude install xoscope 

10. Setting up the multiuser-environment

This is probably not the most secure way to do it, but it is working:

  1. Install the sudo package:
    aptitude install sudo
  2. Put the call of the startscript in a file in /usr/local/bin
    echo -e "sudo /usr/bin/nvidia-settings -l\nsudo /home/devel/nrec/run/nrec.sh $1" > /usr/local/bin/nr
  3. Make it executable:
    chmod a+x /usr/local/bin/nr
  4. Modify the sudo settings via visudo, so that a user can execute the startscipt:
    # /etc/sudoers
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # See the man page for details on how to write a sudoers file.
    #
    
    Defaults        env_reset
    
    # Host alias specification
    
    # User alias specification
    User_Alias      ALLE = devel, user
    # Cmnd alias specification
    
    # User privilege specification
    root    ALL=(ALL) ALL
    ALLE    ALL=NOPASSWD: /home/devel/nrec/run/nrec.sh, /usr/local/bin/nr, /home/devel/nrec/src/nrec, /home/devel/nrec/branches/squeeze-qt3/src/nrec, /usr/bin/nvidia-settings
  5. Add xhost command to kde Autostart folder:
    echo "xhost localhost" > ~/.kde/Autostart/xhost_localhost && chmod a+x ~/.kde/Autostart/xhost_localhost
  6. now any user that is added by visudo can start nrec via:
    nr

11. Creating screencasts

Install recordmydesktop and the frontend gtk-recordmydesktop:

  • aptitude install recordmydesktop gtk-recordmydesktop

RECORDMYDESKTOP(1): RECORDMYDESKTOP(1)

NAME

  • recordMyDesktop - record desktop sessions to an Ogg-Theora-Vorbis file.

SYNOPSIS

  • recordmydesktop [ Options ]^ filename

DESCRIPTION

  • recordMyDesktop produces a file(default out.ogv) that contains a video and audio recording
  • of a linux desktop session. The default behavior of recording is to mark areas that have changed(through libxdamage) and update the frame. This behavior can be changed (option --full-shots ) to produce a more accurate result or capture windows that do not generate events on change(windows with accelerated 3d context) but this will notably increase the workload.

GTK-RECORDMYDESKTOP(1): GTK-RECORDMYDESKTOP(1)

NAME

  • gtk-recordMyDesktop - graphical gtk frontend for recordMyDestkop

SYNOPSIS

  • recordmydesktop [ Options ]^ filename

DESCRIPTION

  • gtk-recordMyDesktop is a graphical frontend for recordMyDesktop
  • There are no options for the program, just execute it and use it from the Desktop panel

nrec: SetupHowto (last edited 2015-06-03 09:22:06 by FriedemannBunjes)