comedi & RTAI: unknown symbol rt_*

209 views
Skip to first unread message

Jan Benda

unread,
Oct 27, 2009, 2:01:27 PM10/27/09
to Comedi: Linux Control and Measurement Device Interface
Hi,

I am trying to set up RTAI 3.7.1 and comedi (todays cvs) on my debian
lenny
amd64 system with a 2.6.28.9 kernel from kernel.org. Everything works
fine
until I load the comedi modules:

modprobe comedi
FATAL: Error inserting comedi (/lib/modules/2.6.28.9rtai/comedi/
comedi.ko):
Unknown symbol in module, or unknown parameter (see dmesg)

dmesg
[ 509.809759] comedi: no symbol version for rt_request_srq
[ 509.809763] comedi: Unknown symbol rt_request_srq
[ 509.809913] comedi: no symbol version for rt_shutdown_irq
[ 509.809915] comedi: Unknown symbol rt_shutdown_irq
[ 509.809976] comedi: no symbol version for rt_enable_irq
[ 509.809978] comedi: Unknown symbol rt_enable_irq
[ 509.810168] comedi: no symbol version for rt_printk
[ 509.810170] comedi: Unknown symbol rt_printk
[ 509.810250] comedi: no symbol version for rt_pend_linux_srq
[ 509.810252] comedi: Unknown symbol rt_pend_linux_srq
[ 509.810390] comedi: no symbol version for rt_startup_irq
[ 509.810392] comedi: Unknown symbol rt_startup_irq
[ 509.810505] comedi: no symbol version for rt_free_srq
[ 509.810507] comedi: Unknown symbol rt_free_srq
[ 509.810705] comedi: no symbol version for rt_request_irq
[ 509.810707] comedi: Unknown symbol rt_request_irq
[ 509.810815] comedi: no symbol version for rt_release_irq
[ 509.810817] comedi: Unknown symbol rt_release_irq
[ 1240.389851] comedi: no symbol version for rt_request_srq
[ 1240.389855] comedi: Unknown symbol rt_request_srq
[ 1240.390005] comedi: no symbol version for rt_shutdown_irq
[ 1240.390008] comedi: Unknown symbol rt_shutdown_irq
[ 1240.390069] comedi: no symbol version for rt_enable_irq
[ 1240.390070] comedi: Unknown symbol rt_enable_irq
[ 1240.390261] comedi: no symbol version for rt_printk
[ 1240.390263] comedi: Unknown symbol rt_printk
[ 1240.390343] comedi: no symbol version for rt_pend_linux_srq
[ 1240.390345] comedi: Unknown symbol rt_pend_linux_srq
[ 1240.390483] comedi: no symbol version for rt_startup_irq
[ 1240.390485] comedi: Unknown symbol rt_startup_irq
[ 1240.390598] comedi: no symbol version for rt_free_srq
[ 1240.390600] comedi: Unknown symbol rt_free_srq
[ 1240.390799] comedi: no symbol version for rt_request_irq
[ 1240.390800] comedi: Unknown symbol rt_request_irq
[ 1240.390909] comedi: no symbol version for rt_release_irq
[ 1240.390911] comedi: Unknown symbol rt_release_irq

First I installed RTAI in /usr/realtime and made a link to the rtai
modules /lib/modules/2.6.28.9rtai/rtai -> /usr/realtime/modules
and run depmod -a.

I configured comedi with
./configure --with-linux-dir=/usr/src/linux --with-rtaidir=/usr/
realtime
where /usr/src/linux is pointing to the current kernel source.
Some lines of the ./configure output that might be relevant:

checking Linux config option CONFIG_M386... no
checking Linux config option CONFIG_M586... no
checking Linux config option CONFIG_M686... no
checking Linux config option CONFIG_MPENTIUMIII... no
checking Linux config option CONFIG_MK7... no
checking Linux config option CONFIG_SMP... yes
checking Linux config option CONFIG_HIGHMEM64G... no
configure: Putting kernel modules under /lib/modules/2.6.28.9rtai
configure: Putting kernel module development files
under /lib/modules/2.6.28.9rtai/build
checking Linux major/minor version... 2.6
checking for Linux CFLAGS... -DMODULE
checking for modpost... /lib/modules/2.6.28.9rtai/build/scripts/mod/
modpost
checking for strip... (cached) /usr/bin/strip
checking for depmod... (cached) /sbin/depmod
configure: creating modtool
checking Linux config option CONFIG_RTHAL... no
checking Linux config option CONFIG_ADEOS... no
checking Linux config option CONFIG_IPIPE... yes
checking RTAI directory /usr/realtime... found
checking Linux config option CONFIG_RTLINUX... no
checking Linux config option CONFIG_PCI... yes

