VXI and VME

cancel
Showing results for 
Search instead for 
Did you mean: 

Install NI-VXI on openSUSE

I am trying to install NI-VXI on a machine with openSUSE 10.3 (Linux kernel 2.6.22.17). I got LabVIEW 8.5, NI-KAL 1.7 and NI-VISA installed and working perfectly. But when I run the .INSTALL script for NI-VXI, I get the following output when the makefile is building the VXI driver
*************

Would you like to automatically configure and build the driver? [Yn] Y

Configuring the NIVXI Makefile to build on your system.

Kernel sources headers found in /lib/modules/2.6.22.17-0.1-default/source/include.
The kernel contains the vprintk symbol.
The remap_pfn_range() function is from a post-2.6.9 kernel.

Editing Makefile

Finished configuring.

Attempting to build the NI-VXI driver.
make -C /lib/modules/2.6.22.17-0.1-default/build SUBDIRS=/usr/local/nivxi/src KBUILD_VERBOSE=0 modules
make[1]: Entering directory `/usr/src/linux-2.6.22.17-0.1-obj/i386/default'
make -C ../../../linux-2.6.22.17-0.1 O=../linux-2.6.22.17-0.1-obj/i386/default modules
  CC [M]  /usr/local/nivxi/src/vxi.o
In file included from /usr/local/nivxi/src/vxi.c:13:
/usr/local/nivxi/src/mutex.h:59:42: error: macro "mutex_acquire" requires 4 arguments, but only 1 given
In file included from /usr/local/nivxi/src/vxi.c:13:
/usr/local/nivxi/src/mutex.h:59: warning: ‘regparm’ attribute only applies to function types
/usr/local/nivxi/src/mutex.h:59: warning: ‘cdecl’ attribute only applies to function types
/usr/local/nivxi/src/mutex.h:61:42: error: macro "mutex_release" requires 3 arguments, but only 1 given
/usr/local/nivxi/src/mutex.h:61: warning: ‘regparm’ attribute only applies to function types
/usr/local/nivxi/src/mutex.h:61: warning: ‘cdecl’ attribute only applies to function types
/usr/local/nivxi/src/vxi.c: In function ‘vxi_install_interrupt_handler’:
/usr/local/nivxi/src/vxi.c:111: warning: ‘deprecated_irq_flag’ is deprecated (declared at /usr/src/linux-2.6.22.17-0.1/include/linux/interrupt.h:66)
/usr/local/nivxi/src/vxi.c:111: warning: ‘deprecated_irq_flag’ is deprecated (declared at /usr/src/linux-2.6.22.17-0.1/include/linux/interrupt.h:66)
/usr/local/nivxi/src/vxi.c:112: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
/usr/local/nivxi/src/vxi.c:128:31: error: macro "mutex_acquire" requires 4 arguments, but only 1 given
/usr/local/nivxi/src/vxi.c:133:31: error: macro "mutex_release" requires 3 arguments, but only 1 given
/usr/local/nivxi/src/vxi.c:146:31: error: macro "mutex_acquire" requires 4 arguments, but only 1 given
/usr/local/nivxi/src/vxi.c:158:31: error: macro "mutex_release" requires 3 arguments, but only 1 given
make[4]: *** [/usr/local/nivxi/src/vxi.o] Error 1
make[3]: *** [_module_/usr/local/nivxi/src] Error 2
make[2]: *** [modules] Error 2
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.22.17-0.1-obj/i386/default'
make: *** [default] Error 2
Done!

*******************

NI tech support said that openSUSE in not supported (even though the web site says it is) and that I need to change my Linux distribution to one that is. Has anyone out there have a workaround to install it on openSUSE. I rather not change the Linux kernel if I can help it since all my other applications are running perfectly.

p.s. this is a repeat message of one I poster on the wrong forum
0 Kudos
Message 1 of 3
(8,015 Views)
Technically, openSuse is not supported, it's Suse Linux Enterprise Desktop that's supported.

There hasn't been a public release updated to support newer versions of the supported distributions yet.  I think kernel versions 2.6.17 and newer have introduced changes that broke compatibility.
0 Kudos
Message 2 of 3
(7,949 Views)

I had this same exact problem except on RHEL 5.6, and RHEL *is* a supported OS and it actually compiles fine on RHEL 4.7.   Since NI hasn't released a driver update after 2.1, I decided to see if I could fix it myself.  The problem lies in the fact that the header 'lockdep.h' was added with the following code:

 

 

#ifdef CONFIG_DEBUG_LOCK_ALLOC
# ifdef CONFIG_PROVE_LOCKING
#  define mutex_acquire(l, s, t, i)             lock_acquire(l, s, t, 0, 2, i)
# else
#  define mutex_acquire(l, s, t, i)             lock_acquire(l, s, t, 0, 1, i)
# endif
# define mutex_release(l, n, i)                 lock_release(l, n, i)
#else
# define mutex_acquire(l, s, t, i)              do { } while (0)
# define mutex_release(l, n, i)                 do { } while (0)
#endif

As you can see, the above function names directly conflict with the 'mutex_acquire' and 'mutex_release' function names defined in the NI source code.

 

The *correct* fix would be to simply rename 'mutex_release` and 'mutex_acquire' to 'ni_mutex_release' and 'ni_mutex_acquire' respecitvely in the files mutex.h, mutex.c and vxi.c so they no longer conflict with the function definitions in lockdep.h.  Unfortunately, the source code for nivxi.o is not given and this object file calls the two aforemented functions and this cannot be changed without the source.  However, NI has the source so they could do the function name change no problems. 

 

