building with kbuild for linux 2.6.15.2 + rtai

Hello comedi hackers!

I recently started using comedi and so far the experience has been very
pleasant. comedi is a great and greatly needed project. Thank you very
much for your work!

I'll now report some problems and tentative fixes for building comedi
against a 2.6.15.2 kernel patched with
hal-linux-2.6.15-i386-1.2-00.patch from rtai-3.3 with RTAI support.

I used --enable-kbuild because otherwise the
linux/include/asm-i386/mach-default/ directory was not included
otherwise. I encountered two problems:

1) the include flags needed for RTAI are not passed to kbuild. The patch
below tries to fix this for RTAI and RTLINUX, but as I'm not familiar
with the build system I don't know if the fix is correct or complete.

2) In the file comedi/drivers/addi-data/addi_common.c the linux header
asm/i387.h is included before linux/comedidev.h, which in turn includes
RTAI headers that redefine "init_fpu" among others. This lead to errors
which were resolved by moving the i387.h include before the comedidev.h
include. As I'm don't understand the init_fpu macros of RTAI I don't
know if this fix is correct, but it resolves my build problems. (I'm not
going to use addi-data.)

Thanks,
-Edwin


Index: comedi/Makefile.am
===================================================================
RCS file: /cvs/comedi/comedi/comedi/Makefile.am,v
retrieving revision 1.9
diff -u -r1.9 Makefile.am
--- comedi/Makefile.am	6 Feb 2006 03:21:17 -0000	1.9
+++ comedi/Makefile.am	22 Feb 2006 12:44:50 -0000
_at__at_ -4,11 +4,11 _at__at_
 if CONFIG_KBUILD
 module_PROGRAMS =
 all-local: comedi_kbuild.inc
-	make -I_at_abs_builddir_at_ -C $(LINUX_DIR) M=_at_abs_builddir_at_ CC="$(LINUX_CC) -I_at_abs_top_srcdir_at_/ -I _at_abs_top_srcdir_at_/include" V=1 modules
+	make -I_at_abs_builddir_at_ -C $(LINUX_DIR) M=_at_abs_builddir_at_ CC="$(LINUX_CC) -I_at_abs_top_srcdir_at_/ -I _at_abs_top_srcdir_at_/include $(RTAI_CFLAGS) $(RTLINUX_CFLAGS)" V=1 modules
 install-data-local: comedi_kbuild.inc
-	make -I_at_abs_builddir_at_ -C $(LINUX_DIR) M=_at_abs_builddir_at_ CC="$(LINUX_CC) -I_at_abs_top_srcdir_at_/ -I _at_abs_top_srcdir_at_/include" V=1 modules_install
+	make -I_at_abs_builddir_at_ -C $(LINUX_DIR) M=_at_abs_builddir_at_ CC="$(LINUX_CC) -I_at_abs_top_srcdir_at_/ -I _at_abs_top_srcdir_at_/include $(RTAI_CFLAGS) $(RTLINUX_CFLAGS)" V=1 modules_install
 clean-local: comedi_kbuild.inc
-	make -I_at_abs_builddir_at_ -C $(LINUX_DIR) M=_at_abs_builddir_at_ CC="$(LINUX_CC) -I_at_abs_top_srcdir_at_/ -I _at_abs_top_srcdir_at_/include" V=1 clean
+	make -I_at_abs_builddir_at_ -C $(LINUX_DIR) M=_at_abs_builddir_at_ CC="$(LINUX_CC) -I_at_abs_top_srcdir_at_/ -I _at_abs_top_srcdir_at_/include $(RTAI_CFLAGS) $(RTLINUX_CFLAGS)" V=1 clean
 else
 module_PROGRAMS = comedi.ko
 all-local:
Index: comedi/drivers/addi-data/addi_common.c
===================================================================
RCS file: /cvs/comedi/comedi/comedi/drivers/addi-data/addi_common.c,v
retrieving revision 1.3
diff -u -r1.3 addi_common.c
--- comedi/drivers/addi-data/addi_common.c	7 Oct 2005 05:06:34 -0000	1.3
+++ comedi/drivers/addi-data/addi_common.c	22 Feb 2006 12:44:51 -0000
_at__at_ -62,9 +62,9 _at__at_
 #include<linux/timex.h>
 #include<linux/timer.h>
 #include<linux/pci.h>
-#include<linux/comedidev.h>
 #include<asm/io.h>
 #include<asm/i387.h>
+#include<linux/comedidev.h>
 #include "../comedi_fc.h"
 
 #include "addi_common.h"

Received on 2006-02-22Z12:58:40