The I succesfully loaded
modprobe rtai_sched

the subsequent
modprobe comedi
failed.

Any ideas?

Jan

Ian Abbott

unread,
Oct 27, 2009, 3:37:51 PM10/27/09
to comed...@googlegroups.com

I'm not sure if there's a proper solution to this, but rebuilding and
reinstalling the kernel and modules with CONFIG_MODVERSIONS unset, then
rebuilding and reinstalling RTAI and comedi in that order should work.
In "make menuconfig" for the kernel enter the "Enable loadable module
support" menu and disable the "Module versioning support" option.

The problem with CONFIG_MODVERSIONS seems to be when you have a set of
modules built externally to the kernel depending on some other set of
modules built externally to the kernel, e.g. comedi depending on rtai.
There might be a proper solution, but I don't know what it is. Probably
something to do with the Module.symvers files.

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-

Ian Abbott

unread,
Oct 27, 2009, 4:08:06 PM10/27/09
to comed...@googlegroups.com
On 27/10/09 19:37, Ian Abbott wrote:
> The problem with CONFIG_MODVERSIONS seems to be when you have a set of
> modules built externally to the kernel depending on some other set of
> modules built externally to the kernel, e.g. comedi depending on rtai.
> There might be a proper solution, but I don't know what it is. Probably
> something to do with the Module.symvers files.

To fix it properly, we probably need a configure option to set the
KBUILD_EXTRA_SYMBOLS variable - look for this in the kernel's
Documentation/kbuild/modules.txt file section 7.3.

Another workaround is to copy the Module.symvers file from the rtai's
build directory (or from rtai's module install directory) to Comedi's
"comedi" subdirectory (the directory where comedi.ko gets built, not the
top-level directory) before running "make" for comedi. When the make
completes, this Module.symvers in the "comedi" subdirectory will contain
CRC values for both the RTAI modules and the Comedi modules. A "make
install" will install this Module.symvers file along with the comedi
modules and "depmod -a" followed by "modprobe comedi" should then load
the comedi.ko module OK, even if the CONFIG_MODVERSIONS kernel config
option is used.

Ian Abbott

unread,
Oct 28, 2009, 8:46:30 AM10/28/09
to comed...@googlegroups.com

Even after doing that, there is still a problem with the rtai_comedi.ko
module if CONFIG_MODVERSIONS is set in the kernel and RTAI has the "Real
time COMEDI support in user space" add-on enabled. This is because
Comedi needs RTAI's Module.symvers file and the rtai_comedi module needs
Comedi's Module.symvers file.

This can be solved by copying Comedi's Module.symvers file back to the
RTAI build directory, going back to the RTAI build's "addons/comedi"
subdirectory, and running "make clean", "make", "cd ../..", and (as
root) "make install" to rebuild and reinstall the rtai_comedi.ko module.

In short:

1. Build and install rtai.
2. Copy rtai's Module.symvers to Comedi's "comedi" subdirectory.
3. Build and install comedi.
4. Copy the Module.symvers from Comedi's "comedi" subdirectory back to rtai.
5. Change directory to rtai's "addons/comedi", run "make clean", "make",
and (as root) "make install".

This is all a load of hassle. The simplest thing is to avoid using the
CONFIG_MODVERSIONS kernel option. :-)

Jan Benda

unread,
Oct 29, 2009, 10:06:12 AM10/29/09
to Comedi: Linux Control and Measurement Device Interface
Hi Ian,

thanks Ian for all this information!

1. I knew that I should deselect the CONFIG_MODVERSIONS when building
the
kernel, but I nevertheless got the unknown symbols. Today I recompiled
the kernel again
with CONFIG_MODVERSIONS disabled, and it worked... looks like somehow
on my
first try the CONFIG_MODVERSIONS got selected. Sorry for all the
fuss...

2. However, all your hints were quite illuminating. Placing the rtai
Module.symvers file
into the comedi directory indeed works great, with CONFIG_MODVERSIONS
selected for the kernel.

3. It would be really nice, if comedi configure or make would do this
automatically! It should not be too difficult to add this to the
Makefiles.
Or by setting the KBUILD_EXTRA_SYMBOLS variable as you suggested.

I guess that in the comedi/Makefile.am the following line before -$
(MAKE) in the all-local target should do it:

