Building a module out of dualbipod.c from step4linux results in some errors.
On my system I have to change following:
COMP is wrong in this line
ifeq ($(BUILDSYS),kbuild)
modules:
$(MAKE) -C $(KERNELDIR) SUBDIRS=$(shell pwd) CC=$(CC) V=0 -o $(KERNELDIR)/Module.symvers modules
Error 1: originally there is a $(KDIR)/Module.symvers must be KERNELDIR
Error 2: SUBDIRS needs $(shell pwd) not $('pwd') but this results in nonsense.
After doing this, I still have warnings.
sudo comp --install dualbipod.c
make -C /usr/src/linux-headers-2.6.32-122-rtai SUBDIRS=/tmp/tmp625dVT CC=gcc V=0 -o /usr/src/linux-headers-2.6.32-122-rtai/Module.symvers modules
make[1]: Betrete Verzeichnis '/usr/src/linux-headers-2.6.32-122-rtai'
CC [M] /tmp/tmp625dVT/dualbipod.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: "hal_init" [/tmp/tmp625dVT/dualbipod.ko] undefined!
WARNING: "hal_exit" [/tmp/tmp625dVT/dualbipod.ko] undefined!
WARNING: "hal_malloc" [/tmp/tmp625dVT/dualbipod.ko] undefined!
WARNING: "hal_param_float_new" [/tmp/tmp625dVT/dualbipod.ko] undefined!
WARNING: "hal_ready" [/tmp/tmp625dVT/dualbipod.ko] undefined!
CC /tmp/tmp625dVT/dualbipod.mod.o
LD [M] /tmp/tmp625dVT/dualbipod.ko
make[1]: Verlasse Verzeichnis '/usr/src/linux-headers-2.6.32-122-rtai'
cp dualbipod.ko /usr/realtime-2.6.32-122-rtai/modules/emc2/
The resulting .ko file is useable and works, but there should be no warnings in compilation of a emc2 Module.
I think it would be wise to split it.
The first part about makefiles is eventually related to installation/upgrade procedures for 10.04/2.4
On a fresh 10.04/2.4 installation it appears to work.
The second part (warnings from comp): I have seen the same in 8.04/2.3.
Is that normal behaviour of comp ?
Like mentioned in the forum I want to propose following:
Hi there,
after heavy googleing and testing.
My proposal for getting out of this sandpit ist following:
1.) the emc2 modules do not have a Modules.symvers file. This file holds the dependencies of extern defined functions.
2.) the rtai modules do have this file.
So to get it work to check dependencies to avoid the above mentioned warnings, we must have a Modules.symvers file too for emc modules.
This is a little more work to do. And when we want to do it, then we should correct the whole things for modules, like not living in standard kernel trees.
Advice from kernel.org is to use
/lib/modules/kernel-vers/extra/rtai and ../emc
My proposal is to use
/lib/modules/kernel-vers/extra/emc
/lib/modules/kernel-vers/extra/rtai
The next point is, if we do so:
The kernel Makefile syntax for external modules was changed, this is not dramatically but we can write it shorter in our template.
New line for rtai modules would be:
$(MAKE) -C $(KERNELDIR) M=$(RTAIMOD) O=$(RTAIMOD)
with
RTAIMOD := /lib/modules/linux-2.6.32-122-rtai/modules/extra/rtai
KERNELDIR := /usr/src/linux-headers-2-6-32-rtai
and for emc modules:
$(MAKE) -C $(KERNELDIR) M=$(EMCMOD) O=$(EMCMOD)
with
EMCMOD := /lib/modules/linux-2.6.32-122-rtai/modules/extra/emc
KERNELDIR := /usr/src/linux-headers-2-6-32-rtai
If we do it in this way, the O=.... can be omitted.
In former times you have to use KERNEL_EXTMOD Variable for something like that.
Or, if do NOT want this, we should generate at least the Modules.symvers file for emc modules.