Data Acquisition (DAQ) and Control from Microstar Laboratories

Knowledge Base: Platform

  • See the list of other topics for category Platform

Q10067 Using DAP boards with Linux kernel 2.6.31 and newer

Tags: Help, Linux, kernel, compiling, patch, Accel32 Server

Applies to: Linux, DAP, Accel32 Server

Can I use my DAP system with Linux kernel 2.6.31?

If the patch listed in article Q10056 [1] does not result in a successful compile, you might need to use the patch file described here instead. This new patch is cumulative, and includes all of the changes described there, plus additional changes contributed to the public domain by Al Conle. This has been used with the Suse 11.2 distribution (kernel version 2.6.31) and the Knoppix 5.3 distribution (kernel version 2.6.32). This patch is unsupported, and there is no guarantee that it will work for you, but in general, if the files compile successfully they should work correctly.

The changes are primarily related to a different representation of interrupt handler information in the Linux kernel:

  • some fields are defined differently in an interrupt data structure
  • a reference to a header file no longer used by the Linux kernel is removed
  • some new header references are added to resolve dependencies previously covered by the omitted header
  • the struct pt_regs * parameter of the interrupt_handler function is removed, no longer used
  • the accel32_fops structure is mapped to a different system call, providing a safer way to write pointer assignments in the structure
  • some macros are added to override some older notations
  • a minor naming problem was fixed

Not yet fixed:

  • if an application attempts to access a DAP board that does not exist in the system, this could result in a kernel crash.

Verify that you have root or sufficient user privileges so that you can read and write files where your DAP software was installed. Place a copy of the accel32.1.03.1-kernel.2.6.31-patch [2] file there. Save backup copies of your original files. Follow the installation sequence described in the DAP PCI Installation Manual [3] to install and compile the accel32 loadable kernel service [4] for Linux. If the INSTALL script completes successfully, you do not need to apply any patches.

The patch is in the form of a text file obtained by merging the output of two diff commands:

  diff -u ./DRIVER/driver/daccel.c ./PATCHED/driver/daccel.c
  diff -u ./DRIVER/driver/daccel.h ./PATCHED/driver/daccel.h

There are two ways that you can apply the patches.

  1. Manual method. This is much easier than it sounds. You will find a driver subdirectory present with the patch file in the install directory. Load the patch file, the daccel.c file, and daccel.h files in your favorite text editor. The patch file listing shows the changes and where they go. Lines to be removed are indicated with a '-' prefix, and the replacement lines are indicated with a '+' prefix. The rest of the patch file just shows the local context, to make the lines easier to find. Make the indicated changes, dropping the prefix characters from the replacement lines, and save your modified files in the original location.

  2. Command line method. For those who prefer the command line, change to the directory where the patch file is stored, and run the command:

      patch  --strip=2 --backup <accel32.1.03.1-kernel.2.6.31-patch >daccel.patch.log

    The strip=2 option tells the patch command to ignore the ./DRIVER/ and ./PATCHED/ notations present in the patch file. The patch command uses file name information from the patch file to locate and modify the two source code files, save a backup copy of the originals, and report the results to the daccel.patch.log file.

After you have applied the source file patches, go to the command line and locate the directory with the two patched source files.

  cd  driver

Now type the command line

  make -f Makefile

This will resume the Accel32 build at the point where it left off, and if all goes well you will have a clean compile.

Be sure to read the information in the accel32.txt file in the DAP installation directory, for instructions about loading the kernel module into the Linux system, and loading the DAPL operating system onto the DAP board.



[1] Topic Q10056 covers a patch used for kernel version 2.6.20 and later.

[2] Download the accel32.1.03.1-kernel.2.6.31-patch file.

[3] Download the DAP PCI Installation Manual.

[4] Download the Accel32 1.03.1 Server for Linux.