test "@HAVE_RTAI@" = "yes" && test -f "@RTAI_DIR@/modules/
Module.symvers" && cp "@RTAI_DIR@/modules/Module.symvers"
@abs_builddir@

This requires in m4/rtai.m4 these two lines after AC_SUBST
(RTAI_CFLAGS) (near the end):

AC_SUBST(RTAI_DIR)
AC_SUBST(HAVE_RTAI)


4. It would also be nice, if make install could copy the
comedi/Module.symvers file into the /lib/modules/`uname -r`/comedi
directory,
so that building modules that use rtai and comedi can use this file
for
compilation without needing to know where the comedi built directory
is.

For example, in comedi/makefile.am at the end of the install-data-
local target:

cp @abs_builddir@/Module.symvers /lib/modules/`uname -r`/comedi

Maybe there is a better way to do this through the kernel built
system.

With these two little extensions, the unknown symbol problem could be
easily
solved.

Thanks again!

Jan
> -=( Ian Abbott @ MEV Ltd.    E-mail: <abbo...@mev.co.uk>        )=-

Ian Abbott

unread,
Oct 29, 2009, 10:43:53 AM10/29/09
to comed...@googlegroups.com
On 29/10/09 14:06, Jan Benda wrote:
> Hi Ian,
>
> thanks Ian for all this information!
>
> 1. I knew that I should deselect the CONFIG_MODVERSIONS when building
> the
> kernel, but I nevertheless got the unknown symbols. Today I recompiled
> the kernel again
> with CONFIG_MODVERSIONS disabled, and it worked... looks like somehow
> on my
> first try the CONFIG_MODVERSIONS got selected. Sorry for all the
> fuss...

At least you got it working!

> 2. However, all your hints were quite illuminating. Placing the rtai
> Module.symvers file
> into the comedi directory indeed works great, with CONFIG_MODVERSIONS
> selected for the kernel.
>
> 3. It would be really nice, if comedi configure or make would do this
> automatically! It should not be too difficult to add this to the
> Makefiles.
> Or by setting the KBUILD_EXTRA_SYMBOLS variable as you suggested.
>
> I guess that in the comedi/Makefile.am the following line before -$
> (MAKE) in the all-local target should do it:
>
> test "@HAVE_RTAI@" = "yes" && test -f "@RTAI_DIR@/modules/
> Module.symvers" && cp "@RTAI_DIR@/modules/Module.symvers"
> @abs_builddir@
>
> This requires in m4/rtai.m4 these two lines after AC_SUBST
> (RTAI_CFLAGS) (near the end):
>
> AC_SUBST(RTAI_DIR)
> AC_SUBST(HAVE_RTAI)
>
>

It's possible to configure RTAI to store its modules somewhere other
than its default "modules" subdirectory, at least when configuring it
using its configure script instead of the menu configuration. It's
configure script has a "--with-module-dir=<module_dir>" option, which is
quite handy for storing the modules somewhere sensible like
"/lib/modules/`uname -r`/rtai" instead of "/usr/realtime/modules".
There isn't a reasonable way for comedi to find out this information
other than looking in a few likely places (and possibly finding the
wrong set of modules first).

There are also a few kernel version niggles. 2.6.18 onwards uses the
current name "Module.symvers", 2.6.17 called it "Modules.symvers" (note
the extra 's'), and the file was not created at all before 2.6.17 (at
least for unpatched kernel sources).

That's why I thought a generic means to specify KBUILD_EXTRA_SYMBOLS
would be better, but I have yet to investigate when in kernel history
the KBUILD_EXTRA_SYMBOLS variable came into existence!

Still, there's no reason not to have both a configure option and some
automatic setting, with the configure option taking priority.

> 4. It would also be nice, if make install could copy the
> comedi/Module.symvers file into the /lib/modules/`uname -r`/comedi
> directory,
> so that building modules that use rtai and comedi can use this file
> for
> compilation without needing to know where the comedi built directory
> is.
>
> For example, in comedi/makefile.am at the end of the install-data-
> local target:
>
> cp @abs_builddir@/Module.symvers /lib/modules/`uname -r`/comedi
>
> Maybe there is a better way to do this through the kernel built
> system.

I don't think it can be done through the kernel build system, but
there's no reason it couldn't be done as you suggest.

> With these two little extensions, the unknown symbol problem could be
> easily
> solved.

We probably need some documentation in the "RTAI Support" section of
Comedi's "INSTALL" file as well. That's right next to the "RTLinux
Support" section, but I don't know if we still support that!

> Thanks again!
>
> Jan

You're welcome!

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-

Reply all
Reply to author
Forward
0 new messages