There is also a name conflict with the struct named 'mutex' and this can be fixed by changing the following in mutex.h:

 

OLD

 

typedef struct mutex mutex_t

 

 

NEW

 

typedef struct ni_mutex mutex_t

 

 

And also the following in mutex.c:

 

OLD

 

struct mutex {
        struct semaphore sema;
};

 

 

NEW

 

struct ni_mutex {
        struct semaphore sema;
};

 

 

Finally, in vxi_kernel.c there is a call to '__put_page()' that needs to be updated like so:

 

OLD

 

NIVXICC void vxi_dec_page_usage_count(struct page *pg) {
        __put_page(pg);
}

 

 

NEW

 

NIVXICC void vxi_dec_page_usage_count(struct page *pg) {
        put_page(pg);
}

 

 

If NI were to do all of the above, this kernel module should compile cleanly under the latest 2.6.X kernels.   In the interim, since we don't have the luxury of changing the names of 'mutex_acquire' and 'mutex_release' due to not having the 'nivxi.o' source, we have to do a small kludge and alter the 'lockdep.h' directly (mine is in /usr/src/kernels/2.6.18-238.el5-i686/include/linux/lockdep.h)

 

OLD

#ifdef CONFIG_DEBUG_LOCK_ALLOC
# ifdef CONFIG_PROVE_LOCKING
# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i)
# else
# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i)
# endif
# define mutex_release(l, n, i) lock_release(l, n, i)
#else
# define mutex_acquire(l, s, t, i) do { } while (0)
# define mutex_release(l, n, i) do { } while (0)
#endif

 

NEW

#ifndef NOLOCKDEP
# ifdef CONFIG_DEBUG_LOCK_ALLOC
# ifdef CONFIG_PROVE_LOCKING
# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i)
# else
# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i)
# endif
# define mutex_release(l, n, i) lock_release(l, n, i)
# else
# define mutex_acquire(l, s, t, i) do { } while (0)
# define mutex_release(l, n, i) do { } while (0)
# endif
#endif

And finally we need to alter the Makefile script in 'nivxi/src' to pass the 'NOLOCKDEP' define when compiling so that the offending block of code above is skipped for only the compilation of vximod.ko

 

OLD

 

EXTRA_CFLAGS    := -DVXI_MAJOR=0 $(KERNEL_VARIANT) $(DEBUG_KERNEL)

 

 

NEW

 

EXTRA_CFLAGS    := -DVXI_MAJOR=0 $(KERNEL_VARIANT) $(DEBUG_KERNEL) -DNOLOCKDEP

 

To reiterate, if NI were to update the source code of nivxi.c, vxi.c, mutex.c and mutex.h by changing all instances of 'mutex_acquire', 'mutex_release' and 'struct mutex' to 'ni_mutex_acquire', 'ni_mutex_release' and 'struct ni_mutex' then everything would be fixed.  They also need to change '__put_page()' to 'put_page()'.  But until they do (if they ever do), then we as users are forced to leave the names as-is, and instead do the -DNOLOCKDEP kludge in lockdep.h and the Makefile as well as fix '__put_page()'

 

 

 


0 Kudos
Message 3 of 3
(6,490 Views)