RTAI module: rtai functions undefined
Junhong Liu <[email protected]>
| Newsgroups | gmane.linux.real-time.rtai |
|---|---|
| Message-ID | <CAJWYAW0MXuufzxiy1wYjBCBWQBMO4oUUak6dRk-m38a_VQrmgw@mail.gmail.com> |
Hello! I have met problems *with building modules*.
I am using 3.10.32-rtai on Ubuntu 14.04 LTS.
"#rtai-config --linux-dir" gives: /usr/src/linux;
"# rtai-config --prefix" gives: /usr/realtime;
"#rtai-config --lxrt-cflags" gives: -I. -I/usr/realtime/include -Wall
-Wstrict-prototypes -pipe;
"#rtai-config --lxrt-ldflags" gives: -L/usr/realtime/lib -llxrt -lpthread;
"#rtai-config --module-cflags" gives: -I. -I/usr/realtime/include
-D_FORTIFY_SOURCE= -ffast-math -mhard-float;
"#rtai-config --module-cxxflags" gives: -I. -I/usr/realtime/include
-fno-rtti -fno-exceptions -fno-strength-reduce -pipe -fno-use-cxa-atexit
-D_FORTIFY_SOURCE=0 -ffast-math -mhard-float;
Files "rtProcess.c" and "Makefile" are in directory
"/home/huapeng/Yritys/RT/E1_Kern".
1. "rtProcess.c" is very short after minimization:
* // ------ rtProcess.c ----- define MODULE #include <linux/kernel.h> /*
Needed for KERN_INFO */ #include <linux/module.h> /*Needed by all
modules*/ #include <linux/moduleparam.h> #include <linux/init.h> /* Needed
for the macros */ #include <linux/stat.h> #include <linux/proc_fs.h>
#include <linux/stringify.h> #include <asm/io.h> #include <linux/errno.h>
/*EINVAL, ENOMEN*/ /* The following header files required to make use of
RTAI: give us access to the functions and data structues within RTAI */
#include <asm/rtai.h> // RTAI configuration switches #include
<rtai_sched.h> #include <rtai_sem.h> // RTAI semaphores #include
<rtai_fifos.h> #include <rtai_proc_fs.h> MODULE_LICENSE("GPL"); #define
TICK_PERIOD 1000000 #define TASK_PRIORITY 1 #define STACK_SIZE 1024 #define
FIFO 0 #define PI 3.1415 RT_TASK rt_task; // define rtai task int counter;
int rtprocess_init(void) // entry point { int retval; retval =1;
// ---1--- rt_set_oneshot_mode(); start_rt_timer(1); // the
execution starts // ---1--- printk("Hello in INIT!\n"); return
0; } void rtprocess_exit(void) { // ---2--- stop_rt_timer();
rt_busy_sleep(10000000); // ---2--- printk("Goodbye and
EXIT!---!\n"); return; } module_init(rtprocess_init);
module_exit(rtprocess_exit); *2. The file "Makefile":
* # Makefile EXTRA_CFLAGS += -I/usr/realtime/include \
-D__IN_RTAI__ KBUILD_EXTRA_SYMBOLS := $(shell rtai-config
--prefix)/modules/Module.sysmvers # To build modules outside of the kernel
tree, we run "make" # in the kernel source tree; the Makefile these then
includes this # Makefile once again. # This conditional selects whether we
are being included from the # kernel Makefile or not. ifeq
($(KERNELRELEASE),) # Assume the source tree is where the running
kernel was built # You should set KERNELDIR in the environment if it's
elsewhere KERNELDIR ?= /lib/modules/$(shell uname -r)/build # The
current directory is passed to sub-makes as argument PWD := $(shell
pwd) modules: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install clean: rm -rf *.o
*~ core .depend .*.cmd *.ko *.mod.c .tmp_versions .PHONY: modules
modules_install clean else # called from kernel build system: just
declare what our modules are obj-m := rtProcess.o endif *3
*. If there is no rtai-related functions, everything went fine, as
explained in the following *3.1 While commenting all the lines between the
"---1---" and "---2---", there is no rtai-related function.
I did the make, at
"root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern# make",
everything went fine, and the following message came:
* make -C /lib/modules/3.10.32-rtai/build M=/home/huapeng/Yritys/RT/E1_Kern
modules make[1]: Entering directory `/usr/src/linux-headers-3.10.32-rtai'
Building modules, stage 2. MODPOST 1 modules make[1]: Leaving directory
`/usr/src/linux-headers-3.10.32-rtai'*
*root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern# *3.2 Then I did
"insmod" as
"root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern# insmod
rtProcess.ko",
no warning came; then I checked by
"root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern# dmesg|tail",
and there came the sound message:
*"[35090.977185] Hello in INIT!" *Remove my module at
"root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern# by command
"rmmod" as
"root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern# rmmod
rtProcess.ko",
came no warnings,
and by
"root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern#dmesg|tail",
the right message came:
* "[35204.587710] Goodbye and EXIT!---!" *
4. Added the rtai-related lines into use, i.e., the lines between the
"---1---" and "---2---" are in use, used the same operations as in step 3.
4.1 I did the make at the root by
"root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern# make",
then comes the message on screen as follows:
* make -C /lib/modules/3.10.32-rtai/build M=/home/huapeng/Yritys/RT/E1_Kern
modules make[1]: Entering directory `/usr/src/linux-headers-3.10.32-rtai'
CC [M] /home/huapeng/Yritys/RT/E1_Kern/rtProcess.o Building modules,
stage 2. MODPOST 1 modules WARNING: "rt_busy_sleep"
[/home/huapeng/Yritys/RT/E1_Kern/rtProcess.ko] undefined! WARNING:
"stop_rt_timer" [/home/huapeng/Yritys/RT/E1_Kern/rtProcess.ko] undefined!
WARNING: "start_rt_timer" [/home/huapeng/Yritys/RT/E1_Kern/rtProcess.ko]
undefined! WARNING: "rt_set_oneshot_mode"
[/home/huapeng/Yritys/RT/E1_Kern/rtProcess.ko] undefined! CC
/home/huapeng/Yritys/RT/E1_Kern/rtProcess.mod.o LD [M]
/home/huapeng/Yritys/RT/E1_Kern/rtProcess.ko make[1]: Leaving directory
`/usr/src/linux-headers-3.10.32-rtai'*
*root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern# *As I saw that
the operation "make" produced a new "rtProcess.ko".
4.2 I did "insmod" the new rtProcess.ko by
* "root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern# insmod
rtProcess.ko" and a message appeared as the following: " insmod: ERROR:
could not insert module rtProcess.ko: Unknown symbol in module
root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/E1_Kern# " *What changes
should I make in order that my RTAI module would work? I am desperately
need help (I also tried to subscribe to the rtai list but I am not sure
what has happened ).
Thank you very much!
_______________________________________________
Rtai mailing list
[email protected]
https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai